= javascript_include_tag 'pages_cms/wysihtml5x-toolbar' = javascript_include_tag 'pages_cms/advanced_and_extended' = javascript_include_tag 'pages_cms/select2.min' = stylesheet_link_tag 'pages_cms/select2.min' - if params[:sortable] == 'on' %div.container-fluid %h1 Sort Your Page Blocks %p tip: give your page blocks a name to more easily sort them. = form_for @page, url: admin_page_path(@page) do |f| %ul.sortable.list-unstyled = f.fields_for :page_blocks, f.object.page_blocks.order(:order) do |ff| %li %h4 %span.glyphicon.glyphicon-menu-hamburger = ff.object.div_id = ff.hidden_field :order, class: 'block-order' = f.submit 'Save', class: 'btn btn-primary center-block' - else %div.container-fluid %div.row = form_for @page, url: admin_page_path(@page) do |f| %div.col-md-9 %h2 Main Content %div.back = link_to 'View', slugged_path(@page), class: 'btn btn-default btn-xs' = f.label 'Show in top navbar ' = f.check_box :navbar_show = f.label 'Show in sidebar ' = f.check_box :sidebar_show = f.label 'Is a draft ' = f.check_box :draft = f.text_field :title, placeholder: 'page title', class: 'form-control big' = f.text_field :meta_tags, placeholder: 'meta tags', class: 'form-control inline-form' = f.text_field :meta_description, placeholder: 'meta description', class: 'form-control inline-form' = f.select(:parent_id, @page.account.pages.collect {|p| [p.title, p.id] unless p.id == f.object.id }, {include_blank: 'Is a sub-page of'}, class: 'form-control inline-form') = f.submit 'Save', class: 'btn btn-primary inline-form' %div = f.fields_for :page_blocks, f.object.page_blocks.order(:order) do |page_block| = render 'page_block_fields', f: page_block %hr = link_to 'Sort', edit_admin_page_path(@page, sortable: 'on'), class: 'btn btn-default' = link_to_add_association 'Add Block', f, :page_blocks, class: 'btn btn-default' %div.col-md-3 %h3 Sidebar %div.back = f.fields_for :sidebar, @sidebar do |ss| = render 'editor', f: ss = ss.check_box :show = ss.label 'Show sidebar on this page'
= ss.check_box :tw_feed = ss.label 'Show twitter feed.'
= ss.check_box :fb_feed = ss.label 'Show facebook feed.'
= ss.check_box :all_posts = ss.label 'Show blog posts.'
= ss.check_box :all_tags = ss.label 'Show blog tags.'
= ss.check_box :all_pages = ss.label 'Show page links.'
= ss.label 'Add to page links' = ss.text_area :links, class: 'form-control', placeholder: 'link title, link url (use next line for next link)'
= ss.label 'Use a different sidebar:' = ss.select(:use_instead, PagesCms::Page.all.includes(:sidebar).collect {|p| [p.title, p.sidebar.id] unless p.sidebar.nil? }, {include_blank: true}, class: 'form-control', id: 'select_sid') %h3 Content Sliders %div = f.fields_for :sliders do |slider| = render 'slider_fields', f: slider %hr = link_to_add_association 'Add Slider', f, :sliders, class: 'btn btn-default' %hr = f.submit 'Save', class: 'btn btn-primary center-block' :javascript $( document ).ready(function() { $('.sortable').sortable(); $('.sortable').sortable().bind('sortupdate', function() { $('.block-order').each(function(i){ $(this).val(i+1) }) }); }) $('.select2').select2({ tags: true, createTag: function (params) { return { id: params.term, text: params.term, newOption: true } } }); window.setInterval(function(){ $('.block-order').each(function(i){ $(this).val(i+1) }) }, 500); = javascript_include_tag 'pages_cms/sortable.js'