Add tech contacts attaching

This commit is contained in:
Martin Lensment 2014-09-15 16:39:43 +03:00
parent 80440d741b
commit a9ee1cdad1
6 changed files with 90 additions and 7 deletions

View file

@ -1,5 +1,10 @@
.panel.panel-default
.panel-heading= t('shared.tech_contacts')
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class}
.panel-heading.clearfix
.pull-left
= t('shared.tech_contacts')
.pull-right
= link_to(t('shared.add'), new_admin_domain_tech_contact_path(@domain), class: 'btn btn-primary btn-xs')
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
@ -14,4 +19,9 @@
%td= x.email
%td
= link_to(t('shared.edit'), root_path, class: 'btn btn-primary btn-xs')
= link_to(t('shared.detach'), root_path, method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
= link_to(t('shared.detach'), admin_domain_tech_contact_path(@domain, x), method: :delete, data: { confirm: t('shared.are_you_sure') }, class: 'btn btn-warning btn-xs')
- if @domain.errors.messages[:tech_contacts]
%tfoot
- @domain.errors.messages[:tech_contacts].each do |x|
%tr
%td{colspan: 4}= x

View file

@ -0,0 +1,22 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('shared.new_tech_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_tag(admin_domain_tech_contacts_path(@domain)) do |f|
.row
.col-md-12
.form-group.has-feedback
.form-group.has-feedback
= label_tag :tech_contact
= text_field_tag(:domain_tech_contact, params[:domain_tech_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
= hidden_field_tag(:tech_contact_id, params[:tech_contact_id], class: 'js-contact-id')
.row
.col-md-12.text-right
= button_tag(t('shared.save'), class: 'btn btn-primary')