rich_cms 2.1.7 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ ---
2
+ paul:
3
+ name: Paul Engel
4
+ email: paul.engel@holder.nl
5
+ password_salt: bGryHxjIwmTxF45JyoBE
6
+ crypted_password: 86435d9f6e85403d20881122b001e9fd5822325e74f24e162a2e51ab64ff92f15d024a3c37a494e987ed7c3666d2754fbf9673262125f4b3c1e5cf101b88569b
@@ -0,0 +1,5 @@
1
+ ---
2
+ paul:
3
+ email: paul.engel@holder.nl
4
+ password_salt: $2a$10$/9ONlwdXLV2HMShjEyiiw.
5
+ encrypted_password: $2a$10$/9ONlwdXLV2HMShjEyiiw./F/mUCgfs7iDhYm4zlDpsjmmjXtDrQW
@@ -0,0 +1,17 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ require File.expand_path("../rich_cms/dummy_app.rb", __FILE__)
4
+
5
+ DummyApp.restore_all
6
+ DummyApp.prepare_database
7
+
8
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
9
+ require "rails/test_help"
10
+
11
+ Dir[File.expand_path("../../shared/support/**/*.rb", __FILE__)].each do |file|
12
+ require file
13
+ end
14
+ require File.expand_path("../../../lib/rich_cms", __FILE__)
15
+ include Rich::Cms
16
+
17
+ puts "\nRunning Rails #{Rails::VERSION::STRING}\n\n"
@@ -0,0 +1,49 @@
1
+ ActiveRecord::Schema.define(:version => 19820801180828) do
2
+
3
+ create_table "authlogic_users", :force => true do |t|
4
+ t.string "name"
5
+ t.string "email"
6
+ t.string "crypted_password"
7
+ t.string "password_salt"
8
+ t.string "persistence_token"
9
+ t.string "single_access_token"
10
+ t.string "perishable_token"
11
+ t.integer "login_count"
12
+ t.datetime "created_at"
13
+ t.datetime "updated_at"
14
+ t.datetime "current_login_at"
15
+ t.datetime "last_login_at"
16
+ t.datetime "last_request_at"
17
+ end
18
+
19
+ add_index "authlogic_users", ["email"], :name => "index_authlogic_users_on_email"
20
+
21
+ create_table "devise_users", :force => true do |t|
22
+ t.string "email", :default => "", :null => false
23
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
24
+ t.string "password_salt", :default => "", :null => false
25
+ t.string "reset_password_token"
26
+ t.string "remember_token"
27
+ t.datetime "remember_created_at"
28
+ t.integer "sign_in_count", :default => 0
29
+ t.datetime "current_sign_in_at"
30
+ t.datetime "last_sign_in_at"
31
+ t.string "current_sign_in_ip"
32
+ t.string "last_sign_in_ip"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ end
36
+
37
+ add_index "devise_users", ["email"], :name => "index_devise_users_on_email", :unique => true
38
+ add_index "devise_users", ["reset_password_token"], :name => "index_devise_users_on_reset_password_token", :unique => true
39
+
40
+ create_table "cms_contents", :force => true do |t|
41
+ t.string "key"
42
+ t.text "value"
43
+ t.datetime "created_at"
44
+ t.datetime "updated_at"
45
+ end
46
+
47
+ add_index "cms_contents", ["key"], :name => "index_cms_contents_on_key"
48
+
49
+ end
@@ -0,0 +1,10 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Major.create(:name => 'Daley', :city => cities.first)
8
+
9
+ AuthlogicUser.create :email => "paul.engel@holder.nl", :password => "testrichcms", :password_confirmation => "testrichcms"
10
+ DeviseUser .create :email => "paul.engel@holder.nl", :password => "testrichcms"
@@ -0,0 +1,6 @@
1
+ ---
2
+ paul:
3
+ name: Paul Engel
4
+ email: paul.engel@holder.nl
5
+ password_salt: bGryHxjIwmTxF45JyoBE
6
+ crypted_password: 86435d9f6e85403d20881122b001e9fd5822325e74f24e162a2e51ab64ff92f15d024a3c37a494e987ed7c3666d2754fbf9673262125f4b3c1e5cf101b88569b
@@ -0,0 +1,8 @@
1
+ class AuthlogicUser < ::ActiveRecord::Base
2
+
3
+ acts_as_authentic do |c|
4
+ c.login_field = :email
5
+ c.crypted_password_field = :crypted_password
6
+ end
7
+
8
+ end
@@ -0,0 +1,10 @@
1
+ class AuthlogicUserSession < ::Authlogic::Session::Base
2
+ authenticate_with AuthlogicUser
3
+ generalize_credentials_error_messages true
4
+ params_key "user_credentials"
5
+
6
+ def to_key
7
+ new_record? ? nil : [self.send(self.class.primary_key)]
8
+ end
9
+
10
+ end
@@ -0,0 +1,2 @@
1
+ class CmsContent < ActiveRecord::Base
2
+ end
@@ -0,0 +1,3 @@
1
+ class DeviseUser < ::ActiveRecord::Base
2
+ devise :database_authenticatable
3
+ end
@@ -0,0 +1,100 @@
1
+
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ outline: 0; }
6
+
7
+ html, body {
8
+ height: 100%; }
9
+
10
+ body {
11
+ color: #111;
12
+ font-family: Myriad Pro, Arial;
13
+ font-size: 18px;
14
+ line-height: 120%;
15
+ text-shadow: white 0 2px 0;
16
+ background: #E0E0E0; }
17
+
18
+ ol, ul {
19
+ list-style: none; }
20
+
21
+ a {
22
+ padding-bottom: 1px;
23
+ color: #111;
24
+ cursor: pointer;
25
+ text-decoration: none; }
26
+
27
+ a:hover {
28
+ text-decoration: underline; }
29
+
30
+ abbr, fieldset, img {
31
+ border: 0; }
32
+
33
+ textarea {
34
+ font-family: Myriad Pro, Arial; }
35
+
36
+ #page {
37
+ width: 750px;
38
+ min-height: 100%;
39
+ margin: 0 auto; }
40
+
41
+ #page div.locales {
42
+ padding-top: 80px;
43
+ text-align: center; }
44
+
45
+ #page div.locales a img {
46
+ margin: 0 2px;
47
+ padding: 2px; }
48
+
49
+ #page div.locales a.selected img {
50
+ padding: 1px;
51
+ border: 1px solid #06F; }
52
+
53
+ #page div.content {
54
+ padding-top: 80px;
55
+ clear: both; }
56
+
57
+ #page div.content div.left {
58
+ width: 515px;
59
+ float: left; }
60
+
61
+ #page div.content div.left h1 {
62
+ margin-bottom: 35px; }
63
+
64
+ #page div.content div.left h3 {
65
+ font-size: 22px;
66
+ margin-bottom: 22px; }
67
+
68
+ #page div.content div.left p {
69
+ margin-bottom: 30px;
70
+ font-size: 18px;
71
+ line-height: 150%; }
72
+
73
+ #page div.content div.left form label {
74
+ display: block;
75
+ font-weight: bold; }
76
+
77
+ #page div.content div.left form .inputs input {
78
+ margin-bottom: 15px;
79
+ width: 350px;
80
+ font-size: 16px; }
81
+
82
+ #page div.content div.left form .inputs textarea {
83
+ width: 400px;
84
+ height: 150px;
85
+ font-size: 18px; }
86
+
87
+ #page div.content div.left form .buttons {
88
+ padding: 15px 0 60px 0; }
89
+
90
+ #page div.content div.left form .buttons input {
91
+ margin-right: 6px;
92
+ font-size: 16px; }
93
+
94
+ #page div.content div.left form .buttons a {
95
+ font-size: 14px; }
96
+
97
+ #page div.content ul {
98
+ width: 175px;
99
+ font-weight: bold;
100
+ float: right; }
@@ -0,0 +1,159 @@
1
+ #rich_cms_dock *, #rich_cms_menu *, #rich_cms_panel * {
2
+ font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
3
+ line-height: 1.5;
4
+ letter-spacing: 0; }
5
+
6
+ #rich_cms_dock *, #rich_cms_menu * {
7
+ letter-spacing: -0.35px; }
8
+
9
+ #rich_cms_dock {
10
+ margin: 15px;
11
+ z-index: 999;
12
+ display: -moz-inline-block;
13
+ display: inline-block;
14
+ zoom: 1;
15
+ *display: inline;
16
+ position: fixed;
17
+ *position: absolute; }
18
+ #rich_cms_dock.top {
19
+ top: 0; }
20
+ #rich_cms_dock.bottom {
21
+ bottom: 0; }
22
+ #rich_cms_dock.left {
23
+ left: 0; }
24
+ #rich_cms_dock.right {
25
+ right: 0; }
26
+ #rich_cms_dock.middle {
27
+ width: 500px;
28
+ left: 50%;
29
+ margin-left: -250px;
30
+ text-align: center; }
31
+ #rich_cms_dock.ui-draggable-dragging {
32
+ filter: alpha(opacity=50);
33
+ -moz-opacity: 0.5;
34
+ -khtml-opacity: 0.5;
35
+ opacity: 0.5; }
36
+
37
+ #x1, #x2, #y1, #x, #y {
38
+ display: none;
39
+ position: fixed; }
40
+ #x1.display, #x2.display, #y1.display, #x.display, #y.display {
41
+ display: block; }
42
+
43
+ #x1, #x2, #x {
44
+ width: 1px;
45
+ height: 100%; }
46
+
47
+ #y1, #y {
48
+ width: 100%;
49
+ height: 1px; }
50
+
51
+ #x1, #x2, #y1 {
52
+ background: red; }
53
+
54
+ #x, #y {
55
+ background: green; }
56
+
57
+ #rich_cms_menu {
58
+ padding: 5px 0;
59
+ color: #222222;
60
+ font-family: "Helvetica Neue", "Helvetica", "Arial", "sans-serif";
61
+ font-size: 12px;
62
+ font-weight: bold;
63
+ *border: 1px solid #555555;
64
+ background: #fdfdfd;
65
+ display: -moz-inline-block;
66
+ display: inline-block;
67
+ zoom: 1;
68
+ *display: inline;
69
+ border-radius: 5px;
70
+ -moz-border-radius: 5px;
71
+ -webkit-border-radius: 5px;
72
+ box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px;
73
+ -moz-box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px;
74
+ -webkit-box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px; }
75
+ #rich_cms_menu li {
76
+ padding: 0 17px;
77
+ *padding: 1px 17px;
78
+ line-height: 1;
79
+ border-right: 1px solid #bbbbbb;
80
+ box-shadow: white 1px 0 0;
81
+ -moz-box-shadow: white 1px 0 0;
82
+ -webkit-box-shadow: white 1px 0 0;
83
+ display: -moz-inline-block;
84
+ display: inline-block;
85
+ zoom: 1;
86
+ *display: inline; }
87
+ #rich_cms_menu li:first-child {
88
+ cursor: move; }
89
+ #rich_cms_menu li:last-child {
90
+ border: 0;
91
+ box-shadow: transparent 0 0 0;
92
+ -moz-box-shadow: transparent 0 0 0;
93
+ -webkit-box-shadow: transparent 0 0 0; }
94
+ #rich_cms_menu li.last {
95
+ *border: 0; }
96
+ #rich_cms_menu li a {
97
+ color: #4183c4;
98
+ cursor: pointer;
99
+ outline: 0;
100
+ text-decoration: none; }
101
+ #rich_cms_menu li a:hover {
102
+ text-decoration: underline;
103
+ text-shadow: transparent 0 0 0; }
104
+
105
+ #rich_cms_panel {
106
+ min-width: 200px;
107
+ padding-right: 5px; }
108
+ #rich_cms_panel .edit form .inputs label {
109
+ padding-top: 2px;
110
+ padding-bottom: 5px; }
111
+ #rich_cms_panel form fieldset, #rich_cms_panel form ol {
112
+ margin: 0;
113
+ padding: 0;
114
+ border: 0; }
115
+ #rich_cms_panel form ol {
116
+ list-style: none; }
117
+ #rich_cms_panel form .inputs div.keys {
118
+ min-height: 21px; }
119
+ #rich_cms_panel form .inputs div.keys label {
120
+ display: inline; }
121
+ #rich_cms_panel form .inputs div.keys a, #rich_cms_panel form .inputs div.keys span {
122
+ font-size: 12px;
123
+ font-weight: bold; }
124
+ #rich_cms_panel form .inputs div.keys select {
125
+ margin-right: 4px; }
126
+ #rich_cms_panel form .inputs label {
127
+ font-size: 12px; }
128
+ #rich_cms_panel form .inputs label abbr {
129
+ padding-left: 2px;
130
+ border: 0; }
131
+ #rich_cms_panel form .inputs li.password {
132
+ padding-top: 4px; }
133
+ #rich_cms_panel form .inputs li.string input, #rich_cms_panel form .inputs li.password input {
134
+ width: 100%;
135
+ display: block; }
136
+ #rich_cms_panel form .inputs textarea {
137
+ width: 450px;
138
+ height: 300px;
139
+ font-family: "Arial";
140
+ font-size: 12px; }
141
+ #rich_cms_panel form .buttons {
142
+ padding-top: 9px; }
143
+ #rich_cms_panel form .buttons a {
144
+ font-size: 12px; }
145
+
146
+ .rich_cms_content.marked {
147
+ color: black;
148
+ cursor: pointer;
149
+ *border: 1px solid #777777;
150
+ background: #f1eb00;
151
+ border-radius: 2px;
152
+ -moz-border-radius: 2px;
153
+ -webkit-border-radius: 2px;
154
+ box-shadow: rgba(0, 0, 0, 0.5) 0 1px 3px;
155
+ -moz-box-shadow: rgba(0, 0, 0, 0.5) 0 1px 3px;
156
+ -webkit-box-shadow: rgba(0, 0, 0, 0.5) 0 1px 3px;
157
+ text-shadow: transparent 0 0 0; }
158
+ .rich_cms_content.marked.block {
159
+ display: block; }
@@ -0,0 +1,13 @@
1
+ <div class="content">
2
+ <div class="left">
3
+ <%= rich_cms_tag ".cms_content", "header" , :tag => :h1 %>
4
+ <%= rich_cms_tag ".cms_content", "paragraph", :as => :html %>
5
+ </div>
6
+ <ul>
7
+ <% ["Home", "Developers", "Comments", "Documentation", "Support", "About me"].each do |x| %>
8
+ <li>
9
+ <%= link_to rich_cms_tag(".cms_content", x), "#" %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
@@ -0,0 +1,12 @@
1
+ <html>
2
+ <head>
3
+ <title>Test Application - Rails <%= Rails::VERSION::STRING %> - <%= Rich::Cms::Auth.logic.try(:to_s).try(:classify) || "Non authenticated" %></title>
4
+ <%= stylesheet_link_tag "app" %>
5
+ </head>
6
+ <body>
7
+ <%= rich_cms %>
8
+ <div id="page">
9
+ <%= yield %>
10
+ </div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,55 @@
1
+ # TODO: Fix Authlogic where it saves records with save(false). Use save(:validation => false) instead. Search for /save.*\(false\)/
2
+
3
+ module ActionController
4
+ class IntegrationTest
5
+
6
+ protected
7
+
8
+ def login
9
+ visit "/cms"
10
+ page.execute_script "$('div#rich_cms_dock a.login').click()"
11
+ fill_in_and_submit "#raccoon_tip", {:Email => "paul.engel@holder.nl", :Password => "testrichcms"}, "Login"
12
+ end
13
+
14
+ def logout
15
+ find("#rich_cms_dock").click_link "Logout"
16
+ end
17
+
18
+ def hide_dock
19
+ find("#rich_cms_dock").click_link "Hide"
20
+ end
21
+
22
+ def close_raccoontip
23
+ find("#raccoontip").click_link "Close"
24
+ assert !find("#raccoon_tip").visible?
25
+ end
26
+
27
+ def mark_content
28
+ page.execute_script "$('div#rich_cms_dock a.mark').click()"
29
+ end
30
+
31
+ def edit_content(key)
32
+ page.execute_script "$('.cms_content.marked[data-key=" + key + "]').click()"
33
+ assert find("#raccoon_tip").visible?
34
+ end
35
+
36
+ def fill_in_and_submit(selector, with, submit)
37
+ within "#{selector} fieldset.inputs" do
38
+ with.each do |key, value|
39
+ begin
40
+ fill_in key.to_s, :with => value
41
+ rescue Selenium::WebDriver::Error::ElementNotDisplayedError
42
+ page.execute_script "var input = $('#{selector} [name=\"#{key}\"]');" +
43
+ "if (input.data('cleditor')) {" +
44
+ " input.val('#{value}');" +
45
+ " input.data('cleditor').updateFrame();" +
46
+ "}"
47
+ end
48
+ end
49
+ end
50
+ find(selector).find_button(submit).click
51
+ sleep 2
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,28 @@
1
+ module ActionController
2
+ class TestCase
3
+
4
+ protected
5
+
6
+ def assert_named_route(result, name)
7
+ assert_equal result, named_routes[name.to_s]
8
+ end
9
+
10
+ def named_routes
11
+ @named_routes ||= Hash[*begin
12
+ if Rails::VERSION::MAJOR >= 3
13
+ Rails.application.routes.routes.collect do |route|
14
+ [route.name, route.path.gsub("(.:format)", "")] unless route.name.blank?
15
+ end
16
+ else
17
+ ActionController::Routing::Routes.routes.collect do |route|
18
+ name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
19
+ path = route.segments.collect(&:to_s).join
20
+ path.chop! if path.length > 1
21
+ [name, path] unless name.blank?
22
+ end
23
+ end
24
+ end.compact.flatten]
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ # http://techiferous.com/2010/04/using-capybara-in-rails-3 FTW!
2
+
3
+ require "capybara/rails"
4
+
5
+ module ActionController
6
+ class IntegrationTest
7
+ include Capybara
8
+ end
9
+ end
10
+
11
+ Capybara.register_driver(driver = :"selenium_firefox") do |app|
12
+ Capybara::Driver::Selenium.new app, :profile => "capybara"
13
+ end
14
+ Capybara.default_driver = driver
@@ -0,0 +1 @@
1
+ AUTHS = %w(authlogic devise)
@@ -0,0 +1,14 @@
1
+ require File.expand_path("../../../../test_helper.rb", __FILE__)
2
+
3
+ module Actionpack
4
+ module ActionController
5
+ class BaseTest < ActiveSupport::TestCase
6
+
7
+ context "An ActionController instance" do
8
+ should "do something" do
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path("../../../../test_helper.rb", __FILE__)
2
+
3
+ module Actionpack
4
+ module ActionView
5
+ class BaseTest < ActiveSupport::TestCase
6
+
7
+ context "An ActionView instance" do
8
+ should "respond to :rich_cms" do
9
+ assert ::ActionView::Base.new.respond_to? :rich_cms
10
+ end
11
+
12
+ should "respond to :rich_cms_tag" do
13
+ assert ::ActionView::Base.new.respond_to? :rich_cms_tag
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path("../../../../test_helper.rb", __FILE__)
2
+
3
+ module Activesupport
4
+ module ActiveSupport
5
+ class DependenciesTest < ::ActiveSupport::TestCase
6
+
7
+ context "ActiveSupport::Dependencies" do
8
+ should "respond to :autoload_paths" do
9
+ assert ::ActiveSupport::Dependencies.respond_to? :autoload_paths
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,88 @@
1
+ require File.expand_path("../../../../dummy_app.rb", __FILE__)
2
+
3
+ DummyApp.setup "Authlogic" do |app|
4
+ app.generate_cms_admin :authlogic
5
+ app.restore_admin_fixtures
6
+ app.generate_cms_content
7
+ end
8
+
9
+ module App
10
+ module Integration
11
+ module Authenticated
12
+ class AuthlogicTest < ActionController::IntegrationTest
13
+ fixtures :authlogic_users
14
+
15
+ context "Rich-CMS implemented with Authlogic" do
16
+ setup do
17
+ Rich::Cms::Auth.setup do |config|
18
+ config.logic = :authlogic
19
+ config.klass = "AuthlogicUser"
20
+ end
21
+ visit "/cms/logout"
22
+ end
23
+
24
+ teardown do
25
+ DummyApp.restore_all true
26
+ end
27
+
28
+ should "behave as expected" do
29
+ visit "/"
30
+ assert page.has_no_css? "div#rich_cms_dock"
31
+ assert page.has_no_css? ".cms_content"
32
+ assert_equal "header" , find(".left h1" ).text
33
+ assert_equal "paragraph", find(".left div").text
34
+
35
+ visit "/cms"
36
+
37
+ assert page.has_css? "div#rich_cms_dock"
38
+ assert page.has_no_css? ".cms_content"
39
+
40
+ visit "/cms/hide"
41
+ assert page.has_no_css? "div#rich_cms_dock"
42
+ assert page.has_no_css? ".cms_content"
43
+ login
44
+
45
+ assert page.has_css? "div#rich_cms_dock"
46
+ assert page.has_content? "Mark content"
47
+ assert_equal "< header >" , find(".left h1.cms_content" ).text
48
+ assert_equal "< paragraph >", find(".left div.cms_content").text
49
+
50
+ mark_content
51
+ assert page.has_css? ".cms_content.marked"
52
+
53
+ edit_content "header"
54
+ assert_equal ".cms_content", find("#raccoon_tip input[name='content_item[__selector__]']").value
55
+ assert_equal "" , find("#raccoon_tip input[name='content_item[value]']" ).value
56
+
57
+ fill_in_and_submit "#raccoon_tip", {:"content_item[value]" => "Try out Rich-CMS!"}, "Save"
58
+ assert_equal "Try out Rich-CMS!", find(".left h1.cms_content" ).text
59
+ assert_equal "< paragraph >" , find(".left div.cms_content").text
60
+
61
+ edit_content "paragraph"
62
+ assert_equal ".cms_content", find("#raccoon_tip input[name='content_item[__selector__]']").value
63
+ assert_equal "" , find("#raccoon_tip textarea[name='content_item[value]']" ).value
64
+
65
+ fill_in_and_submit "#raccoon_tip", {:"content_item[value]" => "<p>Lorem ipsum dolor sit amet.</p>"}, "Save"
66
+ assert_equal "Try out Rich-CMS!" , find(".left h1.cms_content" ).text
67
+ assert_equal "Lorem ipsum dolor sit amet.", find(".left div.cms_content p").text
68
+
69
+ hide_dock
70
+ assert page.has_no_css? "div#rich_cms_dock"
71
+ assert page.has_css? ".cms_content"
72
+
73
+ visit "/cms"
74
+ assert page.has_css? "div#rich_cms_dock"
75
+ assert page.has_css? ".cms_content"
76
+
77
+ logout
78
+ assert page.has_no_css? "div#rich_cms_dock"
79
+ assert page.has_no_css? ".cms_content"
80
+ assert_equal "Try out Rich-CMS!" , find(".left h1" ).text
81
+ assert_equal "Lorem ipsum dolor sit amet.", find(".left div p").text
82
+ end
83
+ end
84
+
85
+ end
86
+ end
87
+ end
88
+ end