cms-fortress 1.2.2 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +66 -0
  2. data/Gemfile +2 -17
  3. data/Gemfile.lock +80 -90
  4. data/README.rdoc +11 -0
  5. data/Rakefile +9 -39
  6. data/app/controllers/cms/fortress/admin_controller.rb +5 -0
  7. data/app/controllers/cms/fortress/roles_controller.rb +11 -21
  8. data/app/controllers/cms/fortress/users_controller.rb +48 -31
  9. data/app/helpers/cms/fortress/application_helper.rb +37 -5
  10. data/app/helpers/comfy/admin/cms/pages_helper.rb +22 -0
  11. data/app/models/cms/fortress/error.rb +17 -0
  12. data/app/models/cms/fortress/role.rb +2 -1
  13. data/app/models/cms/fortress/settings.rb +17 -0
  14. data/app/models/cms/fortress/user.rb +17 -0
  15. data/app/models/cms_ability.rb +29 -22
  16. data/app/views/cms/fortress/admin/dashboard.html.haml +12 -0
  17. data/app/views/cms/fortress/shared/_dashboard_widget.html.haml +29 -0
  18. data/app/views/cms/fortress/shared/_menu.html.haml +26 -26
  19. data/app/views/cms/fortress/shared/_navbar.html.haml +1 -1
  20. data/app/views/cms/fortress/shared/_page_extend.html.haml +3 -5
  21. data/app/views/cms/fortress/shared/_page_extend_js.html.haml +2 -14
  22. data/app/views/cms/fortress/themes/wide/_body.html.haml +9 -8
  23. data/app/views/cms/fortress/themes/wide/_menu.html.haml +70 -37
  24. data/app/views/cms/fortress/users/_form.html.haml +6 -1
  25. data/app/views/cms/fortress/users/edit.html.haml +1 -2
  26. data/app/views/cms/fortress/users/index.html.haml +14 -5
  27. data/app/views/cms/fortress/users/new.html.haml +1 -2
  28. data/app/views/comfy/admin/cms/pages/_form.html.haml +10 -4
  29. data/app/views/comfy/admin/cms/pages/edit.html.haml +25 -0
  30. data/app/views/layouts/comfy/admin/cms/_head.html.haml +1 -1
  31. data/app/views/layouts/comfy/admin/cms/_left.html.haml +15 -12
  32. data/bin/bundle +3 -0
  33. data/bin/rails +4 -0
  34. data/bin/rake +4 -0
  35. data/cms-fortress.gemspec +32 -171
  36. data/config.ru +4 -0
  37. data/config/application.rb +34 -0
  38. data/config/boot.rb +5 -0
  39. data/config/cms/fortress/global_settings.yml +12 -0
  40. data/config/cms_routes.rb +7 -0
  41. data/config/database.yml +11 -0
  42. data/config/environment.rb +5 -0
  43. data/config/environments/development.rb +29 -0
  44. data/config/environments/test.rb +36 -0
  45. data/config/initializers/devise.rb +256 -0
  46. data/config/initializers/secret_token.rb +14 -0
  47. data/config/locales/de.yml +28 -1
  48. data/config/locales/devise.en.yml +59 -0
  49. data/config/locales/en.yml +37 -1
  50. data/config/roles.yml +1 -0
  51. data/config/secrets.yml +14 -0
  52. data/db/migrate/06_add_type_to_users.rb +11 -0
  53. data/db/migrate/07_integrate_workflow_into_cms_pages.rb +37 -0
  54. data/db/schema.rb +182 -0
  55. data/lib/assets/.keep +0 -0
  56. data/lib/cms-fortress.rb +10 -1
  57. data/lib/cms/fortress/application_controller_methods.rb +5 -2
  58. data/lib/cms/fortress/page_methods.rb +52 -2
  59. data/lib/cms/fortress/pages_controller_methods.rb +17 -0
  60. data/lib/cms/fortress/rails/engine.rb +12 -3
  61. data/lib/cms/fortress/routes/admin.rb +9 -1
  62. data/lib/cms/fortress/site_methods.rb +29 -0
  63. data/lib/cms/fortress/sites_controller_methods.rb +22 -0
  64. data/lib/generators/cms/comfy/comfy_generator.rb +18 -0
  65. data/lib/generators/cms/fortress/fortress_generator.rb +30 -6
  66. data/lib/generators/cms/fortress/upgrade/USAGE +8 -0
  67. data/lib/generators/cms/fortress/upgrade/upgrade_generator.rb +24 -0
  68. data/lib/tasks/.keep +0 -0
  69. data/test/{functional → controllers}/cms/fortress/roles_controller_test.rb +9 -4
  70. data/test/{functional → controllers}/cms/fortress/users_controller_test.rb +10 -11
  71. data/test/controllers/comfy/admin/cms/pages_controller_test.rb +115 -0
  72. data/test/fixtures/cms/fortress/role_details.yml +89 -8
  73. data/test/fixtures/cms/fortress/roles.yml +17 -0
  74. data/test/fixtures/cms/fortress/users.yml +14 -0
  75. data/test/fixtures/comfy/cms/blocks.yml +12 -0
  76. data/test/fixtures/comfy/cms/categories.yml +4 -0
  77. data/test/fixtures/comfy/cms/categorizations.yml +3 -0
  78. data/test/fixtures/comfy/cms/files.yml +9 -0
  79. data/test/fixtures/comfy/cms/layouts.yml +40 -0
  80. data/test/fixtures/comfy/cms/pages.yml +105 -0
  81. data/test/fixtures/comfy/cms/revisions.yml +21 -0
  82. data/test/fixtures/comfy/cms/sites.yml +6 -0
  83. data/test/fixtures/comfy/cms/snippets.yml +6 -0
  84. data/test/integration/cms/fortress/users_controller_test.rb +16 -0
  85. data/test/models/comfy/cms/page_test.rb +84 -0
  86. data/test/models/comfy/cms/settings_test.rb +16 -0
  87. data/test/test_helper.rb +25 -0
  88. metadata +157 -23
  89. data/app/models/cms/page_workflow.rb +0 -44
  90. data/app/models/error/missing_role_configuration_file.rb +0 -12
  91. data/lib/generators/comfy/cms/cms_generator.rb +0 -60
  92. data/test/fixtures/cms/page_workflows.yml +0 -11
  93. data/test/helper.rb +0 -18
  94. data/test/test_cms-fortress.rb +0 -7
  95. data/test/unit/cms/fortress/role_detail_test.rb +0 -7
  96. data/test/unit/cms/fortress/role_test.rb +0 -7
  97. data/test/unit/cms/fortress/role_user_test.rb +0 -7
  98. data/test/unit/helpers/cms/fortress/roles_helper_test.rb +0 -4
  99. data/test/unit/helpers/cms/fortress/users_helper_test.rb +0 -4
