rich_cms 2.1.7 → 3.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 (179) hide show
  1. data/{CHANGELOG → CHANGELOG.rdoc} +24 -0
  2. data/README.textile +49 -33
  3. data/Rakefile +92 -10
  4. data/VERSION +1 -1
  5. data/app/controllers/rich/cms_controller.rb +10 -39
  6. data/app/controllers/rich/cms_sessions_controller.rb +31 -0
  7. data/app/views/rich/cms/dock/_menu.html.erb +10 -8
  8. data/app/views/rich/cms/dock/_panel.html.erb +1 -1
  9. data/app/views/rich/cms/dock/panel/edit/_rails2.html.erb +5 -3
  10. data/app/views/rich/cms/dock/panel/edit/_rails3.html.erb +4 -2
  11. data/app/views/rich/cms/dock/panel/login/_rails2.html.erb +18 -12
  12. data/app/views/rich/cms/dock/panel/login/_rails3.html.erb +18 -12
  13. data/app/views/rich_cms.html.erb +1 -1
  14. data/assets/jzip/jquery/cleditor.js +1132 -1132
  15. data/assets/jzip/jquery/extensions/browser_detect.js +1 -2
  16. data/assets/jzip/native/extensions.js +41 -0
  17. data/assets/jzip/rich/cms/editor.js +41 -7
  18. data/assets/jzip/rich_cms.jz +2 -1
  19. data/assets/sass/rich_cms/_panel.sass +11 -1
  20. data/config/routes.rb +12 -11
  21. data/lib/generators/rich/cms_admin/cms_admin_generator.rb +82 -0
  22. data/lib/generators/rich/{authlogic_user/templates → cms_admin/templates/authlogic}/migration.rb +0 -0
  23. data/lib/generators/rich/{authlogic_user/templates → cms_admin/templates/authlogic}/model.rb +0 -0
  24. data/lib/generators/rich/{authlogic_user/templates → cms_admin/templates/authlogic}/session.rb +0 -0
  25. data/lib/rich/cms/actionpack/action_controller/base.rb +3 -44
  26. data/lib/rich/cms/actionpack/action_view/base.rb +32 -10
  27. data/lib/rich/cms/actionpack.rb +1 -2
  28. data/lib/rich/cms/auth.rb +110 -0
  29. data/lib/rich/cms/content/group.rb +1 -2
  30. data/lib/rich/cms/content/item.rb +2 -3
  31. data/lib/rich/cms/core/string/html_safe.rb +1 -2
  32. data/lib/rich/cms/core/string.rb +1 -2
  33. data/lib/rich/cms/engine.rb +23 -51
  34. data/lib/rich/cms/rails/engine.rb +1 -2
  35. data/lib/rich/cms/version.rb +11 -0
  36. data/lib/rich_cms.rb +2 -2
  37. data/rails_generators/rich_cms_admin/lib/devise/route_devise.rb +32 -0
  38. data/rails_generators/rich_cms_admin/rich_cms_admin_generator.rb +113 -0
  39. data/rails_generators/{rich_authlogic_user/templates → rich_cms_admin/templates/authlogic}/migration.rb +0 -0
  40. data/rails_generators/{rich_authlogic_user/templates → rich_cms_admin/templates/authlogic}/model.rb +0 -0
  41. data/rails_generators/{rich_authlogic_user/templates → rich_cms_admin/templates/authlogic}/session.rb +0 -0
  42. data/rails_generators/{rich_authlogic_user → rich_cms_admin}/templates/config.rb +0 -0
  43. data/rails_generators/rich_cms_admin/templates/devise/README +23 -0
  44. data/rails_generators/rich_cms_admin/templates/devise/devise.rb +105 -0
  45. data/rails_generators/rich_cms_admin/templates/devise/en.yml +35 -0
  46. data/rails_generators/rich_cms_admin/templates/devise/migration.rb +23 -0
  47. data/rails_generators/rich_cms_admin/templates/devise/model.rb +9 -0
  48. data/rails_generators/rich_cms_content/rich_cms_content_generator.rb +18 -12
  49. data/rich_cms.gemspec +295 -105
  50. data/test/integrator.rb +89 -0
  51. data/test/rails-2/dummy/.bundle/config +2 -0
  52. data/test/rails-2/dummy/Gemfile +15 -0
  53. data/test/rails-2/dummy/Gemfile.lock +97 -0
  54. data/test/rails-2/dummy/Rakefile +10 -0
  55. data/test/rails-2/dummy/app/controllers/application_controller.rb +10 -0
  56. data/test/rails-2/dummy/app/helpers/application_helper.rb +3 -0
  57. data/test/rails-2/dummy/config/boot.rb +124 -0
  58. data/test/rails-2/dummy/config/database.yml +23 -0
  59. data/test/rails-2/dummy/config/environment.rb +41 -0
  60. data/test/rails-2/dummy/config/environments/development.rb +17 -0
  61. data/test/rails-2/dummy/config/environments/production.rb +28 -0
  62. data/test/rails-2/dummy/config/environments/test.rb +28 -0
  63. data/test/rails-2/dummy/config/initializers/backtrace_silencers.rb +7 -0
  64. data/test/rails-2/dummy/config/initializers/cookie_verification_secret.rb +7 -0
  65. data/test/rails-2/dummy/config/initializers/devise.rb +105 -0
  66. data/test/rails-2/dummy/config/initializers/enrichments.rb +5 -0
  67. data/test/rails-2/dummy/config/initializers/inflections.rb +10 -0
  68. data/test/rails-2/dummy/config/initializers/mime_types.rb +5 -0
  69. data/test/rails-2/dummy/config/initializers/new_rails_defaults.rb +21 -0
  70. data/test/rails-2/dummy/config/initializers/session_store.rb +15 -0
  71. data/test/rails-2/dummy/config/locales/en.yml +5 -0
  72. data/test/rails-2/dummy/config/preinitializer.rb +20 -0
  73. data/test/rails-2/dummy/config/routes.rb +44 -0
  74. data/test/rails-2/dummy/db/schema.rb +49 -0
  75. data/test/rails-2/dummy/db/seeds.rb +10 -0
  76. data/test/rails-2/dummy/public/404.html +30 -0
  77. data/test/rails-2/dummy/public/422.html +30 -0
  78. data/test/rails-2/dummy/public/500.html +30 -0
  79. data/test/rails-2/dummy/public/favicon.ico +0 -0
  80. data/test/rails-2/dummy/public/images/rails.png +0 -0
  81. data/test/rails-2/dummy/public/images/rich/cms/cleditor/buttons.gif +0 -0
  82. data/test/rails-2/dummy/public/images/rich/cms/cleditor/toolbar.gif +0 -0
  83. data/test/rails-2/dummy/public/javascripts/jquery/core.js +158 -0
  84. data/test/rails-2/dummy/public/javascripts/jquery/ui/rich_cms/core.js +1207 -0
  85. data/test/rails-2/dummy/public/javascripts/jquery/ui/rich_cms/draggable.js +798 -0
  86. data/test/rails-2/dummy/public/javascripts/jquery/ui/rich_cms/mouse.js +950 -0
  87. data/test/rails-2/dummy/public/javascripts/jquery/ui/rich_cms/widget.js +1188 -0
  88. data/test/rails-2/dummy/public/javascripts/rich_cms.js +1746 -0
  89. data/test/rails-2/dummy/public/robots.txt +5 -0
  90. data/test/rails-2/dummy/script/about +4 -0
  91. data/test/rails-2/dummy/script/console +3 -0
  92. data/test/rails-2/dummy/script/dbconsole +3 -0
  93. data/test/rails-2/dummy/script/destroy +3 -0
  94. data/test/rails-2/dummy/script/generate +3 -0
  95. data/test/rails-2/dummy/script/performance/benchmarker +3 -0
  96. data/test/rails-2/dummy/script/performance/profiler +3 -0
  97. data/test/rails-2/dummy/script/plugin +3 -0
  98. data/test/rails-2/dummy/script/runner +3 -0
  99. data/test/rails-2/dummy/script/server +3 -0
  100. data/test/rails-2/dummy/test/fixtures/authlogic_users.yml +6 -0
  101. data/test/rails-2/dummy/test/fixtures/devise_users.yml +5 -0
  102. data/test/rails-2/pending.rb +88 -0
  103. data/test/rails-2/test_helper.rb +13 -0
  104. data/test/rails-3/dummy/.bundle/config +2 -0
  105. data/test/rails-3/dummy/Gemfile +15 -0
  106. data/test/rails-3/dummy/Gemfile.lock +139 -0
  107. data/test/rails-3/dummy/Rakefile +7 -0
  108. data/test/rails-3/dummy/app/controllers/application_controller.rb +3 -0
  109. data/test/rails-3/dummy/app/helpers/application_helper.rb +2 -0
  110. data/test/rails-3/dummy/config/application.rb +42 -0
  111. data/test/rails-3/dummy/config/boot.rb +13 -0
  112. data/test/rails-3/dummy/config/database.yml +23 -0
  113. data/test/rails-3/dummy/config/environment.rb +5 -0
  114. data/test/rails-3/dummy/config/environments/development.rb +26 -0
  115. data/test/rails-3/dummy/config/environments/production.rb +49 -0
  116. data/test/rails-3/dummy/config/environments/test.rb +35 -0
  117. data/test/rails-3/dummy/config/initializers/backtrace_silencers.rb +7 -0
  118. data/test/rails-3/dummy/config/initializers/devise.rb +142 -0
  119. data/test/rails-3/dummy/config/initializers/enrichments.rb +5 -0
  120. data/test/rails-3/dummy/config/initializers/inflections.rb +10 -0
  121. data/test/rails-3/dummy/config/initializers/mime_types.rb +5 -0
  122. data/test/rails-3/dummy/config/initializers/secret_token.rb +7 -0
  123. data/test/rails-3/dummy/config/initializers/session_store.rb +8 -0
  124. data/test/rails-3/dummy/config/locales/en.yml +5 -0
  125. data/test/rails-3/dummy/config/routes.rb +59 -0
  126. data/test/rails-3/dummy/config.ru +4 -0
  127. data/test/rails-3/dummy/db/schema.rb +49 -0
  128. data/test/rails-3/dummy/db/seeds.rb +10 -0
  129. data/test/rails-3/dummy/public/404.html +26 -0
  130. data/test/rails-3/dummy/public/422.html +26 -0
  131. data/test/rails-3/dummy/public/500.html +26 -0
  132. data/test/rails-3/dummy/public/favicon.ico +0 -0
  133. data/test/rails-3/dummy/public/images/rich/cms/cleditor/buttons.gif +0 -0
  134. data/test/rails-3/dummy/public/images/rich/cms/cleditor/toolbar.gif +0 -0
  135. data/test/rails-3/dummy/public/javascripts/jquery/core.js +158 -0
  136. data/test/rails-3/dummy/public/javascripts/jquery/ui/rich_cms/core.js +1207 -0
  137. data/test/rails-3/dummy/public/javascripts/jquery/ui/rich_cms/draggable.js +798 -0
  138. data/test/rails-3/dummy/public/javascripts/jquery/ui/rich_cms/mouse.js +950 -0
  139. data/test/rails-3/dummy/public/javascripts/jquery/ui/rich_cms/widget.js +1188 -0
  140. data/test/rails-3/dummy/public/javascripts/rich_cms.js +1746 -0
  141. data/test/rails-3/dummy/script/rails +6 -0
  142. data/test/rails-3/dummy/test/fixtures/authlogic_users.yml +6 -0
  143. data/test/rails-3/dummy/test/fixtures/devise_users.yml +5 -0
  144. data/test/rails-3/test_helper.rb +17 -0
  145. data/test/shared/dummy/db/schema.rb +49 -0
  146. data/test/shared/dummy/db/seeds.rb +10 -0
  147. data/test/shared/dummy/fixtures/authlogic_users.yml +6 -0
  148. data/test/shared/dummy/models/authlogic_user.rb +8 -0
  149. data/test/shared/dummy/models/authlogic_user_session.rb +10 -0
  150. data/test/shared/dummy/models/cms_content.rb +2 -0
  151. data/test/shared/dummy/models/devise_user.rb +3 -0
  152. data/test/shared/dummy/stylesheets/app.css +100 -0
  153. data/test/shared/dummy/stylesheets/rich_cms.css +159 -0
  154. data/test/shared/dummy/views/application/index.html.erb +13 -0
  155. data/test/shared/dummy/views/layouts/application.html.erb +12 -0
  156. data/test/shared/support/action_controller/integration.rb +55 -0
  157. data/test/shared/support/action_controller/test_case.rb +28 -0
  158. data/test/shared/support/capybara/setup.rb +14 -0
  159. data/test/shared/support/test_helper.rb +1 -0
  160. data/test/shared/tests/actionpack/action_controller/base_test.rb +14 -0
  161. data/test/shared/tests/actionpack/action_view/base_test.rb +19 -0
  162. data/test/shared/tests/activesupport/active_support/dependencies_test.rb +15 -0
  163. data/test/shared/tests/app/integration/authenticated/authlogic.rb +88 -0
  164. data/test/shared/tests/app/integration/authenticated/devise_test.rb +89 -0
  165. data/test/shared/tests/app/integration/non_authenticated.rb +63 -0
  166. data/test/shared/tests/app/routing_test.rb +31 -0
  167. data/test/shared/tests/auth_test.rb +11 -0
  168. data/test/shared/tests/content/group.rb +10 -0
  169. data/test/shared/tests/content/item.rb +10 -0
  170. data/test/shared/tests/core/string/html_safe.rb +15 -0
  171. data/test/shared/tests/dummy_app.rb +228 -0
  172. data/test/shared/tests/engine_test.rb +19 -0
  173. data/test/shared/tests/rails/engine_test.rb +13 -0
  174. data/test/shared/tests/readme_test.rb +13 -0
  175. metadata +231 -63
  176. data/.gitignore +0 -2
  177. data/lib/generators/rich/authlogic_user/authlogic_user_generator.rb +0 -64
  178. data/rails_generators/rich_authlogic_user/rich_authlogic_user_generator.rb +0 -64
  179. data/test/test_helper.rb +0 -6
