<% form_for [:admin, @page] do |f| %>
  <%= f.error_messages  %>
  <div class="field">
    <%= f.label :title %>
    <%= f.text_field :title, :class => "larger", :style => 'width: 944px' %>
  </div>
  <%= render :partial => "form_page_parts", :locals => {:f => f} %>

  <%= render :partial => "form_advanced_options", :locals => {:f => f} %>

  <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => true} %>

  <%= render :partial => "form_new_page_parts", :locals => {:f => f} if RefinerySetting.find_or_set(:new_page_parts, false) %>
<% end %>

<% content_for :head do %>
  <script type='text/javascript'>
    $(document).ready(function(){
      var page_parts = <%= RefinerySetting.find_or_set(:new_page_parts, false) == true ? 'true' : 'false' %>;
      var new_part_url = "<%= new_admin_page_part_url(:only_path => true) %>";
      var del_part_url = "<%= admin_page_parts_url(:only_path => true) %>";
      page_options.init(page_parts, new_part_url, del_part_url);
    });
  </script>
<% end %>

<% url_opts = action_name == 'edit' ? {:url => admin_page_path(@page.id)} : {} %>
<% form_for [:admin, @page], url_opts do |f| %>
  <%= f.error_messages  %>
  <div class="field">
    <%= f.label :title %>
    <%= f.text_field :title, :class => "larger", :style => 'width: 944px' %>
  </div>
  <%= render :partial => "form_page_parts", :locals => {:f => f} %>

  <%= render :partial => "form_advanced_options", :locals => {:f => f} %>

  <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => true} %>

  <%= render :partial => "form_new_page_parts", :locals => {:f => f} if RefinerySetting.find_or_set(:new_page_parts, false) %>
<% end %>

<% content_for :head do %>
  <script type='text/javascript'>
    $(document).ready(function(){
      var page_parts = <%= RefinerySetting.find_or_set(:new_page_parts, false) == true ? 'true' : 'false' %>;
      var new_part_url = "<%= new_admin_page_part_url(:only_path => true) %>";
      var del_part_url = "<%= admin_page_parts_url(:only_path => true) %>";
      page_options.init(page_parts, new_part_url, del_part_url);
    });
  </script>
<% end %>

Allow page forms to work
Allow page forms to work