data/.gitignore ADDED
@@ -0,0 +1,66 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ # jeweler generated
16
+ pkg
17
+
18
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
+ #
20
+ # * Create a file at ~/.gitignore
21
+ # * Include files you want ignored
22
+ # * Run: git config --global core.excludesfile ~/.gitignore
23
+ #
24
+ # After doing this, these files will be ignored in all your git projects,
25
+ # saving you from having to 'pollute' every project you touch with them
26
+ #
27
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
+ #
29
+ # For MacOS:
30
+ #
31
+ .DS_Store
32
+
33
+ .rbenv-gemsets
34
+ .ruby-version
35
+
36
+ # For TextMate
37
+ #*.tmproj
38
+ #tmtags
39
+
40
+ # For emacs:
41
+ #*~
42
+ #\#*
43
+ #.\#*
44
+
45
+ # For vim:
46
+ #*.swp
47
+
48
+ # For redcar:
49
+ #.redcar
50
+
51
+ # For rubinius:
52
+ #*.rbc
53
+
54
+ #For Rubymine
55
+ .idea
56
+
57
+ # Rails stuff
58
+ .rvmrc
59
+ db/test.sqlite3
60
+ log/
61
+ /tmp/cache
62
+ /.idea/
63
+
64
+ 00_create_cms.rb
65
+
66
+ /db/development.sqlite3
data/Gemfile CHANGED
@@ -1,18 +1,3 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- gem 'rails', '>=4.0.0'
4
- gem 'comfortable_mexican_sofa', '~>1.12.0'
5
- gem 'devise', '~>3.2'
6
- gem 'cancan', '>=1.6.9'
7
- gem 'delayed_job', '~>4'
8
- gem 'tinymce-rails', '~>4.0.0'
9
- gem 'tinymce-rails-langs', '~>4.0'
1
+ source "https://rubygems.org"
10
2
 
