ecm_cms2 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +66 -0
  4. data/Rakefile +25 -0
  5. data/app/assets/javascripts/ecm_cms.js.coffee +0 -0
  6. data/app/assets/stylesheets/ecm_cms.css.less +11 -0
  7. data/app/controllers/ecm/cms/page_controller.rb +24 -0
  8. data/app/helpers/ecm/cms_helper.rb +46 -0
  9. data/app/models/concerns/ecm/cms/navigation_item/properties.rb +29 -0
  10. data/app/models/ecm/cms/content_box.rb +16 -0
  11. data/app/models/ecm/cms/folder.rb +20 -0
  12. data/app/models/ecm/cms/navigation.rb +18 -0
  13. data/app/models/ecm/cms/navigation_item.rb +88 -0
  14. data/app/models/ecm/cms/page/content_block.rb +24 -0
  15. data/app/models/ecm/cms/page.rb +33 -0
  16. data/app/models/ecm/cms/partial.rb +16 -0
  17. data/app/models/ecm/cms/template.rb +19 -0
  18. data/config/locales/ecm.cms.content_box.de.yml +15 -0
  19. data/config/locales/ecm.cms.content_box.en.yml +15 -0
  20. data/config/locales/ecm.cms.de.yml +17 -0
  21. data/config/locales/ecm.cms.en.yml +17 -0
  22. data/config/locales/ecm.cms.navigation.de.yml +15 -0
  23. data/config/locales/ecm.cms.navigation.en.yml +15 -0
  24. data/config/locales/ecm.cms.navigation_item.de.yml +25 -0
  25. data/config/locales/ecm.cms.navigation_item.en.yml +25 -0
  26. data/config/locales/ecm.cms.page.content_block.de.yml +14 -0
  27. data/config/locales/ecm.cms.page.content_block.en.yml +14 -0
  28. data/config/locales/ecm.cms.page.de.yml +25 -0
  29. data/config/locales/ecm.cms.page.en.yml +25 -0
  30. data/config/locales/ecm.cms.partial.de.yml +21 -0
  31. data/config/locales/ecm.cms.partial.en.yml +21 -0
  32. data/config/locales/ecm.cms.template.de.yml +21 -0
  33. data/config/locales/ecm.cms.template.en.yml +21 -0
  34. data/config/routes.rb +2 -0
  35. data/db/migrate/001_create_ecm_cms_folders.rb +21 -0
  36. data/db/migrate/002_create_ecm_cms_pages.rb +19 -0
  37. data/db/migrate/003_create_ecm_cms_templates.rb +18 -0
  38. data/db/migrate/004_create_ecm_cms_partials.rb +19 -0
  39. data/db/migrate/005_create_ecm_cms_navigations.rb +13 -0
  40. data/db/migrate/006_create_ecm_cms_navigation_items.rb +29 -0
  41. data/db/migrate/007_create_ecm_cms_content_boxes.rb +9 -0
  42. data/db/migrate/008_create_ecm_cms_page_content_blocks.rb +15 -0
  43. data/lib/ecm/cms/action_view/template/handlers/textile.rb +18 -0
  44. data/lib/ecm/cms/action_view/template_patch.rb +19 -0
  45. data/lib/ecm/cms/action_view/template_renderer_patch.rb +47 -0
  46. data/lib/ecm/cms/active_admin/ecm_cms_content_box.rb +33 -0
  47. data/lib/ecm/cms/active_admin/ecm_cms_navigation_items.rb +68 -0
  48. data/lib/ecm/cms/active_admin/ecm_cms_navigations.rb +65 -0
  49. data/lib/ecm/cms/active_admin/ecm_cms_pages.rb +110 -0
  50. data/lib/ecm/cms/active_admin/ecm_cms_partials.rb +53 -0
  51. data/lib/ecm/cms/active_admin/ecm_cms_templates.rb +55 -0
  52. data/lib/ecm/cms/configuration.rb +33 -0
  53. data/lib/ecm/cms/controller_extensions/page_resolver.rb +13 -0
  54. data/lib/ecm/cms/controller_extensions/partial_resolver.rb +13 -0
  55. data/lib/ecm/cms/controller_extensions/template_resolver.rb +13 -0
  56. data/lib/ecm/cms/database_resolver.rb +101 -0
  57. data/lib/ecm/cms/database_template.rb +61 -0
  58. data/lib/ecm/cms/engine.rb +28 -0
  59. data/lib/ecm/cms/importers/navigation.rb +30 -0
  60. data/lib/ecm/cms/importers/navigation_item.rb +64 -0
  61. data/lib/ecm/cms/importers/page.rb +41 -0
  62. data/lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb +45 -0
  63. data/lib/ecm/cms/resolvers/ecm/cms/partial_resolver.rb +30 -0
  64. data/lib/ecm/cms/resolvers/ecm/cms/template_resolver.rb +30 -0
  65. data/lib/ecm/cms/routing.rb +13 -0
  66. data/lib/ecm/cms/version.rb +5 -0
  67. data/lib/ecm_cms2.rb +36 -0
  68. data/lib/generators/ecm/cms/install/install_generator.rb +15 -0
  69. data/lib/generators/ecm/cms/install/templates/ecm_cms.rb +37 -0
  70. data/lib/generators/ecm/cms/locales/locales_generator.rb +38 -0
  71. data/lib/tasks/ecm_cms_tasks.rake +5 -0
  72. metadata +498 -0
