javascript:
  page_vars = #{Cmtool::YmlFile.all_as_object.to_json.html_safe};
#preview-modal.reveal-modal.large data-reveal=""
  iframe allowfullscreen="" frameborder="0" height="100%" src="about:blank" width="100%"
  a.close-reveal-modal ×
= form_for [cmtool, @page] do |f|
  = render 'error_messages', target: @page
  .form-row
    .form-label= f.label :name
    .form-field.full
      .row
        .small-12.medium-6.columns= f.text_field :name
        .small-12.medium-6.columns
          span Te zien in de url
          - if @page.new_record?
            a href="#" onclick="$.get('#{cmtool.generate_name_pages_path}', {name: $('#page_title').val()})" Genereer vanuit titel
          - else
            a href="#" onclick="$.get('#{cmtool.generate_name_page_path(@page)}', {name: $('#page_title').val()})" Genereer vanuit titel
  .form-row
    .form-label= f.label :menu_text
    .form-field= f.text_field :menu_text
  .form-row
    .form-label= f.label :title
    .form-field= f.text_field :title
  .form-row
    .form-label= f.label :locale
    .form-field= f.select :locale, Page.locales
  .form-row
    = f.label :body
    = f.text_area :body, rows: 30, cols: 80, class: 'html-content'
    = f.text_area :body_template
  = collapsible_content 'Sidebar' do
    .field
      = f.label :sidebar
      = f.text_area :sidebar, rows: 15, cols: 80, class: 'html-content'
  = collapsible_content 'Footer' do
    .field
      = f.label :footer
      = f.text_area :footer, rows: 15, cols: 80, class: 'html-content'
  .form-row
    .form-label= f.label :parent_id
    .form-field= f.select :parent_id, tree_options_for_select(Page.full_tree(@page.locale || Page.locales.first), exclude: @page.id, selected: @page.parent_id), include_blank: ' -- '
  .form-row
    .form-label= f.label :position
    .form-field= f.select :position, (0..20).to_a
  .form-row
    .form-label= f.label :layout
    .form-field= f.select :layout, Page.layouts
  .form-row
    .form-label= f.label :in_menu
    .form-field= f.check_box :in_menu
  .field
    = render "cmtool/keywords/habtm", subject: @page
  .form-row: .form-actions
    = f.submit @submit || update_button_text(f.object), class: 'button'
    -#= button_tag 'Preview (unsupported)', onclick: %{$('form').attr('action', '/' + $('#page_name').val()).submit();}