11
- # Add dependencies to develop your gem here.
12
- # Include everything needed to run rake, tests, features, etc.
13
- group :development do
14
- gem "rdoc"
15
- gem "bundler"
16
- gem "jeweler"
17
- gem "simplecov"
18
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,47 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cms-fortress (1.2.2)
5
+ aasm (~> 3.2)
6
+ cancan (>= 1.6.9)
7
+ comfortable_mexican_sofa (~> 1.12.0)
8
+ delayed_job (~> 4)
9
+ devise (~> 3.2)
10
+ rails (>= 4.0.0)
11
+ tinymce-rails (~> 4.0.0)
12
+ tinymce-rails-langs (~> 4.0)
13
+
1
14
  GEM
2
- remote: http://rubygems.org/
15
+ remote: https://rubygems.org/
3
16
  specs:
4
- actionmailer (4.1.1)
5
- actionpack (= 4.1.1)
6
- actionview (= 4.1.1)
17
+ aasm (3.2.0)
18
+ actionmailer (4.0.5)
19
+ actionpack (= 4.0.5)
7
20
  mail (~> 2.5.4)
8
- actionpack (4.1.1)
9
- actionview (= 4.1.1)
10
- activesupport (= 4.1.1)
21
+ actionpack (4.0.5)
22
+ activesupport (= 4.0.5)
23
+ builder (~> 3.1.0)
24
+ erubis (~> 2.7.0)
11
25
  rack (~> 1.5.2)
12
26
  rack-test (~> 0.6.2)
13
- actionview (4.1.1)
14
- activesupport (= 4.1.1)
15
- builder (~> 3.1)
16
- erubis (~> 2.7.0)
17
27
  active_link_to (1.0.2)
18
28
  actionpack
19
- activemodel (4.1.1)
20
- activesupport (= 4.1.1)
21
- builder (~> 3.1)
22
- activerecord (4.1.1)
23
- activemodel (= 4.1.1)
24
- activesupport (= 4.1.1)
25
- arel (~> 5.0.0)
26
- activesupport (4.1.1)
29
+ activemodel (4.0.5)
30
+ activesupport (= 4.0.5)
31
+ builder (~> 3.1.0)
32
+ activerecord (4.0.5)
33
+ activemodel (= 4.0.5)
34
+ activerecord-deprecated_finders (~> 1.0.2)
35
+ activesupport (= 4.0.5)
36
+ arel (~> 4.0.0)
37
+ activerecord-deprecated_finders (1.0.3)
38
+ activesupport (4.0.5)
27
39
  i18n (~> 0.6, >= 0.6.9)
28
- json (~> 1.7, >= 1.7.7)
29
- minitest (~> 5.1)
40
+ minitest (~> 4.2)
41
+ multi_json (~> 1.3)
30
42
  thread_safe (~> 0.1)
31
- tzinfo (~> 1.1)
32
- addressable (2.3.6)
33
- arel (5.0.1.20140414130214)
43
+ tzinfo (~> 0.3.37)
44
+ ansi (1.4.3)
45
+ arel (4.0.2)
34
46
  bcrypt (3.1.7)
35
47
  bootstrap-sass (3.1.1.1)
36
48
  sass (~> 3.2)
37
49
  bootstrap_form (2.1.1)
38
- builder (3.2.2)
50
+ builder (3.1.4)
39
51
  cancan (1.6.10)
40
52
  climate_control (0.0.3)
41
53
  activesupport (>= 3.0)
42
54
  cocaine (0.5.4)
43
55
  climate_control (>= 0.0.3, < 1.0)
44
- codemirror-rails (4.1)
56
+ codemirror-rails (4.2)
45
57
  railties (>= 3.0, < 5)
46
58
  coffee-rails (4.0.1)
47
59
  coffee-script (>= 2.2.0)
@@ -68,8 +80,6 @@ GEM
68
80
  tinymce-rails (>= 4.0.0)
69
81
  delayed_job (4.0.1)
70
82
  activesupport (>= 3.0, < 4.2)
71
- descendants_tracker (0.0.4)
72
- thread_safe (~> 0.3, >= 0.3.1)
73
83
  devise (3.2.4)
74
84
  bcrypt (~> 3.0)
75
85
  orm_adapter (~> 0.1)
@@ -78,18 +88,7 @@ GEM
78
88
  warden (~> 1.2.3)
79
89
  docile (1.1.3)
80
90
  erubis (2.7.0)