@@ -0,0 +1,25 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/page:
5
+ one: Seite
6
+ other: Seiten
7
+ attributes:
8
+ ecm/cms/page:
9
+ basename: Name
10
+ body: Inhalt
11
+ created_at: Erstellt am
12
+ ecm_cms_folder_id: Ordner
13
+ ecm_cms_folder: Ordner
14
+ ecm_cms_navigation_items: Verlinkt von
15
+ ecm_cms_navigation_item_ids: Verlinkt von
16
+ filename: Dateiname
17
+ format: Format
18
+ handler: Handler
19
+ layout: Layout
20
+ locale: Sprache
21
+ meta_description: Meta Beschreibung
22
+ pathname: Pfad
23
+ title: Titel
24
+ updated_at: Aktualisiert am
25
+
@@ -0,0 +1,25 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/page:
5
+ one: page
6
+ other: pages
7
+ attributes:
8
+ ecm/cms/page:
9
+ basename: name
10
+ body: body
11
+ created_at: created at
12
+ ecm_cms_folder_id: folder
13
+ ecm_cms_folder: folder
14
+ ecm_cms_navigation_items: navigation items
15
+ ecm_cms_navigation_item_ids: navigation items
16
+ filename: filename
17
+ format: format
18
+ handler: handler
19
+ layout: layout
20
+ locale: language
21
+ meta_description: meta description
22
+ pathname: path
23
+ title: title
24
+ updated_at: updated at
25
+
@@ -0,0 +1,21 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/partial:
5
+ one: Fragment
6
+ other: Fragmente
7
+ attributes:
8
+ ecm/cms/partial:
9
+ basename: Name
10
+ body: Inhalt
11
+ created_at: Erstellt am
12
+ ecm_cms_folder_id: Ordner
13
+ ecm_cms_folder: Ordner
14
+ filename: Dateiname
15
+ format: Format
16
+ handler: Handler
17
+ layout: Layout
18
+ locale: Sprache
19
+ pathname: Pfad
20
+ updated_at: Aktualisiert am
21
+
@@ -0,0 +1,21 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/partial:
5
+ one: partial
6
+ other: partials
7
+ attributes:
8
+ ecm/cms/partial:
9
+ basename: name
10
+ body: body
11
+ created_at: created at
12
+ ecm_cms_folder_id: folder
13
+ ecm_cms_folder: folder
14
+ filename: filename
15
+ format: format
16
+ handler: handler
17
+ layout: layout
18
+ locale: language
19
+ pathname: path
20
+ updated_at: updated at
21
+
@@ -0,0 +1,21 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/template:
5
+ one: Vorlage
6
+ other: Vorlagen
7
+ attributes:
8
+ ecm/cms/template:
9
+ basename: Name
10
+ body: Inhalt
11
+ created_at: Erstellt am
12
+ ecm_cms_folder_id: Ordner
13
+ ecm_cms_folder: Ordner
14
+ filename: Dateiname
15
+ format: Format
16
+ handler: Handler
17
+ layout: Layout
18
+ locale: Sprache
19
+ pathname: Pfad
20
+ updated_at: Aktualsiert am
21
+
@@ -0,0 +1,21 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ ecm/cms/template:
5
+ one: template
6
+ other: templates
7
+ attributes:
8
+ ecm/cms/template:
9
+ basename: name
10
+ body: body
11
+ created_at: created at
12
+ ecm_cms_folder_id: folder
13
+ ecm_cms_folder: folder
14
+ filename: filename
15
+ format: format
16
+ handler: handler
17
+ layout: layout
18
+ locale: language
19
+ pathname: path
20
+ updated_at: updated at
21
+
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Ecm::Cms::Engine.routes.draw do
2
+ end
@@ -0,0 +1,21 @@
1
+ class CreateEcmCmsFolders < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_folders do |t|
4
+ t.string :basename
5
+ t.string :pathname
6
+
7
+ # associations
8
+ t.integer :children_count, :default => 0, :null => false
9
+ t.integer :ecm_cms_templates_count, :default => 0, :null => false
10
+
11
+ # awesome nested set
12
+ t.references :parent
13
+ t.integer :lft
14
+ t.integer :rgt
15
+ t.integer :depth
16
+
17
+ t.timestamps
18
+ end
19
+ add_index :ecm_cms_folders, :parent_id
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ class CreateEcmCmsPages < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_pages do |t|
4
+ t.string :basename
5
+ t.string :pathname
6
+ t.string :title
7
+ t.text :meta_description
8
+ t.text :body
9
+ t.string :layout
10
+ t.string :locale
11
+ t.string :format
12
+ t.string :handler
13
+ t.references :ecm_cms_folder
14
+
15
+ t.timestamps
16
+ end
17
+ add_index :ecm_cms_pages, :ecm_cms_folder_id
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ class CreateEcmCmsTemplates < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_templates do |t|
4
+ t.string :basename
5
+ t.string :pathname
6
+ t.text :body
7
+ t.string :locale
8
+ t.string :format
9
+ t.string :handler
10
+
11
+ # associations
12
+ t.references :ecm_cms_folder
13
+
14
+ t.timestamps
15
+ end
16
+ add_index :ecm_cms_templates, :ecm_cms_folder_id
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ class CreateEcmCmsPartials < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_partials do |t|
4
+ t.string :basename
5
+ t.string :pathname
6
+ t.text :body
7
+ t.string :layout
8
+ t.string :locale
9
+ t.string :format
10
+ t.string :handler
11
+
12
+ # associations
13
+ t.references :ecm_cms_folder
14
+
15
+ t.timestamps
16
+ end
17
+ add_index :ecm_cms_partials, :ecm_cms_folder_id
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ class CreateEcmCmsNavigations < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_navigations do |t|
4
+ t.string :locale
5
+ t.string :name
6
+
7
+ # friendly id
8
+ t.string :slug
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ class CreateEcmCmsNavigationItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_navigation_items do |t|
4
+ t.string :name
5
+ t.string :url
6
+ t.string :key
7
+ t.string :options
8
+ t.text :properties, null: true
9
+
10
+ # associations
11
+ t.references :ecm_cms_navigation
12
+ t.references :ecm_cms_page
13
+
14
+ # awesome nested set
15
+ t.references :parent
16
+ t.integer :children_count, default: 0, null: false
17
+ t.integer :lft
18
+ t.integer :rgt
19
+ t.integer :depth
20
+
21
+ # friendly id
22
+ t.string :slug
23
+
24
+ t.timestamps
25
+ end
26
+ add_index :ecm_cms_navigation_items, :ecm_cms_navigation_id
27
+ add_index :ecm_cms_navigation_items, :parent_id
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ class CreateEcmCmsContentBoxes < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_content_boxes do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class CreateEcmCmsPageContentBlocks < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_page_content_blocks do |t|
4
+ t.text :body
5
+
6
+ # associations
7
+ t.references :ecm_cms_page
8
+ t.references :ecm_cms_content_box
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :ecm_cms_page_content_blocks, :ecm_cms_page_id
13
+ add_index :ecm_cms_page_content_blocks, :ecm_cms_content_box_id
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ module ActionView::Template::Handlers
2
+ class Textile
3
+
4
+ class_attribute :default_format
5
+ self.default_format = Mime::HTML
6
+
7
+ def erb_handler
8
+ @@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
9
+ end
10
+
11
+ def call(template)
12
+ compiled_source = erb_handler.call(template)
13
+ "RedCloth.new(begin;#{compiled_source};end).to_html.html_safe"
14
+ end
15
+
16
+ end
17
+ end
18
+
@@ -0,0 +1,19 @@
1
+ module ActionView
2
+ module TemplatePatch
3
+ def self.included base
4
+ base.class_eval do
5
+ attr_accessor :layout
6
+
7
+ alias_method :original_initialize, :initialize
8
+
9
+ def initialize(source, identifier, handler, details)
10
+ @layout = details[:layout] if details.has_key?(:layout)
11
+ original_initialize(source, identifier, handler, details)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ ActionView::Template.send(:include, ActionView::TemplatePatch)
19
+
@@ -0,0 +1,47 @@
1
+ module ActionView
2
+ module TemplateRendererPatch
3
+ def self.included base
4
+ base.class_eval do
5
+ alias_method :original_render, :render
6
+ if Rails::VERSION::MAJOR < 4
7
+ def render(context, options)
8
+ @view = context
9
+ @details = extract_details(options)
10
+ extract_format(options[:file] || options[:template], @details)
11
+ template = determine_template(options)
12
+ context = @lookup_context
13
+
14
+ unless context.rendered_format
15
+ context.formats = template.formats unless template.formats.empty?
16
+ context.rendered_format = context.formats.first
17
+ end
18
+
19
+ layout = template.layout if template.respond_to?(:layout)
20
+ layout ||= options[:layout]
21
+
22
+ render_template(template, layout, options[:locals])
23
+ end
24
+ elsif Rails::VERSION::MAJOR < 5
25
+ def render(context, options)
26
+ @view = context
27
+ @details = extract_details(options)
28
+ template = determine_template(options)
29
+
30
+ prepend_formats(template.formats)
31
+
32
+ @lookup_context.rendered_format ||= (template.formats.first || formats.first)
33
+
34
+ layout = template.layout if template.respond_to?(:layout)
35
+ layout ||= options[:layout]
36
+
37
+ render_template(template, layout, options[:locals])
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+
46
+ ActionView::TemplateRenderer.send(:include, ActionView::TemplateRendererPatch)
47
+
@@ -0,0 +1,33 @@
1
+ ActiveAdmin.register Ecm::Cms::ContentBox do
2
+ permit_params(:name) if Rails.version >= '4.0.0'
3
+
4
+ menu :parent => Proc.new { I18n.t('ecm.cms.active_admin.menu') }.call
5
+
6
+ index do
7
+ selectable_column
8
+ column :name
9
+ column :created_at
10
+ column :updated_at
11
+ ActiveAdmin::VERSION[0] < '1' ? default_actions : actions
12
+ end
13
+
14
+ show do
15
+ panel Ecm::Cms::ContentBox.human_attribute_name(:ecm_cms_page_content_blocks) do
16
+ table_for ecm_cms_content_box.ecm_cms_page_content_blocks, :i18n => Ecm::Cms::Page::ContentBlock do |content_block|
17
+ column :ecm_cms_page
18
+ column :body
19
+ column :created_at
20
+ column :updated_at
21
+ end
22
+ end
23
+ end
24
+
25
+ sidebar Ecm::Cms::ContentBox.human_attribute_name(:details), :only => :show do
26
+ attributes_table_for ecm_cms_content_box do
27
+ row :name
28
+ row :created_at
29
+ row :updated_at
30
+ row :ecm_cms_page_content_blocks_count
31
+ end
32
+ end # sidebar
33
+ end
@@ -0,0 +1,68 @@
1
+ ActiveAdmin.register Ecm::Cms::NavigationItem do
2
+ permit_params(:depth,
3
+ :ecm_cms_navigation_id,
4
+ :ecm_cms_page_id,
5
+ :id,
6
+ :key,
7
+ :name,
8
+ :options,
9
+ :parent_id,
10
+ :string,
11
+ :url,
12
+ *Ecm::Cms::Configuration.navigation_item_properties,
13
+ :highlights_on
14
+ )
15
+
16
+ sortable_tree_member_actions
17
+
18
+ # Menu
19
+ menu :parent => Proc.new { I18n.t('ecm.cms.active_admin.menu') }.call
20
+
21
+ form do |f|
22
+ f.inputs do
23
+ f.input :ecm_cms_navigation, :collection => Ecm::Cms::Navigation.all.collect { |navigation| [navigation.to_s, navigation.id] }
24
+ f.input :parent
25
+ f.input :name
26
+ end
27
+
28
+ f.inputs do
29
+ f.input :ecm_cms_page
30
+ f.input :url
31
+ end
32
+
33
+ f.inputs do
34
+ f.input :key
35
+ f.input :options
36
+ end
37
+
38
+ f.inputs Ecm::Cms::NavigationItem.human_attribute_name(:options) do
39
+ f.input :highlights_on
40
+ end
41
+
42
+ f.inputs Ecm::Cms::NavigationItem.human_attribute_name(:li_attributes) do
43
+ Ecm::Cms::Configuration.navigation_item_properties.each do |navigation_item_property|
44
+ f.input navigation_item_property
45
+ end
46
+ end
47
+
48
+ f.actions
49
+ end
50
+
51
+ index :as => :nested_set do
52
+ selectable_column
53
+ sortable_tree_columns
54
+ column(:ecm_cms_navigation) { |ni| link_to(ni.ecm_cms_navigation.to_s, [:admin, ni.ecm_cms_navigation]) }
55
+ sortable_tree_indented_column :name
56
+ column :url
57
+ column :ecm_cms_page do |ni|
58
+ if ni.ecm_cms_page.blank?
59
+ link_to(I18n.t('active_admin.new_model', :model => Ecm::Cms::Page.model_name.human), new_admin_ecm_cms_page_path({:ecm_cms_page => ni.params_for_new_page}))
60
+ else
61
+ link_to(ni.ecm_cms_page.title, [:admin, ni.ecm_cms_page])
62
+ end
63
+ end
64
+ column :created_at
65
+ column :updated_at
66
+ ActiveAdmin::VERSION[0] < '1' ? default_actions : actions
67
+ end
68
+ end
@@ -0,0 +1,65 @@
1
+ include ActiveAdmin::AwesomeNestedSet::Helper
2
+
3
+ ActiveAdmin.register Ecm::Cms::Navigation do
4
+ permit_params(:locale,
5
+ :name,
6
+ :slug) if Rails.version >= '4.0.0'
7
+
8
+ # Filters
9
+ filter :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
10
+ filter :name
11
+
12
+ # Menu
13
+ menu :parent => Proc.new { I18n.t('ecm.cms.active_admin.menu') }.call
14
+
15
+ form do |f|
16
+ f.inputs do
17
+ f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
18
+ f.input :name
19
+ end
20
+
21
+ f.actions
22
+ end
23
+
24
+ index do
25
+ selectable_column
26
+ column :name
27
+ column :locale
28
+ ActiveAdmin::VERSION[0] < '1' ? default_actions : actions
29
+ end
30
+
31
+ show do
32
+ panel Ecm::Cms::Navigation.human_attribute_name(:ecm_cms_navigation_items) do
33
+ table_for ecm_cms_navigation.ecm_cms_navigation_items, :i18n => Ecm::Cms::NavigationItem do
34
+ sortable_tree_columns
35
+ sortable_tree_indented_column :name
36
+ column :url
37
+ column :ecm_cms_page do |ni|
38
+ if ni.ecm_cms_page.blank?
39
+ link_to(I18n.t('active_admin.create_model', :model => Ecm::Cms::Page.model_name.human), new_admin_ecm_cms_page_path({:ecm_cms_page => ni.params_for_new_page}))
40
+ else
41
+ link_to(ni.ecm_cms_page.title, [:admin, ni.ecm_cms_page])
42
+ end
43
+ end
44
+ column :created_at
45
+ column :updated_at
46
+
47
+ column do |ni|
48
+ link_to(I18n.t('active_admin.view'), [:admin, ni], :class => "member_link view_link") +
49
+ link_to(I18n.t('active_admin.edit'), [:edit, :admin, ni], :class => "member_link edit_link")
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ sidebar Ecm::Cms::Navigation.human_attribute_name(:details), :only => :show do
56
+ attributes_table_for ecm_cms_navigation do
57
+ row :locale
58
+ row :name
59
+ row :slug
60
+ row :created_at
61
+ row :updated_at
62
+ end
63
+ end # sidebar
64
+ end if defined?(::ActiveAdmin)
65
+
@@ -0,0 +1,110 @@
1
+ ActiveAdmin.register Ecm::Cms::Page do
2
+ permit_params(:basename,
3
+ :body,
4
+ :ecm_cms_folder_id,
5
+ :ecm_cms_navigation_item_ids,
6
+ :ecm_cms_page_content_blocks_attributes,
7
+ :format,
8
+ :handler,
9
+ :layout,
10
+ :locale,
11
+ :meta_description,
12
+ :pathname,
13
+ :title) if Rails.version >= '4.0.0'
14
+
15
+
16
+ menu :parent => Proc.new { I18n.t('ecm.cms.active_admin.menu') }.call
17
+
18
+ form do |f|
19
+ # f.inputs do
20
+ # f.object.errors.inspect
21
+ # end
22
+
23
+ f.inputs do
24
+ f.input :title
25
+ f.input :meta_description
26
+ f.input :body
27
+ end
28
+
29
+ f.has_many :ecm_cms_page_content_blocks do |cb|
30
+ # cb.inputs do
31
+ if cb.object.persisted?
32
+ cb.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
33
+ end
34
+
35
+ cb.input :ecm_cms_content_box
36
+ cb.input :body
37
+ # end
38
+ end if Ecm::Cms::ContentBox.count > 0
39
+
40
+ f.inputs do
41
+ f.input :pathname
42
+ f.input :basename
43
+ f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
44
+ f.input :format, :as => :select, :collection => Mime::SET.symbols.map(&:to_s)
45
+ f.input :handler, :as => :select, :collection => ActionView::Template::Handlers.extensions.map(&:to_s)
46
+ end
47
+
48
+ f.inputs do
49
+ f.input :layout
50
+ end
51
+
52
+ I18n.available_locales.each do |locale|
53
+ Ecm::Cms::Navigation.where(:locale => locale).all.each do |navigation|
54
+ f.inputs navigation.to_s do
55
+ f.input :ecm_cms_navigation_items,
56
+ :as => :check_boxes,
57
+ :collection => navigation.ecm_cms_navigation_items.joins(:ecm_cms_navigation).where(:ecm_cms_navigations => { :locale => locale }),
58
+ :label_method => :key # .all.collect { |i| "#{'--' * i.depth} #{i.name}" }
59
+ end
60
+ end
61
+ end
62
+
63
+ f.actions
64
+ end
65
+
66
+ index do
67
+ selectable_column
68
+ column :pathname
69
+ column :filename, :sortable => :basename
70
+ column :title
71
+ column :home_page?
72
+ column :layout
73
+ column(:ecm_cms_navigation_items) do |page|
74
+ output = ""
75
+ page.ecm_cms_navigation_items.each do |navigation_item|
76
+ output << link_to(navigation_item, [:admin, navigation_item])
77
+ end
78
+ output.html_safe
79
+ end
80
+ column :created_at
81
+ column :updated_at
82
+ ActiveAdmin::VERSION[0] < '1' ? default_actions : actions
83
+ end
84
+
85
+ show do
86
+ panel Ecm::Cms::Page.human_attribute_name(:body) do
87
+ pre { ecm_cms_page.body }
88
+ end
89
+
90
+ ecm_cms_page.ecm_cms_page_content_blocks.each do |content_block|
91
+ panel content_block.content_box_name do
92
+ pre { content_block.body }
93
+ end
94
+ end
95
+ end
96
+
97
+ sidebar Ecm::Cms::Page.human_attribute_name(:details), :only => :show do
98
+ attributes_table_for ecm_cms_page do
99
+ # row :ecm_cms_navigation_item
100
+ # row :folder
101
+ row :pathname
102
+ row :filename
103
+ row :home_page?
104
+ row :layout
105
+ row :created_at
106
+ row :updated_at
107
+ end
108
+ end # sidebar
109
+ end if defined?(::ActiveAdmin)
110
+