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

28 lines
1003 B
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,:class => "hidden_part_id" %>
<%= f.hidden_field :page_id, value: @page_id,:class => "hidden_page_id" %>
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
<script type="text/javascript">
$("select.module_name").on("change",function(){
var select = $(this),
widget_area = $("#widgets_selection_area");
if(select.val()){
$.ajax({
url : "/page_parts/getwidgets",
dataType : "html",
data : {"module" : select.val(),"part_id" : <%= @part_number %>, "page_id" : "<%= params[:page_id] %>"},
type : "get"
}).done(function(html){
widget_area.html(html);
})
}
})
$("form").on("ajax:success",function(){
window.location.href = "/pages/edit_view?id=<%= params[:page_id] %>";
})
</script>