honey-cms 0.2.4 → 0.3.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.
- data/app/controllers/cms/pages_controller.rb +4 -0
- data/lib/cms.rb +1 -0
- data/lib/cms/configuration.rb +3 -1
- data/lib/cms/page.rb +16 -0
- data/lib/cms/routes.rb +5 -1
- metadata +2 -1
data/lib/cms.rb
CHANGED
data/lib/cms/configuration.rb
CHANGED
data/lib/cms/page.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class CMS::Page
|
2
|
+
attr_reader :route, :options
|
3
|
+
|
4
|
+
def initialize route, options
|
5
|
+
@options = options
|
6
|
+
@route = (options[:route] || route).dup
|
7
|
+
end
|
8
|
+
|
9
|
+
def action
|
10
|
+
@action ||= (options[:action] || route).dup
|
11
|
+
end
|
12
|
+
|
13
|
+
def editable?
|
14
|
+
!options[:static]
|
15
|
+
end
|
16
|
+
end
|
data/lib/cms/routes.rb
CHANGED
@@ -12,7 +12,11 @@ class CMS::Routes < SimpleDelegator
|
|
12
12
|
end
|
13
13
|
|
14
14
|
CMS::Configuration.pages.each do |page|
|
15
|
-
|
15
|
+
if page.editable?
|
16
|
+
get page.route => 'cms/pages#show', page: page.action, as: "cms_#{page.action}"
|
17
|
+
else
|
18
|
+
get page.route => 'cms/pages#static_page', page: page.action, as: "cms_#{page.action}"
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honey-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- lib/cms/helper.rb
|
34
34
|
- lib/cms/inflections.rb
|
35
35
|
- lib/cms/orderable.rb
|
36
|
+
- lib/cms/page.rb
|
36
37
|
- lib/cms/routes.rb
|
37
38
|
- lib/cms/type.rb
|
38
39
|
- lib/cms/uploader.rb
|