<%= error_messages_for 'part' %>

<div class="box tabular">

  <div class="splitcontent">
    <div class="splitcontentleft">
      <p><%= f.text_field :name, :size => 30, :required => true, :label => l(:label_cms_section)  %></p>
      <p><%= f.text_field :description, :size => "98%", :label => l(:label_cms_description)  %></p>

      <% if @part.new_record? || @part.page.blank?  %>
      <p>
        <%= f.select :page_id, pages_options_for_select(CmsPage.all), :required => true, :label => l(:label_cms_page) %>
      </p>
      <% end %>
      <p><%= f.select :status_id, cms_statuses_for_select, :label => l(:label_cms_status)  %></p>
    </div>
    <div class="splitcontentright">
      <p><%= f.check_box :is_cached, :label => l(:label_cms_is_cached) %></p>
      <p><%= f.select :filter_id, filter_options_for_select(@part.filter_id), {:label => l(:label_cms_filter)}, {:id => "text_filter_select", :onchange => "editor.setOption('mode', $('option:selected', this).data('mode'));return false"} %></p>
    </div>
  </div>


<!--
<p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @part} %></p> -->

<%= text_area_tag 'part[content]', @part.content, :cols => 100, :rows =>  30, :class => 'wiki-edit' %>
<%= javascript_tag "editor = activateCodeMirror('part_content', '#{@part.filter.class.mine_type}');" %>
<%= javascript_tag "$('.contextual.page-edit').draggable();" %>

</div>

<%= javascript_tag do %>
  $(document).ready(function(){
    $('#part_page_id').select2({containerCssClass: "page-select icon icon-page"  });
  });
<% end %>

<% content_for :header_tags do %>
  <%= code_mirror_tags %>
  <%= javascript_include_tag 'redmine_cms', :plugin => 'redmine_cms'  %>
  <%= select2_assets %>
<% end %>




