kennethkalmer/powerdns-on-rails

View on GitHub
app/views/templates/_record_template.html.haml

Summary

Maintainability
Test Coverage
%tr[ record_template, :marker ]
%tr[ record_template, :show ]
  %td{ :width => 250 }= record_template.name
  %td{ :width => 50 }= record_template.ttl
  %td{ :width => 30 }= record_template.record_type
  %td{ :width => 30 }= record_template.prio
  %td{ :width => 250 }= record_template.content unless record_template.soa?
  %td{ :width => 36 }
    = link_to_function info_icon('table_edit.png', 'edit-record-template'), "editRecordTemplate(#{record_template.id})"
    = link_to info_icon('table_delete.png', 'delete-record-template'), record_template_path( record_template ), :method => :delete, :confirm => t(:confirm_template_record_delete)
- if record_template.soa?
  %tr[ record_template, 'show-soa' ]
    %td{ :colspan => 2 }  
    %td{ :colspan => 4 }
      %small
        = t :label_template_primary_nameserver
        = record_template.primary_ns
        %br
        = t :label_template_primary_contact
        = record_template.contact
        %br
        = t :label_template_refresh
        = record_template.refresh
        %br
        = t :label_template_retry
        = record_template.retry
        %br
        = t :label_template_expire
        = record_template.expire
        %br
        = t :label_template_minimum
        = record_template.minimum

%tr[ record_template, :edit ]{ :style => 'display: none' }
  %td{ :colspan => 6 }
    = form_for( record_template, :url => record_template_path( record_template ), :method => :put, :remote => true ) do |f|
      %div[ record_template, :error ]
      %table.gridwide
        %tr
        - if record_template.soa?
          %td
            %table
              %tr
                %td{ :colspan => 3 }= t :text_template_soa_editing
              %tr
                %td= t :label_template_primary_nameserver
                %td= f.text_field :primary_ns, :size => 20
                %td= help_icon('help-primary-ns')
              %tr
                %td= t :label_template_primary_contact
                %td= f.text_field :contact, :size => 20
                %td= help_icon('help-contact')
              %tr
                %td= t :label_template_refresh
                %td
                  = f.text_field :refresh, :size => 6
                  = help_icon('help-refresh')
                %td  
              %tr
                %td= t :label_template_retry
                %td
                  = f.text_field :retry, :size => 6
                  = help_icon('help-retry')
                %td  
              %tr
                %td= t :label_template_expire
                %td
                  = f.text_field :expire, :size => 6
                  = help_icon('help-expire')
                %td  
              %tr
                %td= t :label_template_minimum
                %td
                  = f.text_field :minimum, :size => 6
                  = help_icon('help-minimum')
                %td  
        - else
          %td{ :width => 250 }= f.text_field :name, :size => 15
          %td{ :width => 50 }= f.text_field :ttl, :size => 3
          %td{ :width => 30 }= record_template.record_type
          %td{ :width => 30 }
            - if record_template.record_type == 'MX'
              = f.text_field :prio, :size => 1
          %td{ :width => 250 }= f.text_field :content, :size => 15

        %td.top{ :width => 39 }
          = image_submit_tag "table_save.png", { :class => 'nb' }
          = link_to_function image_tag("cancel.png"), "hideRecordTemplate(#{record_template.id})"