Sha256: 1c85ef3d8ea4576653dc1339d3055213206080e43514572a4b10863d0771d33b

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

/*

 * @File Name                 : pages/_add_page_part.js.erb
 * @Company Name              : Mindfire Solutions Private Limited
 * @Creator Name              : Vikram Kumar Mishra
 * @Date Created              : 2012-07-03
 * @Date Modified             :
 * @Last Modification Details :
 * @Purpose                   : To show the partial for creating a page part

*/

$(document).ready(function(){

  <% if @part == "page_part" %>

    <%
        #calling helper method to create form object
        builder = build_page_part(@index)
    %>

    $("#page_page_parts_pages_attributes_<%= @index %>__destroy").remove();
    $("#page-part-fields-<%= @index %>").after('<%= hidden_field_tag "page[page_parts_pages_attributes][#{@index}][_destroy]", "1" %>');

    var html = "<%= escape_javascript(render 'mcms_pages/admin/pages/page_part_form_field',
                                      :part_index => @index, :f => builder, :title => @title)  %>";

  <% else %>

    <%
      #calling helper method to create form object
      builder = build_page_part_page(@index)
    %>

    <% fragment = get_fragments(@title) %>

    var html = "<%= escape_javascript(render 'mcms_pages/admin/pages/page_part_page_form_field',
                                      :part_index => @index, :f => builder, :title => @title, :fragment => fragment)  %>";

    $("#page_page_parts_pages_attributes_<%= @index %>__destroy").val("0");

  <% end %>

  $("#page-part-fields-<%= @index %>").html(html);

});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mcms_pages-0.0.2 app/views/mcms_pages/admin/pages/add_page_part.js.erb