internetee-registry/app/views/admin/domains/form_partials/_statuses.haml
2015-06-16 16:16:09 +03:00

29 lines
1.2 KiB
Text

#domain-statuses
- @server_statuses.each do |x|
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:status)
.pull-right
= link_to(t(:add_another), '#', class: 'btn btn-primary btn-xs add-domain-status')
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs destroy-status')
.panel-body
.form-group
= f.label 'status', class: 'col-md-2 control-label'
.col-md-10
= select_tag 'domain[statuses][]', options_for_select(DomainStatus.statuses_for_admin, x), include_blank: true, class: 'form-control'
.form-group
= label_tag t(:description), nil, class: 'col-md-2 control-label'
.col-md-10
= text_field_tag :description, nil, class: 'form-control', autocomplete: 'off'
- @other_statuses.each do |x|
= hidden_field_tag 'domain[statuses][]', x, readonly: true
:coffee
$("#domain-statuses").nestedAttributes
bindAddTo: $(".add-domain-status")
$('.destroy-status').on 'click', (e) ->
e.preventDefault()
if $('.panel').length > 1
$(this).parents('.panel').remove()
else
$(this).parents('.panel').find('select').val('')