orbit4-5/app/views/page_parts/new.html.erb

38 lines
1.3 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<% end %>
<%= form_for @part, url: {action: "create"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
<%= f.hidden_field :part_id, value: @part_number %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
<script type="text/javascript">
$("select.module_name").on("change",function(){
var select = $(this);
if(select.val()){
$.ajax({
url : "/page_parts/getwidgets",
dataType : "html",
data : {"module" : select.val(),"number_of_select" : select.data("number").replace("pp_","")},
type : "get"
}).done(function(html){
$("span[for=" + select.data("number") + "]").html(html);
})
}
})
$('.btn-group input[type="radio"]').each(function(index, el) {
if($(this).prop('checked')) {
$(this).closest('label').addClass('active');
$("#" + $(this).val()).addClass('active');
}
});
$('.btn-group').on("click", 'label', function(event) {
$(this).find('input').prop('checked', true);
event.preventDefault();
});
$("#public_r_tag").on("change", "#tag_list select", function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
});
</script>