@@ -1,5 +1,29 @@
1
1
  = Rich-CMS CHANGELOG
2
2
 
3
+ == Version 3.0.0 (February 7, 2011)
4
+
5
+ * Refactored the authentication code. Being able to run Rich-CMS with:
6
+ - no authentication
7
+ - Devise 1.0.9 (for Rails 2)
8
+ - Devise 1.1.5 (for Rails 3)
9
+ - Authlogic 2.1.6
10
+ * Altered configurating the authentication setup
11
+ * Altered the login/logout Rich-CMS routes
12
+ * Altered the admin generator (this was rich:autlogic_user at first, but it is rich:cms_admin from now on)
13
+ * Updated gem dependencies (not using Formtastic and Authlogic anymore)
14
+ * Improved the test suite. Being able to test Rich-CMS with:
15
+ - Rails 2 without authentication
16
+ - Rails 2 with Devise 1.0.9
17
+ - Rails 2 with Authlogic 2.1.6
18
+ - Rails 3 without authentication
19
+ - Rails 3 with Devise 1.1.5
20
+ - Rails 3 with Authlogic 2.1.6
21
+ - All tests include testing the Rails generators and migrating the test database (woot!)
22
+ - Added very handy rake tasks for testing
23
+ - Outputting extra info during integration tests
24
+ * Altered file encoding of cleditor.js which removes the weird characters within rich_cms.js
25
+ * Implemented Array.indexOf for our IE friends. Thanks Mark Mulder (@bitterzoet) for contributing
26
+
3
27
  == Version 2.1.7 (November 24, 2010)