81
- execjs (2.1.0)
82
- faraday (0.9.0)
83
- multipart-post (>= 1.2, < 3)
84
- git (1.2.6)
85
- github_api (0.11.3)
86
- addressable (~> 2.3)
87
- descendants_tracker (~> 0.0.1)
88
- faraday (~> 0.8, < 0.10)
89
- hashie (>= 1.2)
90
- multi_json (>= 1.7.5, < 2.0)
91
- nokogiri (~> 1.6.0)
92
- oauth2
91
+ execjs (2.2.0)
93
92
  haml (4.0.5)
94
93
  tilt
95
94
  haml-rails (0.5.3)
@@ -97,27 +96,16 @@ GEM
97
96
  activesupport (>= 4.0.1)
98
97
  haml (>= 3.1, < 5.0)
99
98
  railties (>= 4.0.1)
100
- hashie (2.1.1)
101
- highline (1.6.21)
99
+ hashie (3.0.0)
102
100
  hike (1.2.3)
103
101
  i18n (0.6.9)
104
- jeweler (2.0.1)
105
- builder
106
- bundler (>= 1.0)
107
- git (>= 1.2.5)
108
- github_api
109
- highline (>= 1.6.15)
110
- nokogiri (>= 1.5.10)
111
- rake
112
- rdoc
113
102
  jquery-rails (3.1.0)
114
103
  railties (>= 3.0, < 5.0)
115
104
  thor (>= 0.14, < 2.0)
116
105
  jquery-ui-rails (4.2.1)
117
106
  railties (>= 3.2.16)
118
107
  json (1.8.1)
119
- jwt (1.0.0)
120
- kaminari (0.15.1)
108
+ kaminari (0.16.0)
121
109
  actionpack (>= 3.0.0)
122
110
  activesupport (>= 3.0.0)
123
111
  kramdown (1.3.3)
@@ -125,45 +113,49 @@ GEM
125
113
  mime-types (~> 1.16)
126
114
  treetop (~> 1.4.8)
127
115
  mime-types (1.25.1)
128
- mini_portile (0.6.0)
129
- minitest (5.3.4)
116
+ minitest (4.7.3)
117
+ minitest-rails (1.0.1)
118
+ minitest (~> 4.7)
119
+ minitest-test (~> 1.0)
120
+ railties (>= 3.0, < 4.1)
121
+ minitest-reporters (0.14.24)
122
+ ansi
123
+ builder
124
+ minitest (>= 2.12, < 5.0)
125
+ powerbar
126
+ minitest-spec-rails (4.7.7)
127
+ minitest (~> 4.7)
128
+ rails (>= 3.0, < 4.1)
129
+ minitest-test (1.1.0)
130
+ minitest (~> 4.0)
130
131
  multi_json (1.10.1)
131
- multi_xml (0.5.5)
132
- multipart-post (2.0.0)
133
- nokogiri (1.6.2.1)
134
- mini_portile (= 0.6.0)
135
- oauth2 (0.9.4)
136
- faraday (>= 0.8, < 0.10)
137
- jwt (~> 1.0)
138
- multi_json (~> 1.3)
139
- multi_xml (~> 0.5)
140
- rack (~> 1.2)
141
132
  orm_adapter (0.5.0)
142
133
  paperclip (4.1.1)
143
134
  activemodel (>= 3.0.0)
144
135
  activesupport (>= 3.0.0)
145
136
  cocaine (~> 0.5.3)
146
137
  mime-types
147
- polyglot (0.3.4)
138
+ polyglot (0.3.5)
139
+ powerbar (1.0.11)
140
+ ansi (~> 1.4.0)
141
+ hashie (>= 1.1.0)
148
142
  rack (1.5.2)
149
143
  rack-test (0.6.2)
150
144
  rack (>= 1.0)
151
- rails (4.1.1)
152
- actionmailer (= 4.1.1)
153
- actionpack (= 4.1.1)
154
- actionview (= 4.1.1)
155
- activemodel (= 4.1.1)
156
- activerecord (= 4.1.1)
157
- activesupport (= 4.1.1)
145
+ rails (4.0.5)
146
+ actionmailer (= 4.0.5)
147
+ actionpack (= 4.0.5)
148
+ activerecord (= 4.0.5)
149
+ activesupport (= 4.0.5)
158
150
  bundler (>= 1.3.0, < 2.0)
