KyivKrishnaAcademy/ved_akadem_students

View on GitHub
app/views/academic_groups/_tab_general.html.haml

Summary

Maintainability
Test Coverage
.row
  .col-xs-12.vert-offset-top-1
    - unless academic_group.active?
      .row
        .col-xs-3.col-sm-2
          = "#{t('activerecord.attributes.academic_group.graduated_at')}:"
        .col-xs-9.col-sm-10
          = l(academic_group.graduated_at, format: :with_day)
    .row
      .col-xs-3.col-sm-2
        = "#{t('activerecord.attributes.academic_group.establ_date')}:"
      .col-xs-9.col-sm-10
        = l(academic_group.establ_date)
    - if academic_group.group_description.present?
      .row
        .col-xs-3.col-sm-2
          = "#{t('activerecord.attributes.academic_group.group_description')}:"
        .col-xs-9.col-sm-10
          = academic_group.group_description
    .row
      .col-xs-3.col-sm-2
        = t('academic_groups.show.active_students_count')
      .col-xs-9.col-sm-10
        = academic_group.active_students.count
    .row
      .col-xs-3.col-sm-2
        = t('academic_groups.show.prabhu_count')
      .col-xs-9.col-sm-10
        = academic_group.active_students.where(gender: true).count
    .row
      .col-xs-3.col-sm-2
        = t('academic_groups.show.mataji_count')
      .col-xs-9.col-sm-10
        = academic_group.active_students.where(gender: false).count
    - if academic_group["message_#{locale}"].present?
      .row
        .col-xs-3.col-sm-2
          = t('static_pages.home.message_for_group')
        .col-xs-9.col-sm-10
          - academic_group["message_#{locale}"].split("\n").each do |message_part|
            = message_part
            %br

  - if [academic_group.curator, academic_group.administrator, academic_group.praepostor].any?
    %h4.col-xs-12.text-center
      = t('academic_groups.show.group_servants')
    .col-xs-12
      .table-responsive
        %table.table.table-condensed
          %tbody
            - %i[curator administrator praepostor].each do |servant_role|
              - if academic_group.send(servant_role).present?
                %tr
                  - is_curator = servant_role == :curator
                  %td
                    = t("academic_groups.show.#{servant_role.to_s}")
                  %td
                    = thumb_with_pop(academic_group.send(servant_role))
                  %td
                    = link_to_show_person_or_name(academic_group.send(servant_role), short: true)
                  %td
                    = mail_to(academic_group.send(servant_role).email) unless is_curator
                  %td
                    = academic_group.send(servant_role).telephones.pluck(:phone).join(', ') unless is_curator