4
28
 
5
29
  * Fixed loading the correct config/routes.rb when using a Rails 2 application with another gem / plugin also containing config/routes.rb
data/README.textile CHANGED
@@ -20,7 +20,7 @@ Add Rich-CMS in @Gemfile@ as a gem dependency:
20
20
  Run the following in your console to install with Bundler:
21
21
 
22
22
  <pre>
23
- sudo bundle install
23
+ bundle install
24
24
  </pre>
25
25
 
26
26
  h3. Using Rich-CMS as gem in Rails 2
@@ -37,53 +37,59 @@ Run the following in your console:
37
37
  sudo rake gems:install
38
38
  </pre>
39
39
 
40
- h3. Using Rich-CMS as plugin in Rails 3
41
-
42
- <pre>
43
- rails plugin install git://github.com/archan937/rich_cms.git
44
- </pre>
45
-
46
- h3. Using Rich-CMS as plugin in Rails 2
47
-
48
- <pre>
49
- script/plugin install git://github.com/archan937/rich_cms.git
50
- </pre>
51
-
52
40
  h2. Use the provided Rails generators
53
41
 
54
- Rich-CMS requires two entities:
42
+ Rich-CMS requires one entity:
55
43
 
56
- * An @Authlogic@ authenticated user model
57
44
  * An @ActiveRecord@ model used for CMS content storage
