Refactor namesrvers controller, WIP with domain contacts

This commit is contained in:
Martin Lensment 2014-09-16 16:28:08 +03:00
parent 4c4c65d431
commit 168e6d2a01
8 changed files with 122 additions and 30 deletions

View file

@ -0,0 +1,25 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.new_domain_contact')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('shared.back_to_domain'), [:admin, @domain], class: 'btn btn-default')
%hr
= form_for([:admin, @domain, @domain_contact]) do |f|
.row
.col-md-6
.form-group
= f.label :contact_type
= f.select :contact_type, options_for_select(DomainContact::TYPES, @domain_contact.contact_type), {}, {class: 'form-control'}
.col-md-6
.form-group.has-feedback
= f.label :contact
= text_field_tag(:contact, params[:contact], class: 'form-control js-contact-typeahead', placeholder: t('shared.contact_code'), autocomplete: 'off')
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
= f.hidden_field(:contact_id, class: 'js-contact-id')
.row
.col-md-12.text-right
= button_tag(t('shared.save'), class: 'btn btn-primary')

View file

@ -13,13 +13,13 @@
%th{class: 'col-xs-5'}= t('shared.email')
%th{class: 'col-xs-3'}= t('shared.action')
%tbody
- @domain.admin_contacts.each do |x|
- @domain.domain_contacts.admin.each do |x|
%tr
%td= link_to(x, root_path)
%td= x.email
%td= link_to(x.contact, root_path)
%td= x.contact.email
%td
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
= link_to(t('shared.detach'), admin_domain_admin_contact_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
= link_to(t('shared.detach'), admin_domain_domain_contact_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
- if @domain.errors.messages[:admin_contacts]
%tfoot
- @domain.errors.messages[:admin_contacts].each do |x|