wahyd4/ocelots

View on GitHub
app/views/teams/index.html.slim

Summary

Maintainability
Test Coverage
- content_for :javascript_includes do
  = javascript_include_tag 'teams'
- content_for :menu_items do
  li
    = link_to 'add team', '#add_new', class: 'fancybox'

div id="add_new" style="display:none;"
  p.lead Create a new team by specifying the team name and the unique URL.
  = form_for @team, html: {class: 'form-horizontal'} do |form|
    div.control-group
      label.control-label for="team_name" Team Name
      div.controls
        = form.text_field :name
    div.control-group
      label.control-label for="team_slug" URL
      div.controls
        p http://iocelots.com/#{form.text_field :slug}

    div.form-actions
      = form.submit 'Create', class: 'btn'
div style="overflow:hidden;margin-bottom:1em"
  div.btn-group style="float:left;"
    -if @sortby
     a.btn href='/teams' Team Name
     a.btn.btn-primary href='/teams?sortby=CreateDate' Create Date
    -else
     a.btn.btn-primary href='/teams' Team Name
     a.btn href='/teams?sortby=CreateDate' Create Date
  div.btn-group style="float:right;"
      input.span2.search-query id="show-filter" type="text" placeholder="search"

- @memberships.each do |membership|
  a href="/teams/#{membership.team_slug}"
    div.hero-unit.highlight
      div.row
        div.span4
          img src="/assets/team.png"
        div.span4
          h1.team_name = membership.team_name
          p = membership.team_description
        div.span1
          - if membership.pending?
            = form_tag "/membership/approve" do
              input type="hidden" name="id" value="#{membership.id}"
              = submit_tag 'Approve', class: 'btn btn-primary btn-block'
            = form_tag "/membership/leave" do
              input type="hidden" name="id" value="#{membership.id}"
              = submit_tag 'Leave', class: 'btn btn-danger btn-block'
        div.span1 style="margin:60px 0 0 65px"
           img style="float:left" src="assets/head.png"
             h3 style="margin:-7px 0 0 50px;color:#333" = membership.team_people.count
div.clearfix
div style="margin-top:-30px"
  h3 style="text-align:center" Viewable Teams
hr style="margin-top:-30px"
- @view_membership.each do |team|
   a href="/teams/#{team.slug}"
      div.hero-unit.highlight.viewable-team
            div.row
              div.span4
                img src="/assets/team.png"
              div.span4
                h1.team_name = team.name
                p = team.description
              div.span1
              div.span1 style="margin:60px 0 0 65px"
                         img style="float:left" src="assets/head.png"
                           h3 style="margin:-7px 0 0 50px;color:#333" = team.people.count