ecm_cms 0.0.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +55 -0
- data/Rakefile +27 -0
- data/app/assets/stylesheets/ecm_cms.css.less +3 -0
- data/app/controllers/ecm/cms/page_controller.rb +11 -0
- data/app/helpers/ecm/cms_helper.rb +42 -0
- data/app/models/ecm/cms.rb +5 -0
- data/app/models/ecm/cms/folder.rb +31 -0
- data/app/models/ecm/cms/navigation.rb +24 -0
- data/app/models/ecm/cms/navigation_item.rb +93 -0
- data/app/models/ecm/cms/page.rb +42 -0
- data/app/models/ecm/cms/partial.rb +31 -0
- data/app/models/ecm/cms/template.rb +31 -0
- data/config/locales/ecm.cms.de.yml +17 -0
- data/config/locales/ecm.cms.en.yml +17 -0
- data/config/locales/ecm.cms.navigation.de.yml +16 -0
- data/config/locales/ecm.cms.navigation.en.yml +16 -0
- data/config/locales/ecm.cms.navigation_item.de.yml +23 -0
- data/config/locales/ecm.cms.navigation_item.en.yml +23 -0
- data/config/locales/ecm.cms.page.de.yml +26 -0
- data/config/locales/ecm.cms.page.en.yml +26 -0
- data/config/locales/ecm.cms.partial.de.yml +22 -0
- data/config/locales/ecm.cms.partial.en.yml +22 -0
- data/config/locales/ecm.cms.template.de.yml +22 -0
- data/config/locales/ecm.cms.template.en.yml +22 -0
- data/db/migrate/001_create_ecm_cms_folders.rb +21 -0
- data/db/migrate/002_create_ecm_cms_pages.rb +19 -0
- data/db/migrate/003_create_ecm_cms_templates.rb +18 -0
- data/db/migrate/004_create_ecm_cms_partials.rb +19 -0
- data/db/migrate/005_create_ecm_cms_navigations.rb +13 -0
- data/db/migrate/006_create_ecm_cms_navigation_items.rb +28 -0
- data/lib/ecm/cms/action_view/template/handlers/textile.rb +18 -0
- data/lib/ecm/cms/action_view/template_patch.rb +19 -0
- data/lib/ecm/cms/action_view/template_renderer_patch.rb +30 -0
- data/lib/ecm/cms/active_admin/ecm_cms_navigation_items.rb +45 -0
- data/lib/ecm/cms/active_admin/ecm_cms_navigations.rb +61 -0
- data/lib/ecm/cms/active_admin/ecm_cms_pages.rb +70 -0
- data/lib/ecm/cms/active_admin/ecm_cms_partials.rb +47 -0
- data/lib/ecm/cms/active_admin/ecm_cms_templates.rb +46 -0
- data/lib/ecm/cms/configuration.rb +22 -0
- data/lib/ecm/cms/database_resolver.rb +101 -0
- data/lib/ecm/cms/database_template.rb +67 -0
- data/lib/ecm/cms/engine.rb +22 -0
- data/lib/ecm/cms/resolvers/ecm/cms/page_resolver.rb +37 -0
- data/lib/ecm/cms/resolvers/ecm/cms/partial_resolver.rb +30 -0
- data/lib/ecm/cms/resolvers/ecm/cms/template_resolver.rb +30 -0
- data/lib/ecm/cms/routing.rb +13 -0
- data/lib/ecm/cms/version.rb +5 -0
- data/lib/ecm_cms.rb +30 -0
- data/lib/generators/ecm/cms/install/install_generator.rb +15 -0
- data/lib/generators/ecm/cms/install/templates/ecm_cms.rb +7 -0
- data/lib/generators/ecm/cms/locales/locales_generator.rb +32 -0
- data/lib/rails_tools/i18n_controller.rb +24 -0
- data/lib/tasks/ecm_cms_tasks.rake +171 -0
- metadata +463 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
en:
|
2
|
+
ecm:
|
3
|
+
cms:
|
4
|
+
active_admin:
|
5
|
+
menu: CMS
|
6
|
+
navigation:
|
7
|
+
messages:
|
8
|
+
empty: Navigation %{name} (%{lang}) is empty
|
9
|
+
not_found: Could not find navigation %{name} (%{lang})
|
10
|
+
resources:
|
11
|
+
ecm_cms_folders: folders
|
12
|
+
ecm_cms_navigations: navigations
|
13
|
+
ecm_cms_navigation_items: navigation_items
|
14
|
+
ecm_cms_pages: pages
|
15
|
+
ecm_cms_partials: partials
|
16
|
+
ecm_cms_templates: templates
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/navigation:
|
6
|
+
one: Navigation
|
7
|
+
other: Navigationen
|
8
|
+
attributes:
|
9
|
+
ecm/cms/navigation:
|
10
|
+
created_at: Erstellt am
|
11
|
+
ecm_cms_navigation_items: Navigationseinträge
|
12
|
+
locale: Sprache
|
13
|
+
name: Name
|
14
|
+
slug: Freundliche ID
|
15
|
+
updated_at: Aktualisiert am
|
16
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/navigation:
|
6
|
+
one: navigation
|
7
|
+
other: navigations
|
8
|
+
attributes:
|
9
|
+
ecm/cms/navigation:
|
10
|
+
created_at: created at
|
11
|
+
ecm_cms_navigation_items: navigation items
|
12
|
+
locale: language
|
13
|
+
name: name
|
14
|
+
slug: friendly id
|
15
|
+
updated_at: updated at
|
16
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/navigation_item:
|
6
|
+
one: Navigationseintrag
|
7
|
+
other: Navigationseinträge
|
8
|
+
attributes:
|
9
|
+
ecm/cms/navigation_item:
|
10
|
+
created_at: Erstellt am
|
11
|
+
depth: Baumtiefe
|
12
|
+
ecm_cms_navigation: Navigation
|
13
|
+
ecm_cms_page: Seite
|
14
|
+
key: Schlüssel
|
15
|
+
lft: Links
|
16
|
+
name: Name
|
17
|
+
options: Optionen
|
18
|
+
parent: Untereintrag von
|
19
|
+
rgt: Rechts
|
20
|
+
slug: Freundliche ID
|
21
|
+
updated_at: Aktualisiert am
|
22
|
+
url: Ziel-URL
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/navigation_item:
|
6
|
+
one: navigation item
|
7
|
+
other: navigation items
|
8
|
+
attributes:
|
9
|
+
ecm/cms/navigation_item:
|
10
|
+
created_at: created at
|
11
|
+
depth: tree depth
|
12
|
+
ecm_cms_navigation: navigation
|
13
|
+
ecm_cms_page: page
|
14
|
+
key: key
|
15
|
+
lft: left
|
16
|
+
name: name
|
17
|
+
options: options
|
18
|
+
parent: parent
|
19
|
+
rgt: right
|
20
|
+
slug: friendly id
|
21
|
+
updated_at: updated at
|
22
|
+
url: target url
|
23
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/page:
|
6
|
+
one: Seite
|
7
|
+
other: Seiten
|
8
|
+
attributes:
|
9
|
+
ecm/cms/page:
|
10
|
+
basename: Name
|
11
|
+
body: Inhalt
|
12
|
+
created_at: Erstellt am
|
13
|
+
ecm_cms_folder_id: Ordner
|
14
|
+
ecm_cms_folder: Ordner
|
15
|
+
ecm_cms_navigation_items: Verlinkt von
|
16
|
+
ecm_cms_navigation_item_ids: Verlinkt von
|
17
|
+
filename: Dateiname
|
18
|
+
format: Format
|
19
|
+
handler: Handler
|
20
|
+
layout: Layout
|
21
|
+
locale: Sprache
|
22
|
+
meta_description: Meta Beschreibung
|
23
|
+
pathname: Pfad
|
24
|
+
title: Titel
|
25
|
+
updated_at: Aktualisiert am
|
26
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/page:
|
6
|
+
one: page
|
7
|
+
other: pages
|
8
|
+
attributes:
|
9
|
+
ecm/cms/page:
|
10
|
+
basename: name
|
11
|
+
body: body
|
12
|
+
created_at: created at
|
13
|
+
ecm_cms_folder_id: folder
|
14
|
+
ecm_cms_folder: folder
|
15
|
+
ecm_cms_navigation_items: navigation items
|
16
|
+
ecm_cms_navigation_item_ids: navigation items
|
17
|
+
filename: filename
|
18
|
+
format: format
|
19
|
+
handler: handler
|
20
|
+
layout: layout
|
21
|
+
locale: language
|
22
|
+
meta_description: meta description
|
23
|
+
pathname: path
|
24
|
+
title: title
|
25
|
+
updated_at: updated at
|
26
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/partial:
|
6
|
+
one: Fragment
|
7
|
+
other: Fragmente
|
8
|
+
attributes:
|
9
|
+
ecm/cms/partial:
|
10
|
+
basename: Name
|
11
|
+
body: Inhalt
|
12
|
+
created_at: Erstellt am
|
13
|
+
ecm_cms_folder_id: Ordner
|
14
|
+
ecm_cms_folder: Ordner
|
15
|
+
filename: Dateiname
|
16
|
+
format: Format
|
17
|
+
handler: Handler
|
18
|
+
layout: Layout
|
19
|
+
locale: Sprache
|
20
|
+
pathname: Pfad
|
21
|
+
updated_at: Aktualisiert am
|
22
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/partial:
|
6
|
+
one: partial
|
7
|
+
other: partials
|
8
|
+
attributes:
|
9
|
+
ecm/cms/partial:
|
10
|
+
basename: name
|
11
|
+
body: body
|
12
|
+
created_at: created at
|
13
|
+
ecm_cms_folder_id: folder
|
14
|
+
ecm_cms_folder: folder
|
15
|
+
filename: filename
|
16
|
+
format: format
|
17
|
+
handler: handler
|
18
|
+
layout: layout
|
19
|
+
locale: language
|
20
|
+
pathname: path
|
21
|
+
updated_at: updated at
|
22
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/template:
|
6
|
+
one: Vorlage
|
7
|
+
other: Vorlagen
|
8
|
+
attributes:
|
9
|
+
ecm/cms/template:
|
10
|
+
basename: Name
|
11
|
+
body: Inhalt
|
12
|
+
created_at: Erstellt am
|
13
|
+
ecm_cms_folder_id: Ordner
|
14
|
+
ecm_cms_folder: Ordner
|
15
|
+
filename: Dateiname
|
16
|
+
format: Format
|
17
|
+
handler: Handler
|
18
|
+
layout: Layout
|
19
|
+
locale: Sprache
|
20
|
+
pathname: Pfad
|
21
|
+
updated_at: Aktualsiert am
|
22
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
models:
|
5
|
+
ecm/cms/template:
|
6
|
+
one: template
|
7
|
+
other: templates
|
8
|
+
attributes:
|
9
|
+
ecm/cms/template:
|
10
|
+
basename: name
|
11
|
+
body: body
|
12
|
+
created_at: created at
|
13
|
+
ecm_cms_folder_id: folder
|
14
|
+
ecm_cms_folder: folder
|
15
|
+
filename: filename
|
16
|
+
format: format
|
17
|
+
handler: handler
|
18
|
+
layout: layout
|
19
|
+
locale: language
|
20
|
+
pathname: path
|
21
|
+
updated_at: updated at
|
22
|
+
|
@@ -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,28 @@
|
|
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
|
+
|
9
|
+
# associations
|
10
|
+
t.references :ecm_cms_navigation
|
11
|
+
t.references :ecm_cms_page
|
12
|
+
|
13
|
+
# awesome nested set
|
14
|
+
t.references :parent
|
15
|
+
t.integer :children_count, :default => 0, :null => false
|
16
|
+
t.integer :lft
|
17
|
+
t.integer :rgt
|
18
|
+
t.integer :depth
|
19
|
+
|
20
|
+
# friendly id
|
21
|
+
t.string :slug
|
22
|
+
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
add_index :ecm_cms_navigation_items, :ecm_cms_navigation_id
|
26
|
+
add_index :ecm_cms_navigation_items, :parent_id
|
27
|
+
end
|
28
|
+
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,30 @@
|
|
1
|
+
module ActionView
|
2
|
+
module TemplateRendererPatch
|
3
|
+
def self.included base
|
4
|
+
base.class_eval do
|
5
|
+
alias_method :original_render, :render
|
6
|
+
|
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 ||= options[:layout]
|
20
|
+
|
21
|
+
render_template(template, layout, options[:locals])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
ActionView::TemplateRenderer.send(:include, ActionView::TemplateRendererPatch)
|
30
|
+
|