159
- railties (= 4.1.1)
160
- sprockets-rails (~> 2.0)
151
+ railties (= 4.0.5)
152
+ sprockets-rails (~> 2.0.0)
161
153
  rails-i18n (4.0.2)
162
154
  i18n (~> 0.6)
163
155
  rails (>= 4.0)
164
- railties (4.1.1)
165
- actionpack (= 4.1.1)
166
- activesupport (= 4.1.1)
156
+ railties (4.0.5)
157
+ actionpack (= 4.0.5)
158
+ activesupport (= 4.0.5)
167
159
  rake (>= 0.8.7)
168
160
  thor (>= 0.18.1, < 2.0)
169
161
  rake (10.3.2)
@@ -185,22 +177,22 @@ GEM
185
177
  multi_json (~> 1.0)
186
178
  rack (~> 1.0)
187
179
  tilt (~> 1.1, != 1.3.0)
188
- sprockets-rails (2.1.3)
180
+ sprockets-rails (2.0.1)
189
181
  actionpack (>= 3.0)
190
182
  activesupport (>= 3.0)
191
183
  sprockets (~> 2.8)
184
+ sqlite3 (1.3.9)
192
185
  thor (0.19.1)
193
186
  thread_safe (0.3.4)
194
187
  tilt (1.4.1)
195
- tinymce-rails (4.0.26)
188
+ tinymce-rails (4.0.28.1)
196
189
  railties (>= 3.1.1)
197
190
  tinymce-rails-langs (4.20140129)
198
191
  tinymce-rails (~> 4.0)
199
192
  treetop (1.4.15)
200
193
  polyglot
201
194
  polyglot (>= 0.3.1)
202
- tzinfo (1.2.0)
203
- thread_safe (~> 0.1)
195
+ tzinfo (0.3.39)
204
196
  warden (1.2.3)
205
197
  rack (>= 1.0)
206
198
 
@@ -209,13 +201,11 @@ PLATFORMS
209
201
 
210
202
  DEPENDENCIES
211
203
  bundler
212
- cancan (>= 1.6.9)
213
- comfortable_mexican_sofa (~> 1.12.0)
214
- delayed_job (~> 4)
215
- devise (~> 3.2)
216
- jeweler
217
- rails (>= 4.0.0)
204
+ cms-fortress!
205
+ minitest (~> 4.7.3)
206
+ minitest-rails
207
+ minitest-reporters
208
+ minitest-spec-rails
218
209
  rdoc
219
210
  simplecov
220
- tinymce-rails (~> 4.0.0)
221
- tinymce-rails-langs (~> 4.0)
211
+ sqlite3
data/README.rdoc CHANGED
@@ -104,6 +104,17 @@ http://raw.github.com/melvinsembrano/cms-fortress/master/docs/screens/files-inte
104
104
 
105
105
  For more Comfortable Mexican Sofa awesomeness visit the wiki page here https://github.com/comfy/comfortable-mexican-sofa/wiki
106
106
 
107
+ == Development & Testing
108
+
109
+ To run the tests you have to install the development files and run the migrations
110
+
111
+ rails generate cms:fortress --development
112
+ rake db:migrate
113
+
114
+ Afterwards you can run the tests by calling
115
+
116
+ rake test
117
+
107
118
  == Contributing to cms-fortress
108
119
 
109
120
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/Rakefile CHANGED
@@ -1,51 +1,21 @@
1
1
  # encoding: utf-8
2
-
3
- require 'rubygems'
4
2
  require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "cms-fortress"
18
- gem.homepage = "http://github.com/melvinsembrano/cms-fortress"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Comfortable Mexican Sofa (CMS) - User and role management extension}
21
- gem.description = %Q{Comfortable Mexican Sofa (CMS) - User and role management extension}
22
- gem.email = "melvinsembrano@gmail.com"
23
- gem.authors = ["Melvin Sembrano"]
24
- # dependencies defined in Gemfile
25
- gem.files.include 'lib/**/*.rb'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
3
+ Bundler.setup
28
4
 
29
5
  require 'rake/testtask'
30
- Rake::TestTask.new(:test) do |test|
31
- test.libs << 'lib' << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
6
+ require 'rdoc/task'
35
7
 
36
- =begin
37
- require 'rcov/rcovtask'
38
- Rcov::RcovTask.new do |test|
39
- test.libs << 'test'
40
- test.pattern = 'test/**/test_*.rb'
41
- test.verbose = true
42
- test.rcov_opts << '--exclude "gems/*"'
8
+ Rake::TestTask.new do |t|
9
+ t.libs << 'test'
10
+ t.test_files = FileList['test/**/*_test.rb']
11
+ t.verbose = false
43
12
  end
