comfortable_mexican_sofa 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/CHANGELOG.rdoc +2 -0
- data/LICENSE +20 -0
- data/README.rdoc +55 -0
- data/Rakefile +88 -0
- data/VERSION +1 -0
- data/app/controllers/cms_admin/attachments_controller.rb +55 -0
- data/app/controllers/cms_admin/base_controller.rb +25 -0
- data/app/controllers/cms_admin/categories_controller.rb +69 -0
- data/app/controllers/cms_admin/layouts_controller.rb +71 -0
- data/app/controllers/cms_admin/pages_controller.rb +79 -0
- data/app/controllers/cms_admin/sections_controller.rb +17 -0
- data/app/controllers/cms_admin/snippets_controller.rb +58 -0
- data/app/controllers/cms_common/render_page.rb +47 -0
- data/app/controllers/cms_content_controller.rb +30 -0
- data/app/helpers/cms_helper.rb +12 -0
- data/app/models/cms_attachment.rb +17 -0
- data/app/models/cms_attachment_categorization.rb +5 -0
- data/app/models/cms_block.rb +15 -0
- data/app/models/cms_category.rb +36 -0
- data/app/models/cms_layout.rb +102 -0
- data/app/models/cms_page.rb +125 -0
- data/app/models/cms_page_categorization.rb +6 -0
- data/app/models/cms_snippet.rb +15 -0
- data/app/views/cms_admin/attachments/_details.html.haml +27 -0
- data/app/views/cms_admin/attachments/_form.html.haml +24 -0
- data/app/views/cms_admin/attachments/edit.html.haml +10 -0
- data/app/views/cms_admin/attachments/index.html.haml +36 -0
- data/app/views/cms_admin/attachments/new.html.haml +8 -0
- data/app/views/cms_admin/categories/_category.html.haml +21 -0
- data/app/views/cms_admin/categories/_category_subform.html.haml +12 -0
- data/app/views/cms_admin/categories/_form.html.haml +18 -0
- data/app/views/cms_admin/categories/_new.html.haml +7 -0
- data/app/views/cms_admin/categories/_toggle_link.html.haml +9 -0
- data/app/views/cms_admin/categories/_tree_branch.html.haml +36 -0
- data/app/views/cms_admin/categories/children.js.rjs +10 -0
- data/app/views/cms_admin/categories/create.js.rjs +9 -0
- data/app/views/cms_admin/categories/edit.html.haml +10 -0
- data/app/views/cms_admin/categories/index.html.haml +7 -0
- data/app/views/cms_admin/categories/new.html.haml +8 -0
- data/app/views/cms_admin/categories/show.html.haml +17 -0
- data/app/views/cms_admin/layouts/_details.html.haml +6 -0
- data/app/views/cms_admin/layouts/_form.html.haml +19 -0
- data/app/views/cms_admin/layouts/_toggle_link.html.haml +9 -0
- data/app/views/cms_admin/layouts/_tree_branch.html.haml +39 -0
- data/app/views/cms_admin/layouts/children.js.rjs +10 -0
- data/app/views/cms_admin/layouts/edit.html.haml +10 -0
- data/app/views/cms_admin/layouts/index.html.haml +7 -0
- data/app/views/cms_admin/layouts/new.html.haml +8 -0
- data/app/views/cms_admin/pages/_details.html.haml +25 -0
- data/app/views/cms_admin/pages/_form.html.haml +45 -0
- data/app/views/cms_admin/pages/_form_blocks.html.haml +48 -0
- data/app/views/cms_admin/pages/_toggle_link.html.haml +10 -0
- data/app/views/cms_admin/pages/_tree_branch.html.haml +41 -0
- data/app/views/cms_admin/pages/children.js.rjs +10 -0
- data/app/views/cms_admin/pages/edit.html.haml +11 -0
- data/app/views/cms_admin/pages/form_blocks.js.rjs +1 -0
- data/app/views/cms_admin/pages/index.html.haml +6 -0
- data/app/views/cms_admin/pages/new.html.haml +9 -0
- data/app/views/cms_admin/sections/show.html.haml +23 -0
- data/app/views/cms_admin/snippets/_form.html.haml +10 -0
- data/app/views/cms_admin/snippets/edit.html.haml +10 -0
- data/app/views/cms_admin/snippets/index.html.haml +26 -0
- data/app/views/cms_admin/snippets/new.html.haml +8 -0
- data/app/views/cms_content/show.xml.rxml +27 -0
- data/app/views/cms_content/sitemap.xml.rxml +16 -0
- data/app/views/layouts/cms_admin.html.haml +44 -0
- data/comfortable_mexican_sofa.gemspec +254 -0
- data/config/cms_routes.rb +25 -0
- data/generators/cms/cms_generator.rb +55 -0
- data/generators/cms/templates/README +32 -0
- data/generators/cms/templates/images/arrow_bottom.gif +0 -0
- data/generators/cms/templates/images/arrow_right.gif +0 -0
- data/generators/cms/templates/images/icon_attachment.gif +0 -0
- data/generators/cms/templates/images/icon_category.gif +0 -0
- data/generators/cms/templates/images/icon_draft.gif +0 -0
- data/generators/cms/templates/images/icon_layout.gif +0 -0
- data/generators/cms/templates/images/icon_move.gif +0 -0
- data/generators/cms/templates/images/icon_regular.gif +0 -0
- data/generators/cms/templates/images/icon_snippet.gif +0 -0
- data/generators/cms/templates/images/logo.png +0 -0
- data/generators/cms/templates/initializers/cms.rb +14 -0
- data/generators/cms/templates/initializers/paperclip.rb +14 -0
- data/generators/cms/templates/javascripts/codemirror_init.js +16 -0
- data/generators/cms/templates/javascripts/mce_init.js +17 -0
- data/generators/cms/templates/javascripts/utilities.js +27 -0
- data/generators/cms/templates/migrations/create_cms.rb +113 -0
- data/generators/cms/templates/stylesheets/cms_master.sass +414 -0
- data/init.rb +1 -0
- data/lib/comfortable_mexican_sofa.rb +46 -0
- data/lib/comfortable_mexican_sofa/acts_as_categorized.rb +87 -0
- data/lib/comfortable_mexican_sofa/acts_as_published.rb +60 -0
- data/lib/comfortable_mexican_sofa/cms_acts_as_tree.rb +108 -0
- data/lib/comfortable_mexican_sofa/cms_rails_extensions.rb +12 -0
- data/lib/comfortable_mexican_sofa/cms_tag.rb +109 -0
- data/lib/comfortable_mexican_sofa/cms_tags/attachment.rb +3 -0
- data/lib/comfortable_mexican_sofa/cms_tags/block.rb +117 -0
- data/lib/comfortable_mexican_sofa/cms_tags/helper.rb +3 -0
- data/lib/comfortable_mexican_sofa/cms_tags/page_block.rb +119 -0
- data/lib/comfortable_mexican_sofa/cms_tags/partial.rb +19 -0
- data/lib/comfortable_mexican_sofa/cms_tags/snippet.rb +19 -0
- data/rails/init.rb +1 -0
- data/test/fixtures/cms_attachment_categorizations.yml +7 -0
- data/test/fixtures/cms_attachments.yml +6 -0
- data/test/fixtures/cms_blocks.yml +38 -0
- data/test/fixtures/cms_categories.yml +19 -0
- data/test/fixtures/cms_layouts.yml +41 -0
- data/test/fixtures/cms_page_categorizations.yml +15 -0
- data/test/fixtures/cms_pages.yml +38 -0
- data/test/fixtures/cms_snippets.yml +7 -0
- data/test/fixtures/files/upload_file.txt +1 -0
- data/test/functional/cms_admin/attachments_controller_test.rb +63 -0
- data/test/functional/cms_admin/categories_controller_test.rb +86 -0
- data/test/functional/cms_admin/layouts_controller_test.rb +77 -0
- data/test/functional/cms_admin/pages_controller_test.rb +153 -0
- data/test/functional/cms_admin/sections_controller_test.rb +9 -0
- data/test/functional/cms_admin/snippets_controller_test.rb +63 -0
- data/test/functional/cms_content_controller_test.rb +52 -0
- data/test/models/cms_attachment_test.rb +16 -0
- data/test/models/cms_block_test.rb +11 -0
- data/test/models/cms_categorization_test.rb +39 -0
- data/test/models/cms_category_test.rb +71 -0
- data/test/models/cms_layout_test.rb +44 -0
- data/test/models/cms_page_test.rb +55 -0
- data/test/models/cms_snippet_test.rb +16 -0
- data/test/models/cms_tag_test.rb +70 -0
- data/test/rails_root/README +243 -0
- data/test/rails_root/Rakefile +10 -0
- data/test/rails_root/app/controllers/application_controller.rb +10 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/views/cms/under-development.html.haml +1 -0
- data/test/rails_root/app/views/complex_page/_example.html.erb +1 -0
- data/test/rails_root/config/boot.rb +110 -0
- data/test/rails_root/config/database.yml +22 -0
- data/test/rails_root/config/environment.rb +48 -0
- data/test/rails_root/config/environments/development.rb +17 -0
- data/test/rails_root/config/environments/production.rb +28 -0
- data/test/rails_root/config/environments/test.rb +28 -0
- data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/new_rails_defaults.rb +19 -0
- data/test/rails_root/config/initializers/session_store.rb +15 -0
- data/test/rails_root/config/locales/en.yml +5 -0
- data/test/rails_root/config/routes.rb +43 -0
- data/test/rails_root/doc/README_FOR_APP +2 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/index.html +275 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +973 -0
- data/test/rails_root/public/javascripts/effects.js +1128 -0
- data/test/rails_root/public/javascripts/prototype.js +4320 -0
- data/test/rails_root/public/robots.txt +5 -0
- data/test/rails_root/public/stylesheets/sass/cms_master.sass +414 -0
- data/test/rails_root/script/about +4 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/test_helper.rb +17 -0
- metadata +303 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
class CmsSnippet < ActiveRecord::Base
|
2
|
+
|
3
|
+
# -- Validations ----------------------------------------------------------
|
4
|
+
validates_presence_of :label
|
5
|
+
validates_uniqueness_of :label
|
6
|
+
validates_format_of :label,
|
7
|
+
:with => /^\w[a-z0-9_-]*$/i
|
8
|
+
|
9
|
+
# -- Class Methods --------------------------------------------------------
|
10
|
+
def self.content_for(label)
|
11
|
+
s = find_by_label(label)
|
12
|
+
s.blank? ? '' : s.content
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
- attachment ||= details
|
2
|
+
|
3
|
+
.details
|
4
|
+
|
5
|
+
= link_to_function '+ show details', "$('attachment_details_#{attachment.id}').show(); $(this).hide()"
|
6
|
+
|
7
|
+
%div{:id => "attachment_details_#{attachment.id}", :style => 'display: none'}
|
8
|
+
%table
|
9
|
+
%tr
|
10
|
+
%th Filename:
|
11
|
+
%td= attachment.file.url
|
12
|
+
%tr
|
13
|
+
%th Type:
|
14
|
+
%td= attachment.file_content_type
|
15
|
+
%tr
|
16
|
+
%th Filesize:
|
17
|
+
%td= number_to_human_size(attachment.file_file_size)
|
18
|
+
%tr
|
19
|
+
%th Description:
|
20
|
+
%td= h attachment.description
|
21
|
+
%tr
|
22
|
+
%th Created:
|
23
|
+
%td= "#{time_ago_in_words(attachment.created_at)} ago"
|
24
|
+
%tr
|
25
|
+
%th Categories:
|
26
|
+
%td
|
27
|
+
= attachment.cms_categories.collect{|category| link_to(category.label, '')}.join(', ')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= form.error_messages
|
2
|
+
|
3
|
+
.form_right_column
|
4
|
+
= render :partial => 'cms_admin/categories/category_subform', :locals => { :item => @cms_attachment }
|
5
|
+
|
6
|
+
.form_left_column
|
7
|
+
.form_element_group.horizontal
|
8
|
+
.form_element.text.large
|
9
|
+
.label= form.label :label, 'Label'
|
10
|
+
.field= form.text_field :label
|
11
|
+
|
12
|
+
- if @cms_attachment && @cms_attachment.file? && !@cms_attachment.new_record?
|
13
|
+
.form_element
|
14
|
+
.label
|
15
|
+
%label Current File
|
16
|
+
.field= link_to @cms_attachment.file_file_name, @cms_attachment.file.url
|
17
|
+
|
18
|
+
.form_element.text
|
19
|
+
.label= form.label :file, 'File'
|
20
|
+
.field= form.file_field :file
|
21
|
+
|
22
|
+
.form_element.text_area
|
23
|
+
.label= form.label :description, 'Description'
|
24
|
+
.field= form.text_area :description
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= link_to 'Add New Attachment', new_cms_admin_attachment_path, :class => 'big_button'
|
2
|
+
|
3
|
+
%h2 Editing Attachment
|
4
|
+
|
5
|
+
- form_for :cms_attachment, :url => {:action => :update}, :html => {:method => :put, :multipart => true} do |form|
|
6
|
+
= render :partial => form
|
7
|
+
.submit
|
8
|
+
= form.submit 'Edit Attachment'
|
9
|
+
or
|
10
|
+
= link_to 'Return to List', cms_admin_attachments_path
|
@@ -0,0 +1,36 @@
|
|
1
|
+
= link_to 'Add New Attachment', new_cms_admin_attachment_path, :class => 'big_button'
|
2
|
+
|
3
|
+
%h2 Attachments
|
4
|
+
|
5
|
+
- form_for :filter, :url => cms_admin_attachments_path, :html => {:method => :get, :class => 'filter_form'} do |f|
|
6
|
+
= f.select :category_id, CmsCategory.categories_for_select, { :include_blank => '-- All Categories --', :selected => @category_id.to_i }
|
7
|
+
= f.submit 'Filter'
|
8
|
+
|
9
|
+
= will_paginate @cms_attachments
|
10
|
+
|
11
|
+
%table.formatted
|
12
|
+
%tr
|
13
|
+
%th.first{:colspan => 2} Attachment Label
|
14
|
+
%th Type
|
15
|
+
%th Filesize
|
16
|
+
%th.last
|
17
|
+
|
18
|
+
- @cms_attachments.each do |attachment|
|
19
|
+
%tr
|
20
|
+
%td
|
21
|
+
.icon
|
22
|
+
%td.main
|
23
|
+
= link_to attachment.label.titleize, edit_cms_admin_attachment_path(attachment), :class => 'label'
|
24
|
+
%br
|
25
|
+
= link_to attachment.file.url, attachment.file.url, :class => 'url'
|
26
|
+
%td
|
27
|
+
= attachment.file_content_type
|
28
|
+
%td
|
29
|
+
= number_to_human_size(attachment.file_file_size)
|
30
|
+
|
31
|
+
%td.action_links
|
32
|
+
= link_to 'Edit', edit_cms_admin_attachment_path(attachment)
|
33
|
+
|
|
34
|
+
= link_to 'Remove', cms_admin_attachment_path(attachment), :method => 'delete', :confirm => 'Are you sure you want to remove this attachment?'
|
35
|
+
|
36
|
+
= will_paginate @cms_attachments
|
@@ -0,0 +1,21 @@
|
|
1
|
+
- item ||= nil
|
2
|
+
- if item.blank?
|
3
|
+
- is_checked = false
|
4
|
+
- else
|
5
|
+
- is_checked = item.cms_categories.collect(&:id).include?(category.id)
|
6
|
+
- item_type = item.class.to_s.underscore
|
7
|
+
|
8
|
+
- category_parent_ids = category.ancestors.collect{|i| "'#{i.id}'"}.join(', ')
|
9
|
+
- category_child_ids = category.descendants.collect{|i| "'#{i.id}'"}.join(', ')
|
10
|
+
|
11
|
+
%li
|
12
|
+
= hidden_field_tag "#{item_type}[attr_category_ids][#{category.id}]", 0, :id => nil
|
13
|
+
|
14
|
+
%label
|
15
|
+
= check_box_tag "#{item_type}[attr_category_ids][#{category.id}]", 1, is_checked, :onchange => "toggle_category_selections(this, new Array(#{category_parent_ids}), new Array(#{category_child_ids}))", :id => "cms_category_id_#{category.id}"
|
16
|
+
= category.label
|
17
|
+
|
18
|
+
%ul{:id => dom_id(category)}
|
19
|
+
- unless category.children.empty?
|
20
|
+
- category.children.each do |sub_category|
|
21
|
+
= render :partial => 'cms_admin/categories/category', :locals => {:category => sub_category, :item => item }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.form_element_group.categories
|
2
|
+
|
3
|
+
.form_element
|
4
|
+
.label Categories
|
5
|
+
.field
|
6
|
+
%ul#root_categories
|
7
|
+
= render :partial => 'cms_admin/categories/category', :locals => { :item => item }, :collection => CmsCategory.roots
|
8
|
+
|
9
|
+
.form_element
|
10
|
+
.label Add Category
|
11
|
+
.field
|
12
|
+
= render :partial => 'cms_admin/categories/new', :locals => { :item_type => item.class.name.underscore }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= form.error_messages
|
2
|
+
|
3
|
+
.form_element_group.horizontal
|
4
|
+
.form_element.text.large
|
5
|
+
.label= form.label :label, 'Label'
|
6
|
+
.field= form.text_field :label, :onkeyup => (@cms_category.new_record? ? "slugify_field($('cms_category_slug'), this.value)" : nil)
|
7
|
+
|
8
|
+
.form_element.text
|
9
|
+
.label= form.label :slug, 'Slug'
|
10
|
+
.field= form.text_field :slug
|
11
|
+
|
12
|
+
.form_element.select
|
13
|
+
.label= form.label :parent_id, 'Parent'
|
14
|
+
.field= form.select :parent_id, [['---', nil]] + CmsCategory.categories_for_select
|
15
|
+
|
16
|
+
.form_element.text_area
|
17
|
+
.label= form.label :description, 'Description'
|
18
|
+
.field= form.text_area :description
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#new_category
|
2
|
+
= error_messages_for :cms_category
|
3
|
+
= text_field :cms_category, :label
|
4
|
+
= select :cms_category, :parent_id, [['---', nil]] + CmsCategory.categories_for_select
|
5
|
+
= submit_to_remote 'submit-btn', 'Add Category', :url => cms_admin_categories_path(:item_type => item_type), :with => "Form.Element.serialize('cms_category_label') + '&' + Form.Element.serialize('cms_category_parent_id')", :html => {:class => 'submit_button'}
|
6
|
+
or
|
7
|
+
= link_to 'Manage Categories', cms_admin_categories_path
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- category ||= toggle_link
|
2
|
+
|
3
|
+
- if category.children.count > 0
|
4
|
+
|
5
|
+
- if session[:cms_category_tree] && session[:cms_category_tree].member?(category.id.to_s)
|
6
|
+
= link_to_remote category.children.count, :url => {:action => 'children', :id => category.id, :state => 'open'}, :loading => "$('category_#{category.id}_children').show()", :html => {:id => "category_#{category.id}_link", :class => 'tree_toggle open'}
|
7
|
+
|
8
|
+
- else
|
9
|
+
= link_to_remote category.children.count, :url => {:action => 'children', :id => category.id, :state => 'closed'}, :loading => "$('category_#{category.id}_children').show()", :html => {:id => "category_#{category.id}_link", :class => 'tree_toggle closed'}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
- container_id = tree_branch.first.try(:parent).try(:id).to_i
|
2
|
+
|
3
|
+
%ul{:id => "category_#{container_id}_branch"}
|
4
|
+
- tree_branch.each do |category|
|
5
|
+
|
6
|
+
%li{:id => "category_#{category.id}"}
|
7
|
+
|
8
|
+
= render :partial => 'toggle_link', :object => category
|
9
|
+
|
10
|
+
.item
|
11
|
+
.icon
|
12
|
+
|
13
|
+
= link_to category.label, edit_cms_admin_category_path(category), :class => 'label'
|
14
|
+
|
15
|
+
%span.action_links
|
16
|
+
[
|
17
|
+
= link_to 'Add Child Category', new_cms_admin_category_path + "?parent_id=#{category.id}"
|
18
|
+
|
|
19
|
+
= link_to 'Edit', edit_cms_admin_category_path(category)
|
20
|
+
|
|
21
|
+
= link_to 'Remove', cms_admin_category_path(category), :method => 'delete', :confirm => 'Are you sure you want to remove this category?'
|
22
|
+
]
|
23
|
+
|
24
|
+
.categorizations
|
25
|
+
Categorized Pages/Attachments:
|
26
|
+
= link_to category.cms_page_categorizations.count, cms_admin_category_path(category) + '#pages'
|
27
|
+
\/
|
28
|
+
= link_to category.cms_attachment_categorizations.count, cms_admin_category_path(category) + '#attachments'
|
29
|
+
|
30
|
+
|
31
|
+
- if session[:cms_category_tree] && session[:cms_category_tree].member?(category.id.to_s)
|
32
|
+
%div{:id => "category_#{category.id}_children"}
|
33
|
+
= render :partial => 'tree_branch', :object => category.children
|
34
|
+
- else
|
35
|
+
%div{:id => "category_#{category.id}_children", :style => 'display: none'}
|
36
|
+
Please wait. I'm loading stuff...
|
@@ -0,0 +1,10 @@
|
|
1
|
+
case params[:state]
|
2
|
+
when 'closed'
|
3
|
+
page.replace "category_#{@cms_category.id}_link", :partial => 'toggle_link', :object => @cms_category, :locals => { :state => 'open' }
|
4
|
+
page.replace_html "category_#{@cms_category.id}_children", :partial => 'tree_branch', :object => @cms_category.children
|
5
|
+
when 'open'
|
6
|
+
page.replace "category_#{@cms_category.id}_link", :partial => 'toggle_link', :object => @cms_category, :locals => { :state => 'closed' }
|
7
|
+
page.hide "category_#{@cms_category.id}_children"
|
8
|
+
page.replace_html "category_#{@cms_category.id}_children", ''
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
if @cms_category.valid?
|
2
|
+
if @cms_category.parent.blank?
|
3
|
+
page.insert_html :bottom, 'root_categories', :partial => 'category', :locals => { :category => @cms_category, :item_type => params[:item_type] }
|
4
|
+
else
|
5
|
+
page.insert_html :bottom, dom_id(@cms_category.parent), :partial => 'category', :locals => { :category => @cms_category, :item_type => params[:item_type] }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
page.replace 'new_category', render(:partial => 'cms_admin/categories/new', :locals => {:item_type => params[:item_type]})
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= link_to 'Add New Category', new_cms_admin_category_path, :class => 'big_button'
|
2
|
+
|
3
|
+
%h2 Editing Category
|
4
|
+
|
5
|
+
- form_for :cms_category, :url => {:action => :update}, :html => {:method => :put } do |form|
|
6
|
+
= render :partial => form
|
7
|
+
.submit
|
8
|
+
= form.submit 'Edit Category'
|
9
|
+
or
|
10
|
+
= link_to 'Cancel', cms_admin_categories_path
|
@@ -0,0 +1,17 @@
|
|
1
|
+
%h2= "Category: #{@cms_category.label}"
|
2
|
+
|
3
|
+
%h3#pages= "Pages (#{@cms_category.cms_pages.count})"
|
4
|
+
.pages
|
5
|
+
- @cms_category.cms_pages.each do |page|
|
6
|
+
= link_to page.label, edit_cms_admin_page_path(page), :class => 'page'
|
7
|
+
|
8
|
+
- if @cms_category.cms_pages.empty?
|
9
|
+
%p No Pages
|
10
|
+
|
11
|
+
%h3#attachments= "Attachments (#{@cms_category.cms_attachments.count})"
|
12
|
+
.attachments
|
13
|
+
- @cms_category.cms_attachments.each do |attachment|
|
14
|
+
= link_to attachment.label, edit_cms_admin_attachment_path(attachment), :class => 'attachment'
|
15
|
+
|
16
|
+
- if @cms_category.cms_attachments.empty?
|
17
|
+
%p No Attachments
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= form.error_messages
|
2
|
+
|
3
|
+
.form_element_group.horizontal
|
4
|
+
.form_element.text.large
|
5
|
+
.label= form.label :label, 'Title'
|
6
|
+
.field= form.text_field :label
|
7
|
+
|
8
|
+
.form_element.select
|
9
|
+
.label= form.label :parent_id, 'Parent Layout'
|
10
|
+
.field= form.select :parent_id, @layout.extendable_for_select
|
11
|
+
|
12
|
+
.form_element
|
13
|
+
.label= form.label :app_layout, 'App Layout'
|
14
|
+
.field= form.select :app_layout, CmsLayout.app_layouts_for_select
|
15
|
+
|
16
|
+
.form_element.text_area
|
17
|
+
.label= form.label :content, 'Content'
|
18
|
+
.field= form.text_area :content
|
19
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- layout ||= toggle_link
|
2
|
+
|
3
|
+
- if layout.children.count > 0
|
4
|
+
|
5
|
+
- if session[:cms_layout_tree] && session[:cms_layout_tree].member?(layout.id.to_s)
|
6
|
+
= link_to_remote layout.children.count, :url => {:action => 'children', :id => layout.id, :state => 'open'}, :loading => "$('layout_#{layout.id}_children').show()", :html => {:id => "layout_#{layout.id}_link", :class => 'tree_toggle open'}
|
7
|
+
|
8
|
+
- else
|
9
|
+
= link_to_remote layout.children.count, :url => {:action => 'children', :id => layout.id, :state => 'closed'}, :loading => "$('layout_#{layout.id}_children').show()", :html => {:id => "layout_#{layout.id}_link", :class => 'tree_toggle closed'}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
- container_id = tree_branch.first.try(:parent).try(:id).to_i
|
2
|
+
|
3
|
+
%ul{:id => "layout_#{container_id}_branch"}
|
4
|
+
- tree_branch.each do |layout|
|
5
|
+
|
6
|
+
%li{:id => "layout_#{layout.id}"}
|
7
|
+
|
8
|
+
= render :partial => 'toggle_link', :object => layout
|
9
|
+
|
10
|
+
.item
|
11
|
+
.icon
|
12
|
+
- if layout.siblings.size > 0
|
13
|
+
.dragger
|
14
|
+
|
15
|
+
= link_to layout.label, edit_cms_admin_layout_path(layout), :class => 'label'
|
16
|
+
|
17
|
+
%span.action_links
|
18
|
+
[
|
19
|
+
= link_to_function 'Toggle Details', "$('layout_details_#{layout.id}').toggle()"
|
20
|
+
|
|
21
|
+
- if layout.is_extendable?
|
22
|
+
= link_to 'Add Child Layout', new_cms_admin_layout_path + "?parent_id=#{layout.id}"
|
23
|
+
|
|
24
|
+
= link_to 'Edit', edit_cms_admin_layout_path(layout)
|
25
|
+
|
|
26
|
+
= link_to 'Remove', cms_admin_layout_path(layout), :method => 'delete', :confirm => 'Are you sure you want to remove this layout?'
|
27
|
+
]
|
28
|
+
|
29
|
+
= render :partial => 'details', :object => layout
|
30
|
+
|
31
|
+
- if session[:cms_layout_tree] && session[:cms_layout_tree].member?(layout.id.to_s)
|
32
|
+
%div{:id => "layout_#{layout.id}_children"}
|
33
|
+
= render :partial => 'tree_branch', :object => layout.children
|
34
|
+
- else
|
35
|
+
%div{:id => "layout_#{layout.id}_children", :style => 'display: none'}
|
36
|
+
Please wait. I'm loading stuff...
|
37
|
+
|
38
|
+
- if layout.siblings.size > 0
|
39
|
+
= sortable_element "layout_#{container_id}_branch", :url => {:action => :reorder, :id => container_id}, :handle => 'dragger'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
case params[:state]
|
2
|
+
when 'closed'
|
3
|
+
page.replace "layout_#{@layout.id}_link", :partial => 'toggle_link', :object => @layout, :locals => { :state => 'open' }
|
4
|
+
page.replace_html "layout_#{@layout.id}_children", :partial => 'tree_branch', :object => @layout.children
|
5
|
+
when 'open'
|
6
|
+
page.replace "layout_#{@layout.id}_link", :partial => 'toggle_link', :object => @layout, :locals => { :state => 'closed' }
|
7
|
+
page.hide "layout_#{@layout.id}_children"
|
8
|
+
page.replace_html "layout_#{@layout.id}_children", ''
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= link_to 'Add New Layout', new_cms_admin_layout_path, :class => 'big_button'
|
2
|
+
|
3
|
+
%h2 Editing Layout
|
4
|
+
|
5
|
+
- form_for :layout, :url => {:action => :update}, :html => {:method => :put} do |form|
|
6
|
+
= render :partial => form
|
7
|
+
.submit
|
8
|
+
= form.submit 'Edit Layout'
|
9
|
+
or
|
10
|
+
= link_to 'Return to List', cms_admin_layouts_path
|
@@ -0,0 +1,25 @@
|
|
1
|
+
- page ||= details
|
2
|
+
|
3
|
+
%table{:class => 'details', :id => "page_details_#{page.id}", :style => 'display: none'}
|
4
|
+
|
5
|
+
- if page.redirect_to_page
|
6
|
+
%tr
|
7
|
+
%th Redirecting To:
|
8
|
+
%td
|
9
|
+
= link_to page.redirect_to_page.label, cms_admin_page_path(page.redirect_to_page)
|
10
|
+
= "(#{link_to page.redirect_to_page.full_path, page.redirect_to_page.full_path})"
|
11
|
+
|
12
|
+
- if page.redirected_from_page
|
13
|
+
%tr
|
14
|
+
%th Redirected From:
|
15
|
+
%td
|
16
|
+
= link_to page.redirected_from_page.label, cms_admin_page_path(page.redirected_from_page)
|
17
|
+
= "(#{link_to page.redirected_from_page.full_path, page.redirected_from_page.full_path})"
|
18
|
+
|
19
|
+
- if page.cms_layout
|
20
|
+
%tr
|
21
|
+
%th Layout:
|
22
|
+
%td= link_to page.cms_layout.label, cms_admin_layout_path(page.cms_layout)
|
23
|
+
%tr
|
24
|
+
%th Blocks:
|
25
|
+
%td= page.cms_blocks.collect(&:label).join(', ')
|