58
45
 
59
- Fortunately, Rich-CMS is provided with two Rails generators with which you can generate both entities.
46
+ For (optional) authentication, Rich-CMS requires one of the following:
47
+
48
+ * A @Devise@ authenticated admin model
49
+ * A @Authlogic@ authenticated admin model
60
50
 
61
- h3. Authlogic user
51
+ Fortunately, Rich-CMS is provided with two Rails generators with which you can generate those entities.
52
+
53
+ h3. CMS admin
62
54
 
63
55
  h4. In Rails 3
64
56
 
65
57
  Run the following in your console:
66
58
 
67
59
  <pre>
68
- rails g rich:authlogic_user -m
60
+ rails g rich:cms_admin -m
69
61
  </pre>
70
62
 
71
- *Note*: At default, it will create both the @User@ and @UserSession@ classes and @CreateUsers@ migration. You can alter the class names with the following:
63
+ *Note*: At default, it will create a ("Devise":http://github.com/plataformatec/devise powered) @User@ model, the @CreateUsers@ migration and it will configure your routes.
64
+
65
+ You can alter the class name as follows:
72
66
 
73
67
  <pre>
74
- rails g rich:authlogic_user CodeHeroes::User -m
68
+ rails g rich:cms_admin CodeHeroes::User -m
75
69
  </pre>
76
70
 
77
71
  *Note*: Both generators have the @-m@ or @--migrate@ option which runs @rake db:migrate@ after creating the files.
78
72
 
73
+ *Using Authlogic*
74
+
75
+ You can use Authlogic by specifying the @-a@ or @--authlogic@ option:
76
+
77
+ <pre>
78
+ rails g rich:cms_admin CodeHeroes::User -a -m
79
+ </pre>
80
+
81
+ *Note*: As mentioned earlier, Devise is the default authentication logic. Having that said, you can explicitly specify Devise with the @-d@ or @--devise@ option.
82
+
79
83
  h4. In Rails 2
80
84
 
81
85
  Run the following in your console:
82
86
 
83
87
  <pre>
84
- script/generate rich_authlogic_user -m
88
+ script/generate rich_cms_admin -m
85
89
  </pre>
86
90
 
91
+ *Attention*: The @Devise@ Rails generator code is (practically) a copy of the "Devise 1.0.9 generator code":https://github.com/plataformatec/devise/tree/v1.0.9/generators/devise. For there are problems calling the original Devise generators in Rails 2. See also this "Stackoverflow issue":http://stackoverflow.com/questions/3366508/couldnt-find-devise-install-generator-rails-2-3-8-devise-1-0-8.
92
+
87
93
  h3. CMS content
88
94
 
89
95
  h4. In Rails 3
@@ -114,13 +120,22 @@ h2. Create required entities manually
114
120
 
115
121
  h3. Specify the authentication mechanism
116
122
 
117
- Provide the mechanism as a symbol (e.g. @:authlogic@) and the authenticated class along with the attribute used to identify the instance in a hash.
123
+ Rich-CMS can be used without an authentication mechanism (which is the default by the way), you just have to open "/cms" in your browser and you are ready to go. But it is common to have authentication and Rich-CMS support "Devise":http://github.com/plataformatec/devise and "Authlogic":http://github.com/binarylogic/authlogic.
124
+
125
+ Provide the authentication logic as a symbol (e.g. @:devise@) and the authenticated class like this:
118
126
 
119
127
  <pre>
120
- Rich::Cms::Engine.authenticate(:authlogic, {:class_name => "User", :identifier => :email})
128
+ Rich::Cms::Auth.setup do |config|
129
+ config.logic = :devise
130
+ config.klass = "User"
131
+ end
121
132
  </pre>
122
133
 
123
- Unfortunately, only AuthLogic ("http://github.com/binarylogic/authlogic":http://github.com/binarylogic/authlogic) is supported, but we are working hard on making Rich-CMS compatible with other mechanisms.
134
+ The following specifications are optional as Rich-Cms uses defaults:
135
+
136
+ * @:inputs@ (default: @[:email, :password]@) - The attributes used for the login panel of Rich-CMS
137
+ * @:identifier@ (default: based on @inputs@) - The method used for displaying the identity of the current Rich-CMS admin (this is the first entry of @inputs@, so usually @:email@)
138
+ * @:current_admin_method@ (default: based on @klass@) - The controller method used to retrieve the current Rich-CMS admin (e.g. @current_user@ when configured @User@ as authenticated class)
124
139
 
125
140
  h3. Register CMS content
126
141
 
@@ -157,25 +172,25 @@ Add the following line at the beginning of the @<body>@ tag:
157
172
 
158
173
  h3. Use the Rich-CMS helper method
159
174
 
160
- Rich-CMS requires a rendered DOM element provided with meta data of the content instance. Fortunately, you can call a method provided by Rich-CMS. Just specify the identifier of the content type and the key of the CMS content instance in question:
175
+ Rich-CMS requires a rendered DOM element provided with meta data of the content instance. Fortunately, you can call a helper method to render Rich-CMS content tags. Just specify the identifier of the content type and the key of the CMS content instance in question:
161
176
 
162
177
  <pre>
163
178
  >> key = "test_content"
164
179
  => "test_content"
165
- >> Rich::Cms::Engine.to_content_tag(".cms_content", key)
180
+ >> rich_cms_tag(".cms_content", key)
166
181
  => "<div class='cms_content' data-key='test_content' data-value='Hello world!'>Hello world!</div>"
167
182
  </pre>
168
183
 
169
184
  When using a combined key for content identification, just call it as follows:
170
185
 
171
186
  <pre>
172
- >> Rich::Cms::Engine.to_content_tag(".cms_content", {:key => key, :locale => I18n.locale})
187
+ >> rich_cms_tag(".cms_content", {:key => key, :locale => I18n.locale})
173
188
  => "<div class='cms_content' data-key='test_content' data-locale='nl' data-value='Hallo wereld!'>Hallo wereld!</div>"
174
189
  </pre>
175
190
 
176
191
  *Note*: In this case, the content was registered with @Rich::Cms::Engine.register(".cms_content", {:class_name => "Cms::StaticContent", :key => [:key, :locale]})@
177
192
 
178
- We have also provided you a helper method to render Rich-CMS content tags. It is provided with several options:
193
+ The helper method is provided with the following options:
179
194
 
180
195
  * @:as@ (default: auto-determine @:string@ or @:text@) - Specify the input type shown in the edit form (@:string@ for an input text, @:text@ for a textarea and @:html@ for a WYSIWYG HTML editor).
181
196
  * @:tag@ (default: auto-determine @:div@ or @:span@) - The HTML tag used for content items.
@@ -231,11 +246,11 @@ This Rails gem / plugin depends on:
231
246
  jQuery<br>
232
247
  "http://jquery.com":http://jquery.com
233
248
 
234
- AuthLogic<br>
235
- "http://github.com/binarylogic/authlogic":http://github.com/binarylogic/authlogic
249
+ Devise (optional)<br>
250
+ "http://github.com/plataformatec/devise":http://github.com/plataformatec/devise
236
251
 
237
- Formtastic<br>
238
- "http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic
252
+ AuthLogic (optional)<br>
253
+ "http://github.com/binarylogic/authlogic":http://github.com/binarylogic/authlogic
239
254
 
240
255
  SASS<br>
241
256
  "http://sass-lang.com":http://sass-lang.com
@@ -262,9 +277,10 @@ Stephan Kaag - "@stephankaag":http://twitter.com/stephankaag - "http://hollandon
262
277
 
263
278
  h2. ToDo's
264
279
 
280
+ * Support alternative ORM's and key/value stores (with "Toystore":https://github.com/newtoy/toystore and "Moneta":https://github.com/wycats/moneta probably)
281
+ * Check out compatibility with Devise 1.2.0
265
282
  * Provide better conventions for content rendering
266
283
  * Provide tools to use Textile, MarkDown, image files upload and models (e.g. products)
267
- * Provide compatibility with other authentication mechanisms other than AuthLogic
268
284
  * Add cache feature which uses the standard Rails cache (rich_cms_tag ".cms_content", "test_content", :cache => true)
269
285
 
270
286
  h2. Enrichments
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rake"
2
2
  require "rake/testtask"
3
3
  require "rake/rdoctask"
4
+ require "test/integrator"
4
5
 
5
6
  begin
6
7
  require "jeweler"
@@ -12,10 +13,8 @@ begin
12
13
  gemspec.homepage = "http://codehero.es/rails_gems_plugins/rich_cms"
13
14
  gemspec.author = "Paul Engel"
14
15
 
15
- gemspec.add_dependency "authlogic" , ">= 2.1.2"
16
- gemspec.add_dependency "formtastic", ">= 1.1.0"
17
- gemspec.add_dependency "haml" , ">= 3"
18
- gemspec.add_dependency "jzip" , ">= 1.0.11"
16
+ gemspec.add_dependency "haml", "~> 3.0.25"
17
+ gemspec.add_dependency "jzip", "~> 1.0.11"
19
18
  end
20
19
  Jeweler::GemcutterTasks.new
21
20
  rescue LoadError
@@ -25,12 +24,94 @@ end
25
24
  desc "Default: run unit tests."
26
25
  task :default => :test
27
26
 
28
- desc "Test the rich_cms plugin."
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << "lib"
31
- t.libs << "test"
32
- t.pattern = "test/**/*_test.rb"
33
- t.verbose = true
27
+ task :test do
28
+ Rake::Task["test:all"].execute
29
+ end
30
+
31
+ task :restore do
32
+ Rake::Task["restore:all"].execute
33
+ end
34
+
35
+ task :stash do
36
+ Rake::Task["stash:all"].execute
37
+ end
38
+
39
+ namespace :test do
40
+ desc "Test the rich_cms plugin in Rails 2 and 3."
41
+ task :all do
42
+ system "rake test:rails-2"
43
+ system "rake test:rails-3"
44
+ end
45
+ desc "Test the rich_cms plugin in Rails 2."
46
+ Rake::TestTask.new(:"rails-2") do |t|
47
+ t.libs << "lib"
48
+ t.libs << "test"
49
+ t.pattern = "test/rails-2/{,/*/**}/*_test.rb"
50
+ t.verbose = true
51
+ end
52
+ desc "Test the rich_cms plugin in Rails 3."
53
+ Rake::TestTask.new(:"rails-3") do |t|
54
+ t.libs << "lib"
55
+ t.libs << "test"
56
+ t.pattern = "test/rails-3/{,/*/**}/*_test.rb"
57
+ t.verbose = true
58
+ end
59
+ desc "Run all integration tests (non-authenticated, with Devise, with Authlogic) in Rails 2 and 3."
60
+ task :integration do
61
+ Integrator.run do |test|
62
+ test.all
63
+ end
64
+ end
65
+ namespace :integration do
66
+ desc "Run all integration tests (non-authenticated, with Devise, with Authlogic) in Rails 2."
67
+ task :"rails-2" do
68
+ Integrator.run do |test|
69
+ test.rails 2
70
+ end
71
+ end
72
+ desc "Run all integration tests (non-authenticated, with Devise, with Authlogic) in Rails 3."
73
+ task :"rails-3" do
74
+ Integrator.run do |test|
75
+ test.rails 2
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ namespace :restore do
82
+ desc "Restore the Rails 2 and 3 dummy apps."
83
+ task :all do
84
+ system "rake restore:rails-2"
85
+ system "rake restore:rails-3"
86
+ end
87
+ desc "Restore the Rails 2 dummy app."
88
+ task :"rails-2" do
89
+ require "test/rails-2/rich_cms/dummy_app.rb"
90
+ DummyApp.restore_all
91
+ end
92
+ desc "Restore the Rails 3 dummy app."
93
+ task :"rails-3" do
94
+ require "test/rails-3/rich_cms/dummy_app.rb"
95
+ DummyApp.restore_all
96
+ end
97
+ end
98
+
99
+ namespace :stash do
100
+ desc "Stash the Rails 2 and 3 dummy apps."
101
+ task :all do
102
+ system "rake stash:rails-2"
103
+ system "rake stash:rails-3"
104
+ end
105
+ desc "Stash the Rails 2 dummy app."
106
+ task :"rails-2" do
107
+ require "test/rails-2/rich_cms/dummy_app.rb"
108
+ DummyApp.stash_all
109
+ end
110
+ desc "Stash the Rails 3 dummy app."
111
+ task :"rails-3" do
112
+ require "test/rails-3/rich_cms/dummy_app.rb"
113
+ DummyApp.stash_all
114
+ end
34
115
  end
35
116
 
36
117
  desc "Generate documentation for the rich_cms plugin."
@@ -42,3 +123,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
42
123
  rdoc.rdoc_files.include "MIT-LICENSE"
43
124
  rdoc.rdoc_files.include "lib/**/*.rb"
44
125
  end
126
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.7
1
+ 3.0.0
@@ -1,8 +1,6 @@
1
-
2
1
  module Rich
3
2
  class CmsController < ::ApplicationController
4
-
5
- before_filter :require_current_rich_cms_admin, :except => [:display, :position, :login]
3
+ before_filter :require_login, :except => [:display, :position]
6
4
 
7
5
  def display
8
6
  (session[:rich_cms] ||= {})[:display] = params[:display]
@@ -14,52 +12,25 @@ module Rich
14
12
  render :nothing => true
15
13
  end
16
14
 
17
- def login
18
- case rich_cms_auth.logic
19
- when :authlogic
20
- @current_rich_cms_admin_session = rich_cms_authenticated_class.new params[key = rich_cms_authenticated_class.name.underscore.gsub("/", "_")]
21
- authenticated = @current_rich_cms_admin_session.save
22
-
23
- after_rich_cms_login authenticated, key
24
- end
15
+ def update
16
+ render :json => Cms::Content::Item.new(params[:content_item]).save
25
17
  end
26
18
 
27
- def logout
28
- case rich_cms_auth.logic
29
- when :authlogic
30
- (@current_rich_cms_admin_session ||= rich_cms_authenticated_class.find).destroy
31
- end
32
- session[:rich_cms] = nil
33
-
34
- after_rich_cms_logout
35
- end
19
+ private
36
20
 
37
- unless ::ApplicationController.instance_methods.include?("after_rich_cms_login")
38
- def after_rich_cms_login(authenticated, key)
21
+ def require_login
22
+ if Rich::Cms::Auth.login_required?
39
23
  if request.xhr?
40
24
  render :update do |page|
41
- if authenticated
42
- page.reload
43
- else
44
- page["##{key}_#{rich_cms_authentication_inputs.first}"].focus
45
- end
25
+ page.reload
46
26
  end
47
27
  else
48
28
  redirect_to request.referrer
49
29
  end
30
+ return false
50
31
  end
51
- end
52
-
53
- unless ::ApplicationController.instance_methods.include?("after_rich_cms_logout")
54
- def after_rich_cms_logout
55
- redirect_to request.referrer
56
- end
57
- end
58
-
59
- def update
60
- render :json => Cms::Content::Item.new(params[:content_item]).save
32
+ true
61
33
  end
62
34
 
63
35
  end
64
-
65
- end
36
+ end
@@ -0,0 +1,31 @@
1
+ module Rich
2
+ class CmsSessionsController < ::ApplicationController
3
+
4
+ def login
5
+ Rich::Cms::Auth.login
6
+ if request.xhr?
7
+ render :update do |page|
8
+ if Rich::Cms::Auth.admin
9
+ page.reload
10
+ else
11
+ page["##{Rich::Cms::Auth.klass_symbol}_#{Rich::Cms::Auth.inputs.first}"].focus
12
+ end
13
+ end
14
+ else
15
+ redirect_to request.referrer
16
+ end
17
+ end
18
+
19
+ def logout
20
+ Rich::Cms::Auth.logout
21
+ if request.xhr?
22
+ render :update do |page|
23
+ page.reload
24
+ end
25
+ else
26
+ redirect_to request.referrer
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -1,23 +1,25 @@
1
1
  <ul id="rich_cms_menu">
2
- <% unless current_rich_cms_admin %>
2
+ <% if rich_cms_login_required? %>
3
3
  <li>
4
4
  Rich-CMS
5
5
  </li>
6
6
  <li class="last">
7
- <%= link "Login" %>
7
+ <%= link_to "Login", "#", :class => "login" %>
8
8
  </li>
9
9
  <% else %>
10
10
  <li>
11
- <%= current_rich_cms_admin_name %>
11
+ <%= current_rich_cms_admin_label %>
12
12
  </li>
13
13
  <li>
14
- <%= link "Mark content", :class => "mark" %>
14
+ <%= link_to "Mark content", "#", :class => "mark" %>
15
15
  </li>
16
- <li>
16
+ <li class="<%= "last" unless Rich::Cms::Auth.enabled? %>">
17
17
  <%= link_to "Hide" , rich_cms_hide_path %>
18
18
  </li>
19
- <li class="last">
20
- <%= link_to "Logout", rich_cms_logout_path %>
21
- </li>
19
+ <% if Rich::Cms::Auth.enabled? %>
20
+ <li class="last">
21
+ <%= link_to "Logout", rich_cms_logout_path %>
22
+ </li>
23
+ <% end %>
22
24
  <% end %>
23
25
  </ul>
@@ -1,3 +1,3 @@
1
1
  <div id="rich_cms_panel" style="display: none">
2
- <%= render :partial => "rich/cms/dock/panel/#{current_rich_cms_admin.nil? ? "login" : "edit"}" %>
2
+ <%= render :partial => "rich/cms/dock/panel/#{rich_cms_login_required? ? "login" : "edit"}" %>
3
3
  </div>
@@ -1,10 +1,12 @@
1
1
  <div class="edit">
2
- <% form_tag rich_cms_update_path, :name => "rich_cms_content", :class => "ajaxify" do %>
2
+ <% form_tag rich_cms_update_path, :name => "rich_cms_content", :class => "ajaxify" do %>
3
3
  <fieldset class="inputs">
4
- <label></label>
4
+ <div class="keys">
5
+ <label>Editing:&nbsp; </label>
6
+ </div>
5
7
  </fieldset>
6
8
  <fieldset class="buttons">
7
- <%= submit_tag "Save" %> <%= link "Close" %>
9
+ <%= submit_tag "Save" %> <%= link_to "Close", "#", :class => "close" %>
8
10
  </fieldset>
9
11
  <% end %>
10
12
  </div>
@@ -1,10 +1,12 @@
1
1
  <div class="edit">
2
2
  <%= form_tag rich_cms_update_path, :name => "rich_cms_content", :class => "ajaxify" do %>
3
3
  <fieldset class="inputs">
4
- <label></label>
4
+ <div class="keys">
5
+ <label>Editing:&nbsp; </label>
6
+ </div>
5
7
  </fieldset>
6
8
  <fieldset class="buttons">
7
- <%= submit_tag "Save" %> <%= link "Close" %>
9
+ <%= submit_tag "Save" %> <%= link_to "Close", "#", :class => "close" %>
8
10
  </fieldset>
9
11
  <% end %>
10
12
  </div>
@@ -1,15 +1,21 @@
1
1
  <div class="login">
2
- <% semantic_form_for rich_cms_authenticated_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
-
4
- <% form.inputs do %>
5
- <% rich_cms_authentication_inputs.each do |input| %>
6
- <%= form.input input, :input_html => {:size => ""} %>
7
- <% end %>
8
- <% end %>
9
-
10
- <% form.buttons do %>
11
- <%= form.submit "Login" %>
12
- <% end %>
13
-
2
+ <% form_for rich_cms_admin_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
+ <fieldset class="inputs">
4
+ <ol>
5
+ <% rich_cms_admin_inputs.each do |input| %>
6
+ <li class="<%= input.to_s =~ /password/ ? "password" : "string" %> required">
7
+ <%= form.label input, "#{input.to_s.humanize} <abbr title='required'>*</abbr>" %>
8
+ <%= form.send :"#{input.to_s =~ /password/ ? "password" : "text"}_field", input, :html => {:size => ""} %>
9
+ </li>
10
+ <% end %>
11
+ </ol>
12
+ </fieldset>
13
+ <fieldset class="buttons">
14
+ <ol>
15
+ <li>
16
+ <%= submit_tag "Login" %>
17
+ </li>
18
+ </ol>
19
+ </fieldset>
14
20
  <% end %>
15
21
  </div>
@@ -1,15 +1,21 @@
1
1
  <div class="login">
2
- <%= semantic_form_for rich_cms_authenticated_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
-
4
- <%= form.inputs do %>
5
- <% rich_cms_authentication_inputs.each do |input| %>
6
- <%= form.input input, :input_html => {:size => ""} %>
7
- <% end %>
8
- <% end %>
9
-
10
- <%= form.buttons do %>
11
- <%= form.submit "Login" %>
12
- <% end %>
13
-
2
+ <%= form_for rich_cms_admin_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
+ <fieldset class="inputs">
4
+ <ol>
5
+ <% rich_cms_admin_inputs.each do |input| %>
6
+ <li class="<%= input.to_s =~ /password/ ? "password" : "string" %> required">
7
+ <%= form.label input, "#{input.to_s.humanize} <abbr title='required'>*</abbr>".html_safe %>
8
+ <%= form.send :"#{input.to_s =~ /password/ ? "password" : "text"}_field", input, :html => {:size => ""} %>
9
+ </li>
10
+ <% end %>
11
+ </ol>
12
+ </fieldset>
13
+ <fieldset class="buttons">
14
+ <ol>
15
+ <li>
16
+ <%= submit_tag "Login" %>
17
+ </li>
18
+ </ol>
19
+ </fieldset>
14
20
  <% end %>
15
21
  </div>
@@ -5,6 +5,6 @@
5
5
 
6
6
  <script type="text/javascript">
7
7
  $(function() {
8
- Rich.Cms.Editor.register(<%= Rich::Cms::Engine.editable_content_javascript_hash %>);
8
+ Rich.Cms.Editor.register(<%= rich_cms_editable_content_javascript_hash %>);
9
9
  });
10
10
  </script>