44
- =end
13
+
14
+ require_relative 'config/application'
15
+ Cms::Fortress::Application.load_tasks
45
16
 
46
17
  task :default => :test
47
18
 
48
- require 'rdoc/task'
49
19
  Rake::RDocTask.new do |rdoc|
50
20
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
21
 
@@ -1,4 +1,9 @@
1
1
  class Cms::Fortress::AdminController < Comfy::Admin::Cms::BaseController
2
+
3
+ def dashboard
4
+
5
+ end
6
+
2
7
  def roles
3
8
  @roles = Role.all
4
9
  end
@@ -2,23 +2,18 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
2
2
  before_filter do
3
3
  authorize! :manage, Cms::Fortress::Role
4
4
  end
5
+ before_action :set_role, only: [:show, :edit, :update, :destroy, :refresh]
5
6
 
6
7
  # GET /cms/fortress/roles
7
8
  # GET /cms/fortress/roles.json
8
9
  def index
9
- @cms_fortress_roles = Cms::Fortress::Role.all
10
-
11
- respond_to do |format|
12
- format.html # index.html.erb
13
- format.json { render json: @cms_fortress_roles }
14
- end
10
+ @cms_fortress_roles = @site.roles
15
11
  end
16
12
 
17
13
  # GET /cms/fortress/roles/1
18
14
  # GET /cms/fortress/roles/1.json
19
15
  def show
20
- @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
21
-
16
+ @no_back_button = true
22
17
  respond_to do |format|
23
18
  format.html # show.html.erb
24
19
  format.json { render json: @cms_fortress_role }
@@ -26,7 +21,7 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
26
21
  end
27
22
 
28
23
  def refresh
29
- @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
24
+ # @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
30
25
  @cms_fortress_role.load_defaults
31
26
 
32
27
  respond_to do |format|
@@ -43,26 +38,20 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
43
38
  # GET /cms/fortress/roles/new
44
39
  # GET /cms/fortress/roles/new.json
45
40
  def new
46
- @cms_fortress_role = Cms::Fortress::Role.new
47
-
48
- respond_to do |format|
49
- format.html # new.html.erb
50
- format.json { render json: @cms_fortress_role }
51
- end
41
+ @cms_fortress_role = @site.roles.build
52
42
  end
53
43
 
54
44
  # GET /cms/fortress/roles/1/edit
55
45
  def edit
56
- @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
57
46
  end
58
47
 
59
48
  # POST /cms/fortress/roles
60
49
  # POST /cms/fortress/roles.json
61
50
  def create
62
- @cms_fortress_role = Cms::Fortress::Role.new(role_params)
51
+ @cms_fortress_role = @site.roles.build(role_params)
63
52
  begin
64
53
  @cms_fortress_role.load_defaults
65
- rescue Error::MissingRoleConfigurationFile
54
+ rescue Cms::Fortress::Error::MissingRoleConfigurationFile
66
55
  flash[:error] = @cms_fortress_role.errors.messages[:base].first
67
56
  render action: "new" and return
68
57
  end
@@ -82,8 +71,6 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
82
71
  # PUT /cms/fortress/roles/1
83
72
  # PUT /cms/fortress/roles/1.json
84
73
  def update
85
- @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
86
-
87
74
  respond_to do |format|
88
75
  if @cms_fortress_role.update_attributes(role_params)
89
76
  flash[:success] = "Role was successfully updated."
@@ -99,7 +86,6 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
99
86
  # DELETE /cms/fortress/roles/1
100
87
  # DELETE /cms/fortress/roles/1.json
101
88
  def destroy
102
- @cms_fortress_role = Cms::Fortress::Role.find(params[:id])
103
89
  @cms_fortress_role.destroy
104
90
 
105
91
  respond_to do |format|
@@ -110,6 +96,10 @@ class Cms::Fortress::RolesController < Comfy::Admin::Cms::BaseController
110
96
 
111
97
  private
112
98
 
99
+ def set_role
100
+ @cms_fortress_role = @site.roles.where(id: params[:id]).first
101
+ end
102
+
113
103
  def role_params
114
104
  params.require(:cms_fortress_role).permit! #(:name, :description, :role_details_attributes)
115
105
  end