CommunityGrows/communitygrows

View on GitHub
app/views/dashboard/index.html.haml

Summary

Maintainability
Test Coverage
%h1 Board Member Dashboard
.row
  .col-md-6
    #announcements
      %h2 Main Announcements
      #announcement_content
        %table.table.table-bordered.table-striped
          %thead
            %tr
              %th Date
              %th Title
          %tbody
            - @announcement_list.each do |announcement|
              %tr
                %td= announcement.updated_at.strftime("%m/%d/%Y %l:%M %p")
                %td= link_to "#{announcement.title}", comment_path(announcement.id)
      %h2 Subcommittee Announcements
      #announcement_content
        %table.table.table-bordered.table-striped
          %thead
            %tr
              %th Date
              %th Title
          %tbody
            - @subcomittee_announcements_list.each do |announcement|
              %tr
                %td= announcement.updated_at.strftime("%m/%d/%Y %l:%M %p")
                %td= link_to "#{announcement.title} [#{announcement.committee_type}]", comment_path(announcement.id)
      = link_to "Search", show_announcements_path(:categories => [:dashboard, :internal, :executive, :external]), :id => :main, :class => "btn btn-small btn-warning"

  .col-md-6
    #accordion.panel-group{"aria-multiselectable" => "true", :role => "tablist"}
      %h2 Events
      - @events.each do |event|
        .panel.panel-default
          .panel-heading{:id => "heading#{event.id}", :role => "tab"}
            %h4.panel-title
              %a{"aria-controls" => "collapse#{event.id}", "aria-expanded" => "false", "data-parent" => "#accordion", "data-toggle" => "collapse", :href => "#collapse#{event.id}", :role => "button"}
                = event.title
              %span.pull-right
                = event.date.strftime("%m") + "/" + event.date.strftime("%d")
          .panel-collapse.collapse{:id => "collapse#{event.id}", "aria-labelledby" => "heading#{event.id}", :role => "tabpanel"}
            .panel-body
              .clearfix
                %h4.pull-left= "Where: #{event.location}"
                %h4.pull-right= "Start: #{event.date.strftime("%m/%d/%Y %l:%M %p")}"
              %p.left-text= event.description
              %br
              - if event.url?
                = link_to "More Information", event.url, :target => "_blank"