internetee/registry

View on GitHub
app/views/admin/contact_versions/show.haml

Summary

Maintainability
Test Coverage
- contact = ObjectVersionsParser.new(@version).parse

= render 'shared/title', name: contact.name

.row
  .col-md-8
    .panel.panel-default{:style => "min-height:420px;"}
      .panel-heading
        %h3.panel-title
          = l(@version.created_at, format: :short)
          = @version.event
          = plain_username(@version.terminator)
      .panel-body
        %dl.dl-horizontal
          %dt= t(:id)
          %dd{class: changing_css_class(@version,"code")}
            = contact.code

          %dt= t(:statuses)
          %dd{class: changing_css_class(@version,"statuses")}
            = contact.statuses.join(", ")

          %dt= t(:ident)
          %dd{class: changing_css_class(@version,"ident_country_code", "ident_type", "ident")}
            = ident_for(contact)

          - if contact.email.present?
            %dt= t(:email)
            %dd{class: changing_css_class(@version,"email")}
              = contact.email

          - if contact.phone.present?
            %dt= t(:phone)
            %dd{class: changing_css_class(@version,"phone")}
              = contact.phone

          - if contact.fax.present?
            %dt= t(:fax)
            %dd{class: changing_css_class(@version,"fax")}
              = contact.fax

          %br

          %dt= t(:created_at)
          %dd{class: changing_css_class(@version,"created_at")}
            = l(contact.created_at, format: :short)

          %dt= t(:updated_at)
          %dd{class: changing_css_class(@version,"updated_at")}
            = l(contact.updated_at, format: :short)

          %dt= t(:registrar_name)
          %dd{class: changing_css_class(@version,"registrar_id")}
            - if contact.registrar.present?
              = link_to(contact.registrar, admin_registrar_path(contact.registrar))

        %dl.dl-horizontal
          - if contact.org_name.present?
            %dt= t(:org_name)
            %dd{class: changing_css_class(@version,"org_name")}= contact.org_name

          - if contact.street.present?
            %dt= t(:street)
            %dd{class: changing_css_class(@version,"street")}= contact.street

          - if contact.city.present?
            %dt= t(:city)
            %dd{class: changing_css_class(@version,"city")}= contact.city

          - if contact.zip.present?
            %dt= t(:zip)
            %dd{class: changing_css_class(@version,"zip")}= contact.zip

          - if contact.state.present?
            %dt= t(:state)
            %dd{class: changing_css_class(@version,"state")}= contact.state

          - if contact.country.present?
            %dt= t(:country)
            %dd{class: changing_css_class(@version,"country_code")}= contact.country


      %span{:style => "padding-right:10px; float: right;"}
        - if (prev = @versions_map[(@versions_map.index(@version.id) - 1)]) && @versions_map.index(@version.id) != 0
          = link_to(t(:previous),
                    admin_contact_version_path(prev),
                    class: 'btn btn-primary')
        - else
          %a.btn.btn-primary.disabled{:href => "#"}
            %span= t(:previous)
        - if nxt = @versions_map[(@versions_map.index(@version.id) + 1)]
          = link_to(t(:next),
                    admin_contact_version_path(nxt),
                    class: 'btn btn-default')
        - else
          %a.btn.btn-default.disabled{:href => "#"}
            %span= t(:next)

  .col-md-4
    .panel.panel-default{:style => "min-height:450px;"}
      %ul.nav.nav-pills.nav-stacked
        - @versions.each do |vs|
          %li{class: (vs.id == @version.id) && :active}
            = link_to admin_contact_version_path(vs) do
              = l(vs.created_at, format: :short)
              = vs.event
      %span{:style => "padding-left:10px; position: absolute; bottom: 10px;"}
        = paginate @versions