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

36 lines
1.5 KiB
Plaintext
Raw Normal View History

<%= stylesheet_link_tag "select2/select2" %>
<%= javascript_include_tag 'validator' %>
<%= javascript_include_tag "select2/select2.min" %>
<% 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| %>
2014-05-29 10:32:27 +00:00
<input class="hidden_part_id" id="part_part_id" name="page_part[part_id]" type="hidden" value="<%= @part_number %>">
<input class="hidden_page_id" id="part_page_id" name="page_part[page_id]" type="hidden" value="<%= @page_id %>">
2014-05-29 11:14:30 +00:00
<% if OrbitHelper.is_mobile_view %>
<input class="hidden_page_id" name="mobile_view" type="hidden" value="1">
<% end %>
2014-04-01 07:10:21 +00:00
<%= 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");
2014-04-01 07:10:21 +00:00
if(select.val()){
$.ajax({
url : "/page_parts/getwidgets",
dataType : "html",
2014-05-29 11:14:30 +00:00
data : {"module" : select.val(),"part_id" : <%= @part_number %>, "page_id" : "<%= params[:page_id] %>", "mobile_view" : <%= OrbitHelper.is_mobile_view ? "1" : "null" %>},
2014-04-01 07:10:21 +00:00
type : "get"
}).done(function(html){
widget_area.html(html);
2014-04-01 07:10:21 +00:00
})
}
})
$("form").on("ajax:success",function(){
<% url = Page.find(params[:page_id]).url %>
var url = "/<%= I18n.locale.to_s if url != '/' %><%= url if url != '/' %>?editmode=on<%= OrbitHelper.is_mobile_view ? '&mobile_view=1'.html_safe : '' %>";
window.location.href = url;
})
2014-04-01 07:10:21 +00:00
</script>