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

28 lines
987 B
Plaintext
Raw Normal View History

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<% end %>
<%= form_for @part, url: update_sub_part_page_part_path(@subpart), :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
<input type="hidden" name="part_id" value="<%= @part.id.to_s %>" />
<input type="hidden" name="page_id" value="<%= params[:page_id] %>" />
<%= render :partial => "form", :locals => { :f => f } %>
<% end %>
<script>
$("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(), "page_id" : "<%= params[:page_id] %>", "part_id" : <%= @part.part_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>