cms-fortress 1.2.2 → 1.3.0.rc1
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/.gitignore +66 -0
- data/Gemfile +2 -17
- data/Gemfile.lock +80 -90
- data/README.rdoc +11 -0
- data/Rakefile +9 -39
- data/app/controllers/cms/fortress/admin_controller.rb +5 -0
- data/app/controllers/cms/fortress/roles_controller.rb +11 -21
- data/app/controllers/cms/fortress/users_controller.rb +48 -31
- data/app/helpers/cms/fortress/application_helper.rb +37 -5
- data/app/helpers/comfy/admin/cms/pages_helper.rb +22 -0
- data/app/models/cms/fortress/error.rb +17 -0
- data/app/models/cms/fortress/role.rb +2 -1
- data/app/models/cms/fortress/settings.rb +17 -0
- data/app/models/cms/fortress/user.rb +17 -0
- data/app/models/cms_ability.rb +29 -22
- data/app/views/cms/fortress/admin/dashboard.html.haml +12 -0
- data/app/views/cms/fortress/shared/_dashboard_widget.html.haml +29 -0
- data/app/views/cms/fortress/shared/_menu.html.haml +26 -26
- data/app/views/cms/fortress/shared/_navbar.html.haml +1 -1
- data/app/views/cms/fortress/shared/_page_extend.html.haml +3 -5
- data/app/views/cms/fortress/shared/_page_extend_js.html.haml +2 -14
- data/app/views/cms/fortress/themes/wide/_body.html.haml +9 -8
- data/app/views/cms/fortress/themes/wide/_menu.html.haml +70 -37
- data/app/views/cms/fortress/users/_form.html.haml +6 -1
- data/app/views/cms/fortress/users/edit.html.haml +1 -2
- data/app/views/cms/fortress/users/index.html.haml +14 -5
- data/app/views/cms/fortress/users/new.html.haml +1 -2
- data/app/views/comfy/admin/cms/pages/_form.html.haml +10 -4
- data/app/views/comfy/admin/cms/pages/edit.html.haml +25 -0
- data/app/views/layouts/comfy/admin/cms/_head.html.haml +1 -1
- data/app/views/layouts/comfy/admin/cms/_left.html.haml +15 -12
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/cms-fortress.gemspec +32 -171
- data/config.ru +4 -0
- data/config/application.rb +34 -0
- data/config/boot.rb +5 -0
- data/config/cms/fortress/global_settings.yml +12 -0
- data/config/cms_routes.rb +7 -0
- data/config/database.yml +11 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +29 -0
- data/config/environments/test.rb +36 -0
- data/config/initializers/devise.rb +256 -0
- data/config/initializers/secret_token.rb +14 -0
- data/config/locales/de.yml +28 -1
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/en.yml +37 -1
- data/config/roles.yml +1 -0
- data/config/secrets.yml +14 -0
- data/db/migrate/06_add_type_to_users.rb +11 -0
- data/db/migrate/07_integrate_workflow_into_cms_pages.rb +37 -0
- data/db/schema.rb +182 -0
- data/lib/assets/.keep +0 -0
- data/lib/cms-fortress.rb +10 -1
- data/lib/cms/fortress/application_controller_methods.rb +5 -2
- data/lib/cms/fortress/page_methods.rb +52 -2
- data/lib/cms/fortress/pages_controller_methods.rb +17 -0
- data/lib/cms/fortress/rails/engine.rb +12 -3
- data/lib/cms/fortress/routes/admin.rb +9 -1
- data/lib/cms/fortress/site_methods.rb +29 -0
- data/lib/cms/fortress/sites_controller_methods.rb +22 -0
- data/lib/generators/cms/comfy/comfy_generator.rb +18 -0
- data/lib/generators/cms/fortress/fortress_generator.rb +30 -6
- data/lib/generators/cms/fortress/upgrade/USAGE +8 -0
- data/lib/generators/cms/fortress/upgrade/upgrade_generator.rb +24 -0
- data/lib/tasks/.keep +0 -0
- data/test/{functional → controllers}/cms/fortress/roles_controller_test.rb +9 -4
- data/test/{functional → controllers}/cms/fortress/users_controller_test.rb +10 -11
- data/test/controllers/comfy/admin/cms/pages_controller_test.rb +115 -0
- data/test/fixtures/cms/fortress/role_details.yml +89 -8
- data/test/fixtures/cms/fortress/roles.yml +17 -0
- data/test/fixtures/cms/fortress/users.yml +14 -0
- data/test/fixtures/comfy/cms/blocks.yml +12 -0
- data/test/fixtures/comfy/cms/categories.yml +4 -0
- data/test/fixtures/comfy/cms/categorizations.yml +3 -0
- data/test/fixtures/comfy/cms/files.yml +9 -0
- data/test/fixtures/comfy/cms/layouts.yml +40 -0
- data/test/fixtures/comfy/cms/pages.yml +105 -0
- data/test/fixtures/comfy/cms/revisions.yml +21 -0
- data/test/fixtures/comfy/cms/sites.yml +6 -0
- data/test/fixtures/comfy/cms/snippets.yml +6 -0
- data/test/integration/cms/fortress/users_controller_test.rb +16 -0
- data/test/models/comfy/cms/page_test.rb +84 -0
- data/test/models/comfy/cms/settings_test.rb +16 -0
- data/test/test_helper.rb +25 -0
- metadata +157 -23
- data/app/models/cms/page_workflow.rb +0 -44
- data/app/models/error/missing_role_configuration_file.rb +0 -12
- data/lib/generators/comfy/cms/cms_generator.rb +0 -60
- data/test/fixtures/cms/page_workflows.yml +0 -11
- data/test/helper.rb +0 -18
- data/test/test_cms-fortress.rb +0 -7
- data/test/unit/cms/fortress/role_detail_test.rb +0 -7
- data/test/unit/cms/fortress/role_test.rb +0 -7
- data/test/unit/cms/fortress/role_user_test.rb +0 -7
- data/test/unit/helpers/cms/fortress/roles_helper_test.rb +0 -4
- data/test/unit/helpers/cms/fortress/users_helper_test.rb +0 -4
@@ -1,17 +1,98 @@
|
|
1
1
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
2
|
|
3
|
+
admin_pages:
|
4
|
+
name: Pages
|
5
|
+
command: contents.pages
|
6
|
+
can_create: 1
|
7
|
+
can_update: 1
|
8
|
+
can_delete: 1
|
9
|
+
can_view: 1
|
10
|
+
role: Administrator
|
11
|
+
|
12
|
+
admin_files:
|
13
|
+
name: Files
|
14
|
+
command: contents.files
|
15
|
+
can_create: 1
|
16
|
+
can_update: 1
|
17
|
+
can_delete: 1
|
18
|
+
can_view: 1
|
19
|
+
role: Administrator
|
20
|
+
|
21
|
+
admin_page_review:
|
22
|
+
name: Page - Review
|
23
|
+
command: contents.page.review
|
24
|
+
can_create: 1
|
25
|
+
can_update: 1
|
26
|
+
can_delete: 1
|
27
|
+
can_view: 1
|
28
|
+
role: Administrator
|
29
|
+
|
30
|
+
admin_page_publish:
|
31
|
+
name: Page - Publish
|
32
|
+
command: contents.page.publish
|
33
|
+
can_create: 1
|
34
|
+
can_update: 1
|
35
|
+
can_delete: 1
|
36
|
+
can_view: 1
|
37
|
+
role: Administrator
|
38
|
+
|
39
|
+
admin_layouts:
|
40
|
+
name: Layouts
|
41
|
+
command: designs.layouts
|
42
|
+
can_create: 1
|
43
|
+
can_update: 1
|
44
|
+
can_delete: 1
|
45
|
+
can_view: 1
|
46
|
+
role: Administrator
|
47
|
+
|
48
|
+
admin_snippets:
|
49
|
+
name: Snippets
|
50
|
+
command: designs.snippets
|
51
|
+
can_create: 1
|
52
|
+
can_update: 1
|
53
|
+
can_delete: 1
|
54
|
+
can_view: 1
|
55
|
+
role: Administrator
|
56
|
+
|
57
|
+
admin_sites:
|
58
|
+
name: Sites
|
59
|
+
command: settings.sites
|
60
|
+
can_create: 1
|
61
|
+
can_update: 1
|
62
|
+
can_delete: 1
|
63
|
+
can_view: 1
|
64
|
+
role: Administrator
|
65
|
+
|
66
|
+
admin_roles:
|
67
|
+
name: Roles
|
68
|
+
command: settings.roles
|
69
|
+
can_create: 1
|
70
|
+
can_update: 1
|
71
|
+
can_delete: 1
|
72
|
+
can_view: 1
|
73
|
+
role: Administrator
|
74
|
+
|
75
|
+
admin_users:
|
76
|
+
name: Users
|
77
|
+
command: settings.users
|
78
|
+
can_create: 1
|
79
|
+
can_update: 1
|
80
|
+
can_delete: 1
|
81
|
+
can_view: 1
|
82
|
+
role: Administrator
|
83
|
+
|
3
84
|
one:
|
4
85
|
name: MyString
|
5
86
|
command: MyString
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
87
|
+
can_create: false
|
88
|
+
can_update: false
|
89
|
+
can_delete: false
|
90
|
+
can_view: false
|
10
91
|
|
11
92
|
two:
|
12
93
|
name: MyString
|
13
94
|
command: MyString
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
95
|
+
can_create: false
|
96
|
+
can_update: false
|
97
|
+
can_delete: false
|
98
|
+
can_view: false
|
@@ -1,9 +1,26 @@
|
|
1
1
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
2
|
|
3
|
+
Administrator:
|
4
|
+
name: Administrator
|
5
|
+
description: Administrator
|
6
|
+
site: default
|
7
|
+
|
8
|
+
Author:
|
9
|
+
name: Author
|
10
|
+
description: Author
|
11
|
+
site: default
|
12
|
+
|
13
|
+
Contributor:
|
14
|
+
name: Contributor
|
15
|
+
description: Contributor
|
16
|
+
site: default
|
17
|
+
|
3
18
|
one:
|
4
19
|
name: MyString
|
5
20
|
description: MyText
|
21
|
+
site: default
|
6
22
|
|
7
23
|
two:
|
8
24
|
name: MyString
|
9
25
|
description: MyText
|
26
|
+
site: default
|
@@ -0,0 +1,14 @@
|
|
1
|
+
one:
|
2
|
+
email: 'bla@blub.de'
|
3
|
+
encrypted_password: asdf<sdf
|
4
|
+
role: Administrator
|
5
|
+
reset_password_token: adsfgasd
|
6
|
+
reset_password_sent_at:
|
7
|
+
remember_created_at:
|
8
|
+
sign_in_count:
|
9
|
+
current_sign_in_at:
|
10
|
+
last_sign_in_at:
|
11
|
+
current_sign_in_ip:
|
12
|
+
last_sign_in_ip:
|
13
|
+
first_name: Harry
|
14
|
+
last_name: Belafonte
|
@@ -0,0 +1,12 @@
|
|
1
|
+
default_field_text:
|
2
|
+
blockable: default (Comfy::Cms::Page)
|
3
|
+
identifier: default_field_text
|
4
|
+
content: default_field_text_content
|
5
|
+
|
6
|
+
default_page_text:
|
7
|
+
blockable: default (Comfy::Cms::Page)
|
8
|
+
identifier: default_page_text
|
9
|
+
content: |-
|
10
|
+
default_page_text_content_a
|
11
|
+
{{cms:snippet:default}}
|
12
|
+
default_page_text_content_b
|
@@ -0,0 +1,40 @@
|
|
1
|
+
default:
|
2
|
+
site: default
|
3
|
+
label: Default Layout
|
4
|
+
identifier: default
|
5
|
+
parent:
|
6
|
+
content: |-
|
7
|
+
{{cms:field:default_field_text:text}}
|
8
|
+
layout_content_a
|
9
|
+
{{cms:page:default_page_text:text}}
|
10
|
+
layout_content_b
|
11
|
+
{{cms:snippet:default}}
|
12
|
+
layout_content_c
|
13
|
+
css: default_css
|
14
|
+
js: default_js
|
15
|
+
position: 0
|
16
|
+
|
17
|
+
nested:
|
18
|
+
site: default
|
19
|
+
label: Nested Layout
|
20
|
+
identifier: nested
|
21
|
+
parent:
|
22
|
+
content: |-
|
23
|
+
{{cms:page:header}}
|
24
|
+
{{cms:page:content}}
|
25
|
+
css: nested_css
|
26
|
+
js: nested_js
|
27
|
+
position: 0
|
28
|
+
|
29
|
+
child:
|
30
|
+
site: default
|
31
|
+
label: Child Layout
|
32
|
+
identifier: child
|
33
|
+
parent: nested
|
34
|
+
content: |-
|
35
|
+
{{cms:page:left_column}}
|
36
|
+
{{cms:page:right_column}}
|
37
|
+
css: child_css
|
38
|
+
js: child_js
|
39
|
+
position: 0
|
40
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
default:
|
2
|
+
site: default
|
3
|
+
parent:
|
4
|
+
target_page:
|
5
|
+
layout: default
|
6
|
+
label: Default Page
|
7
|
+
slug:
|
8
|
+
full_path: '/'
|
9
|
+
children_count: 1
|
10
|
+
position: 0
|
11
|
+
is_published: true
|
12
|
+
content_cache: |-
|
13
|
+
|
14
|
+
layout_content_a
|
15
|
+
default_page_text_content_a
|
16
|
+
default_snippet_content
|
17
|
+
default_page_text_content_b
|
18
|
+
layout_content_b
|
19
|
+
default_snippet_content
|
20
|
+
layout_content_c
|
21
|
+
|
22
|
+
child:
|
23
|
+
site: default
|
24
|
+
parent: default
|
25
|
+
target_page:
|
26
|
+
layout: default
|
27
|
+
label: Child Page
|
28
|
+
slug: 'child-page'
|
29
|
+
full_path: '/child-page'
|
30
|
+
children_count: 0
|
31
|
+
position: 0
|
32
|
+
is_published: true
|
33
|
+
content_cache: |-
|
34
|
+
|
35
|
+
layout_content_a
|
36
|
+
|
37
|
+
layout_content_b
|
38
|
+
default_snippet_content
|
39
|
+
layout_content_c
|
40
|
+
|
41
|
+
drafted:
|
42
|
+
site: default
|
43
|
+
parent:
|
44
|
+
target_page:
|
45
|
+
layout: default
|
46
|
+
label: Drafted Page
|
47
|
+
slug: 'drafted'
|
48
|
+
full_path: '/'
|
49
|
+
children_count: 1
|
50
|
+
position: 0
|
51
|
+
is_published: false
|
52
|
+
content_cache: |-
|
53
|
+
|
54
|
+
layout_content_a
|
55
|
+
default_page_text_content_a
|
56
|
+
default_snippet_content
|
57
|
+
default_page_text_content_b
|
58
|
+
layout_content_b
|
59
|
+
default_snippet_content
|
60
|
+
layout_content_c
|
61
|
+
aasm_state: drafted
|
62
|
+
|
63
|
+
reviewed:
|
64
|
+
site: default
|
65
|
+
parent:
|
66
|
+
target_page:
|
67
|
+
layout: default
|
68
|
+
label: Reviewed Page
|
69
|
+
slug: 'reviewed'
|
70
|
+
full_path: '/'
|
71
|
+
children_count: 0
|
72
|
+
position: 0
|
73
|
+
is_published: false
|
74
|
+
content_cache: |-
|
75
|
+
|
76
|
+
layout_content_a
|
77
|
+
default_page_text_content_a
|
78
|
+
default_snippet_content
|
79
|
+
default_page_text_content_b
|
80
|
+
layout_content_b
|
81
|
+
default_snippet_content
|
82
|
+
layout_content_c
|
83
|
+
aasm_state: reviewed
|
84
|
+
|
85
|
+
published:
|
86
|
+
site: default
|
87
|
+
parent:
|
88
|
+
target_page:
|
89
|
+
layout: default
|
90
|
+
label: Published Page
|
91
|
+
slug: 'published'
|
92
|
+
full_path: '/'
|
93
|
+
children_count: 0
|
94
|
+
position: 0
|
95
|
+
is_published: true
|
96
|
+
content_cache: |-
|
97
|
+
|
98
|
+
layout_content_a
|
99
|
+
default_page_text_content_a
|
100
|
+
default_snippet_content
|
101
|
+
default_page_text_content_b
|
102
|
+
layout_content_b
|
103
|
+
default_snippet_content
|
104
|
+
layout_content_c
|
105
|
+
aasm_state: published
|
@@ -0,0 +1,21 @@
|
|
1
|
+
layout:
|
2
|
+
record: default (Comfy::Cms::Layout)
|
3
|
+
data: <%= {
|
4
|
+
'content' => 'revision {{cms:page:default_page_text}}',
|
5
|
+
'css' => 'revision css',
|
6
|
+
'js' => 'revision js' }.to_yaml.inspect %>
|
7
|
+
|
8
|
+
page:
|
9
|
+
record: default (Comfy::Cms::Page)
|
10
|
+
data: <%= {
|
11
|
+
'blocks_attributes' => [
|
12
|
+
{ 'identifier' => 'default_page_text',
|
13
|
+
'content' => 'revision page content' },
|
14
|
+
{ 'identifier' => 'default_field_text',
|
15
|
+
'content' => 'revision field content'}
|
16
|
+
]}.to_yaml.inspect %>
|
17
|
+
|
18
|
+
snippet:
|
19
|
+
record: default (Comfy::Cms::Snippet)
|
20
|
+
data: <%= {
|
21
|
+
'content' => 'revision content' }.to_yaml.inspect %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# http://api.rubyonrails.org/classes/ActionDispatch/IntegrationTest.html
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class Cms::Fortress::UsersControllerIntegrationTest < ActionDispatch::IntegrationTest
|
5
|
+
setup do
|
6
|
+
@comfy_cms_site = comfy_cms_sites(:default)
|
7
|
+
end
|
8
|
+
|
9
|
+
test "it should redirect to login if unauthenticated" do
|
10
|
+
get "/cms-admin/"
|
11
|
+
follow_redirect!
|
12
|
+
follow_redirect!
|
13
|
+
assert_equal 200, status
|
14
|
+
assert_equal "/cms-admin/login", path
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Comfy::Cms::PageTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "new page can be drafted" do
|
6
|
+
@new = comfy_cms_pages(:default)
|
7
|
+
@new.draft
|
8
|
+
assert(@new.drafted?)
|
9
|
+
assert(!@new.is_published)
|
10
|
+
end
|
11
|
+
|
12
|
+
test "new page can be reviewed" do
|
13
|
+
@new = comfy_cms_pages(:default)
|
14
|
+
@new.review
|
15
|
+
assert(@new.reviewed?)
|
16
|
+
assert(!@new.is_published)
|
17
|
+
end
|
18
|
+
|
19
|
+
test "new page can be published" do
|
20
|
+
@new = comfy_cms_pages(:default)
|
21
|
+
@new.publish
|
22
|
+
assert(@new.published?)
|
23
|
+
assert(@new.is_published)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "drafted page can be reviewed" do
|
27
|
+
@drafted = comfy_cms_pages(:drafted)
|
28
|
+
@drafted.review
|
29
|
+
assert(@drafted.reviewed?)
|
30
|
+
assert(!@drafted.is_published)
|
31
|
+
end
|
32
|
+
|
33
|
+
test "drafted page can be published" do
|
34
|
+
@drafted = comfy_cms_pages(:drafted)
|
35
|
+
@drafted.publish
|
36
|
+
assert(@drafted.published?)
|
37
|
+
assert(@drafted.is_published)
|
38
|
+
end
|
39
|
+
|
40
|
+
test "reviewed page can be published" do
|
41
|
+
@reviewed = comfy_cms_pages(:reviewed)
|
42
|
+
assert(!@reviewed.is_published)
|
43
|
+
@reviewed.publish
|
44
|
+
assert(@reviewed.published?)
|
45
|
+
assert(@reviewed.is_published)
|
46
|
+
end
|
47
|
+
|
48
|
+
test "reviewed page can be resetted" do
|
49
|
+
@reviewed = comfy_cms_pages(:reviewed)
|
50
|
+
@reviewed.reset
|
51
|
+
assert(@reviewed.drafted?)
|
52
|
+
end
|
53
|
+
|
54
|
+
test "reviewed page can be drafted" do
|
55
|
+
@reviewed = comfy_cms_pages(:reviewed)
|
56
|
+
assert_raises (AASM::InvalidTransition) {
|
57
|
+
@reviewed.draft
|
58
|
+
}
|
59
|
+
assert(!@reviewed.is_published)
|
60
|
+
end
|
61
|
+
|
62
|
+
test "published page can be resetted" do
|
63
|
+
@published = comfy_cms_pages(:published)
|
64
|
+
@published.reset
|
65
|
+
assert(@published.drafted?)
|
66
|
+
assert(!@published.is_published)
|
67
|
+
end
|
68
|
+
|
69
|
+
test "published page can be drafted" do
|
70
|
+
@published = comfy_cms_pages(:published)
|
71
|
+
assert_raises (AASM::InvalidTransition) {
|
72
|
+
@published.draft
|
73
|
+
}
|
74
|
+
assert(@published.is_published)
|
75
|
+
end
|
76
|
+
|
77
|
+
test "published page cannot be reviewed" do
|
78
|
+
@published = comfy_cms_pages(:published)
|
79
|
+
assert_raises (AASM::InvalidTransition) {
|
80
|
+
@published.review
|
81
|
+
}
|
82
|
+
assert(@published.is_published)
|
83
|
+
end
|
84
|
+
end
|