seminar2/app/views/admin/seminars/seminar_signup_field.html.erb

67 lines
2.1 KiB
Plaintext

<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "seminar-field-forms.js" %>
<% end -%>
<%= form_for @attribute, url: admin_seminar_path(@attribute) , html: { class: "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %>
<%= flash.now[:notice]%>
<% end %>
<h3><%= @attribute.title %></h3>
<fieldset>
<div id="attributes-area" class="input-area sortable">
<%= render partial: "attribute_field", collection: @attribute.seminar_signup_fields.asc(:sort_number, :_id)%>
</div>
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>
<% content_for :page_specific_javascript do -%>
<%= render 'support_member_form_js' %>
<% end -%>
<style type="text/css">
#attributes-area h4:before {
content: "\e096";
font-family: 'entypo';
cursor: pointer;
}
</style>
<script>
function update_key(ele){
var ui_child=$(ele).parents('.sortable.ui-sortable').find('.attributes');
for (var i=0;i<ui_child.length;i++){
var now_ele = ui_child.eq(i);
var new_i = i + 1;
now_ele.find('.sort_number').val(i);
now_ele.find('h4 span').text(new_i);
}
}
$('.sortable').ready(function(){
$( ".sortable" ).sortable({
axis: "y",
revert: true,
placeholder: "sortable-placeholder",
handle: ".attributes-header",
update: function(event, ui) {
update_key(ui.item)
}
});
$('.sortable').disableSelection();
})
</script>