internetee/registry

View on GitHub
app/views/admin/domains/partials/_admin_contacts.haml

Summary

Maintainability
Test Coverage
- admin_contacts_invalid = @domain.errors.include?(:admin_contacts)
- panel_class = admin_contacts_invalid ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
  .panel-heading.clearfix
    = t('.title')
  .table-responsive
    %table.table.table-hover.table-bordered.table-condensed
      %thead
        %tr
          %th{class: 'col-xs-4'}= t(:name)
          %th{class: 'col-xs-4'}= t(:id)
          %th{class: 'col-xs-4'}= t(:email)
      %tbody
        - @domain.admin_contacts.each do |ac|
          %tr
            %td= link_to(ac, admin_contact_path(ac))
            %td= ac.code
            %td= ac.email
      - if admin_contacts_invalid
        %tfoot
          - @domain.errors.messages[:admin_contacts].each do |x|
            %tr
              %td{colspan: 4}= x