<h1>Page Settings</h1>
<div class='top_right_controls'>
<input type='button' value='General'   onclick="window.location='/pages/<%= @page.id %>/edit-settings';" disabled='true' />
<input type='button' value='CSS'       onclick="window.location='/pages/<%= @page.id %>/edit-css';" />
<input type='button' value='JS'        onclick="window.location='/pages/<%= @page.id %>/edit-js';" />
<input type='button' value='SEO'       onclick="window.location='/pages/<%= @page.id %>/edit-seo';" />
<input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" />
</div>
<div style='float: left; width: 310px;'>
  <p><div id='page_<%= @page.id %>_parent_id'             ></div></p>
  <p><div id='page_<%= @page.id %>_menu_title'            ></div></p>     
  <p><div id='page_<%= @page.id %>_slug'                  ></div></p>                              
  <p><div id='page_<%= @page.id %>_alias'                 ></div></p> 
  <p><div id='page_<%= @page.id %>_redirect_url'          ></div></p>
</div>
<div style='float: left;'>
  <p><div id='page_<%= @page.id %>_hide'                  ></div></p>  
  <p><div id='page_<%= @page.id %>_layout'                ></div></p>
  <p><div id='page_<%= @page.id %>_custom_sort_children'  ></div></p>
  <p><div id='page_<%= @page.id %>_content_format'        ></div></p>
</div>            

<% content_for :caboose_js do %>
<%= javascript_include_tag "caboose/model/all" %>
<script type="text/javascript">

var modal = false;
$(document).ready(function() {
  m = new ModelBinder({
    name: 'Page',
    id: <%= @page.id %>,
    update_url: '/pages/<%= @page.id %>',
    authenticity_token: '<%= form_authenticity_token %>',
    attributes: [
      { name: 'parent_id'             , nice_name: 'Parent'                   , type: 'select'     , value: <%= @page.parent_id %>                       , width: 270, text: <%= raw (@page.parent_id == -1 ? "[No Parent]" : @page.parent.title).to_json %>, options_url: '/pages/sitemap-options' },
      { name: 'menu_title'            , nice_name: 'Menu title'               , type: 'text'       , value: <%= raw Caboose.json(@page.menu_title   ) %> , width: 270 },     
      { name: 'slug'                  , nice_name: 'Slug'                     , type: 'text'       , value: <%= raw Caboose.json(@page.slug         ) %> , width: 270 }, 
      { name: 'alias'                 , nice_name: 'Alias'                    , type: 'text'       , value: <%= raw Caboose.json(@page.alias        ) %> , width: 270 }, 
      { name: 'redirect_url'          , nice_name: 'Redirect URL'             , type: 'text'       , value: <%= raw Caboose.json(@page.redirect_url ) %> , width: 270 },
      { name: 'hide'                  , nice_name: 'Hide'                     , type: 'checkbox'   , value: <%= raw @page.hide %>                        , width: 270 },
      { name: 'layout'                , nice_name: 'Layout'                   , type: 'text'       , value: <%= raw Caboose.json(@page.layout       ) %> , width: 270 },
      { name: 'custom_sort_children'  , nice_name: 'Custom sort children'     , type: 'checkbox'   , value: <%= raw @page.custom_sort_children %>        , width: 270 },
      { name: 'content_format'        , nice_name: 'Content format'           , type: 'select'     , value: <%= raw Caboose.json(@page.content_format) %>, width: 270, text: <%= raw Caboose.json(@page.content_format) %>, options_url: '/pages/format-options' },      
    ]
  });  
  modal = new CabooseModal(600, 344);
});

</script>
<% end %>