internetee/registry

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

Summary

Maintainability
Test Coverage
- tech_contacts_invalid = @domain.errors.include?(:tech_contacts)
- panel_class = tech_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.tech_contacts.each do |tc|
          %tr
            %td= link_to(tc, admin_contact_path(tc))
            %td= tc.code
            %td= tc.email
      - if tech_contacts_invalid
        %tfoot
          - @domain.errors.messages[:tech_contacts].each do |x|
            %tr
              %td{colspan: 4}= x