fiedl/your_platform

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

Summary

Maintainability
Test Coverage
.page-header
  .row.align-itens-center
    .col-auto
      .page-pretitle= corporation.title
      .page-title Wohnheim
    .col-auto.ml-auto
      - if can? :create_post, hausbewohner
        = link_to new_group_post_path(group_id: hausbewohner.id), class: 'btn btn-white' do
          = mail_icon
          Nachricht an alle Hausbewohner
      - if can? :create_accommodation_sepa_debit, corporation
        = link_to "SEPA-Miet-Einzug", new_corporation_accommodation_sepa_debit_path, class: 'btn btn-primary'

.row
  .col-md-8
    - if rooms.any? || can?(:update_accommodations, corporation)
      %vue_rooms{':initial_rooms': rooms.to_json,
        ':corporation': corporation.to_json,
        ':editable': can?(:update_accommodations, corporation).to_json,
        download_icon: download_icon}
    - else
      .card
        .card-body
          Derzeit sind hier keine Räume eingetragen.
  .col-md-4
    = render layout: 'groups/profile_card', locals: {group: institution} do
      .text-center.pb-4.px-4
        = editable institution, :body, editable: can?(:update, institution), type: 'wysiwyg'

      - if postal_address.present? or phone.present?
        .card-body.no-border.text-center
          - if postal_address.present?
            .with-newlines.pt-0.mt-0.mb-4= postal_address
          - if phone.present?
            .mt-0.mb-4.obscure-in-demo
              = landline_icon
              = phone
      - # https://stackoverflow.com/a/2952056/2066546
      .card-footer
        = link_to t(:members), group_members_path(group_id: institution.id), class: "btn btn-sm btn-white"
        = link_to t(:profile), group_path(institution), class: "btn btn-sm btn-white"

    = render partial: 'groups/officers_card', locals: {group: institution}

    - if bank_account.present?
      .card
        .card-body.obscure-in-demo
          .account_holder.mb-3
            %label.form-label Kontoinhaber
            = bank_account.account_holder
          .iban.mb-3
            %label.form-label IBAN
            = bank_account.iban
          .bic.mb-3
            %label.form-label BIC
            = bank_account.bic
        - if can? :update, bank_account
          .card-footer
            = link_to "Kontodaten ändern", group_path(institution), class: 'btn btn-white btn-sm'