codeRIT/hackathon_manager

View on GitHub
app/views/manage/schools/show.html.haml

Summary

Maintainability
Test Coverage
- blue = "#4886C2"
- green = "#7FEC8D"
- red = "#E44646"
- orange = "#F49C54"
- grey = "#A6A6A6"

= render "layouts/manage/page_title", title: @school.name, subtitle: "School" do
  .btn-group
    = link_to 'Edit', edit_manage_school_path(@school), class: 'btn btn-sm btn-outline-secondary'
    = link_to 'Merge', merge_manage_school_path(@school), class: 'btn btn-sm btn-outline-secondary'
    .btn-group{role: "group"}
      %button.btn.btn-sm.btn-outline-secondary.dropdown-toggle#title-actions{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"}
        .fa.fa-envelope-o.pr-1
        Send email
      .dropdown-menu.dropdown-menu-right{"aria-labelledby" => "title-actions"}
        = link_to 'Create message (confirmed or accepted applicants)', new_manage_message_path(type: 'bulk', recipients: ["school::#{@school.id}"]), class: 'dropdown-item'


.row
  .col-md-6
    %h4.border-bottom.pb-2.mb-3 Details
    %dl.row
      %dt.col-md-4 Name
      %dd.col-md-8
        = @school.name
        %br
        %small
          = link_to google_maps_link(@school.name), target: '_blank', rel: 'noopener' do
            Search in Google Maps
            %span.fa.fa-external-link.icon-space-l-half
      %dt.col-md-4 Address
      %dd.col-md-8
        - if @school.address.present?
          = @school.address
          %br
        = @school.full_location
        %br
        %small
          - link = google_maps_link(@school.address, @school.city, @school.state)
          = link_to link, target: '_blank', rel: 'noopener' do
            Search in Google Maps
            %span.fa.fa-external-link.icon-space-l-half
      %dt.col-md-4 Home school
      %dd.col-md-8
        - if @school.is_home?
          %span.badge.badge-success Home school
        - else
          %span.badge.badge-secondary Not home school

  .col-md-6
    %h4.pb-0 Duplicate Names
    %table.table.table-striped
      %thead
        %tr
          %th School Name
          %th Date Created
      %tbody
        - dupes = SchoolNameDuplicate.where(school_id: @school.id)
        - dupes.each do |dupe|
          %tr
            %td= dupe.name
            %td= display_datetime(dupe.created_at)
        - if dupes.blank?
          %tr
            %td{colspan: 2}
              %em No duplicate names exist for this school.
    %p.small.text-muted
      %span.fa.fa-info-circle.icon-space-l.icon-space-r-half
      If someone attempts to apply using a name above, they'll automatically be converted to this school.

.row.mt-2.mb-4
  .col-7
    %h4.border-bottom.pb-2.mb-4 Today's Activity
    = area_chart todays_activity_data_manage_dashboard_index_path(school_id: @school.id), colors: [blue, green, red, grey]
  .col-5
    %h4.border-bottom.pb-2.mb-4 Total Distribution
    = pie_chart @school.questionnaires.group('acc_status').count

.row.mt-2.mb-4
  .col
    %h4.border-bottom.pb-2.mb-4 Confirmation Activity
    = area_chart confirmation_activity_data_manage_dashboard_index_path(school_id: @school.id), colors: [green, red], library: { legend: { enabled: false } }

.row.mt-2
  .col
    %h4.border-bottom.pb-2.mb-3
      Questionnaires
      %small.text-muted (#{@school.questionnaires.count} total, #{@school.questionnaires.count { |q| q.checked_in? }} checked in)

= render "questionnaire_datatable", scope_params: { school_id: @school.id }, page_length: 25, columns: %w(link note first_name last_name email acc_status checked_in created_at)

.row.mt-4.mb-5
  .col-lg-6
    %h4.border-bottom.pb-2.mb-3 Change History
    = render "model_history", model: @school