community_engine 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +4 -1
  3. data/.travis.yml +5 -2
  4. data/CHANGELOG.markdown +270 -0
  5. data/Gemfile +3 -0
  6. data/README.markdown +20 -21
  7. data/Rakefile +8 -6
  8. data/TODO.markdown +3 -0
  9. data/UPGRADING.markdown +46 -36
  10. data/app/assets/javascripts/active_admin.js.coffee +19 -0
  11. data/app/assets/javascripts/ckeditor/configs/ads.js.coffee +175 -0
  12. data/app/assets/javascripts/ckeditor/configs/comments.js.coffee +2 -0
  13. data/app/assets/javascripts/ckeditor/configs/posts.js.coffee +248 -0
  14. data/app/assets/javascripts/ckeditor/rte/rte.ads.js.coffee +7 -0
  15. data/app/assets/javascripts/ckeditor/rte/rte.comments.js.coffee +8 -0
  16. data/app/assets/javascripts/ckeditor/rte/rte.js.coffee +20 -0
  17. data/app/assets/javascripts/ckeditor/rte/rte.posts.js.coffee +14 -0
  18. data/app/assets/javascripts/community_engine.js +114 -123
  19. data/{vendor → app}/assets/javascripts/jcrop/jquery.Jcrop.js +0 -0
  20. data/{vendor → app}/assets/javascripts/jcrop/jquery.color.js +0 -0
  21. data/{vendor → app}/assets/javascripts/tag-it/tag-it.js +0 -0
  22. data/app/assets/stylesheets/active_admin.css.scss +27 -0
  23. data/{vendor → app}/assets/stylesheets/jcrop/Jcrop.gif +0 -0
  24. data/{vendor → app}/assets/stylesheets/jcrop/jquery.Jcrop.min.css +0 -0
  25. data/{vendor → app}/assets/stylesheets/tag-it/tag-it.css +0 -0
  26. data/{vendor → app}/assets/stylesheets/tag-it/tagit.ui-zendesk.css +0 -0
  27. data/app/controllers/activities_controller.rb +4 -4
  28. data/app/controllers/albums_controller.rb +13 -18
  29. data/app/controllers/authorizations_controller.rb +1 -1
  30. data/app/controllers/base_controller.rb +9 -32
  31. data/app/controllers/categories_controller.rb +1 -78
  32. data/app/controllers/clippings_controller.rb +3 -7
  33. data/app/controllers/comments_controller.rb +4 -24
  34. data/app/controllers/events_controller.rb +3 -12
  35. data/app/controllers/favorites_controller.rb +2 -2
  36. data/app/controllers/forums_controller.rb +5 -9
  37. data/app/controllers/invitations_controller.rb +1 -1
  38. data/app/controllers/messages_controller.rb +4 -8
  39. data/app/controllers/moderators_controller.rb +1 -1
  40. data/app/controllers/monitorships_controller.rb +1 -1
  41. data/app/controllers/pages_controller.rb +0 -62
  42. data/app/controllers/password_resets_controller.rb +2 -2
  43. data/app/controllers/photo_manager_controller.rb +3 -3
  44. data/app/controllers/photos_controller.rb +43 -14
  45. data/app/controllers/posts_controller.rb +7 -14
  46. data/app/controllers/rsvps_controller.rb +3 -3
  47. data/app/controllers/sb_posts_controller.rb +20 -20
  48. data/app/controllers/sessions_controller.rb +1 -1
  49. data/app/controllers/tags_controller.rb +4 -52
  50. data/app/controllers/topics_controller.rb +15 -10
  51. data/app/controllers/users_controller.rb +9 -16
  52. data/app/controllers/votes_controller.rb +2 -2
  53. data/app/helpers/base_helper.rb +4 -14
  54. data/app/models/acts_as_taggable_on/tag.rb +9 -41
  55. data/app/models/clipping.rb +1 -1
  56. data/app/models/forum.rb +2 -2
  57. data/app/models/photo.rb +1 -1
  58. data/app/models/post.rb +1 -1
  59. data/app/models/sb_post.rb +19 -15
  60. data/app/models/topic.rb +10 -10
  61. data/app/models/user.rb +1 -1
  62. data/app/policies/active_admin/page_policy.rb +11 -0
  63. data/app/policies/application_policy.rb +59 -0
  64. data/app/policies/post_policy.rb +13 -0
  65. data/app/policies/sb_post_policy.rb +15 -0
  66. data/app/policies/topic_policy.rb +23 -0
  67. data/app/views/ckeditor/pictures/index.html.haml +15 -0
  68. data/app/views/ckeditor/shared/_asset.html.haml +9 -0
  69. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +14 -0
  70. data/app/views/comments/approve.js.haml +1 -1
  71. data/app/views/comments/create.js.erb +1 -1
  72. data/app/views/comments/edit.js.erb +2 -1
  73. data/app/views/events/_subscribe.html.haml +1 -1
  74. data/app/views/forums/show.html.haml +8 -4
  75. data/app/views/posts/show.html.haml +4 -0
  76. data/app/views/sb_posts/_edit_script.js.erb +2 -3
  77. data/app/views/sb_posts/_reply_script.js.erb +2 -4
  78. data/app/views/sb_posts/_sb_post.html.haml +7 -6
  79. data/app/views/sb_posts/create.js.erb +4 -4
  80. data/app/views/sb_posts/edit.js.erb +2 -1
  81. data/app/views/sessions/_menu_item.html.haml +4 -4
  82. data/app/views/shared/_end_javascript.html.haml +1 -2
  83. data/app/views/shared/_login_sidebar.html.haml +2 -2
  84. data/app/views/tags/show.html.haml +3 -3
  85. data/app/views/topics/show.html.haml +1 -1
  86. data/app/views/users/_profile_user_info_sidebar.html.haml +2 -2
  87. data/app/views/users/destroy.js.erb +3 -0
  88. data/app/views/users/new.html.haml +1 -1
  89. data/app/views/users/show.html.haml +1 -1
  90. data/app/views/users/signup_completed.html.haml +1 -1
  91. data/community_engine.gemspec +14 -11
  92. data/config/initializers/active_admin.rb +239 -0
  93. data/config/initializers/ckeditor.rb +8 -0
  94. data/config/initializers/ransack_bootstrap_fix.rb +25 -0
  95. data/config/locales/de-DE.yml +1 -0
  96. data/config/locales/en.yml +3 -0
  97. data/config/routes.rb +14 -19
  98. data/config/spring.rb +1 -0
  99. data/db/migrate/083_create_active_admin_comments.rb +19 -0
  100. data/lib/community_engine.rb +7 -3
  101. data/lib/community_engine/admin/ads.rb +3 -0
  102. data/lib/community_engine/admin/categories.rb +20 -0
  103. data/lib/community_engine/admin/comments.rb +4 -0
  104. data/lib/community_engine/admin/dashboard.rb +38 -0
  105. data/lib/community_engine/admin/events.rb +3 -0
  106. data/lib/community_engine/admin/forums.rb +3 -0
  107. data/lib/community_engine/admin/homepage_features.rb +25 -0
  108. data/lib/community_engine/admin/metro_areas.rb +4 -0
  109. data/lib/community_engine/admin/pages.rb +26 -0
  110. data/lib/community_engine/admin/posts.rb +92 -0
  111. data/lib/community_engine/admin/tags.rb +21 -0
  112. data/lib/community_engine/admin/users.rb +54 -0
  113. data/lib/community_engine/authenticated_system.rb +5 -20
  114. data/lib/community_engine/engine.rb +5 -0
  115. data/lib/community_engine/version.rb +1 -1
  116. data/lib/resource_feeder/atom.rb +2 -0
  117. data/lib/resource_feeder/rss.rb +2 -0
  118. data/lib/white_list.rb +6 -11
  119. data/test/fixtures/events.yml +10 -0
  120. data/test/fixtures/tags.yml +6 -5
  121. data/test/functional/activities_controller_test.rb +19 -19
  122. data/test/functional/admin/posts_controller_test.rb +16 -0
  123. data/test/functional/admin_controller_test.rb +82 -82
  124. data/test/functional/categories_controller_test.rb +0 -39
  125. data/test/functional/comments_controller_test.rb +14 -7
  126. data/test/functional/favorites_controller_test.rb +15 -16
  127. data/test/functional/pages_controller_test.rb +0 -71
  128. data/test/functional/posts_controller_test.rb +21 -2
  129. data/test/functional/sb_posts_controller_test.rb +3 -3
  130. data/test/functional/sessions_controller_test.rb +2 -2
  131. data/test/functional/tags_controller_test.rb +9 -20
  132. data/test/functional/users_controller_test.rb +0 -8
  133. data/test/functional/votes_controller_test.rb +1 -1
  134. data/test/testapp/config/spring.rb +1 -0
  135. data/test/testapp/db/schema.rb +16 -1
  136. data/test/unit/event_test.rb +1 -1
  137. metadata +204 -170
  138. data/CHANGELOG +0 -144
  139. data/app/controllers/admin_controller.rb +0 -80
  140. data/app/controllers/ads_controller.rb +0 -90
  141. data/app/controllers/homepage_features_controller.rb +0 -74
  142. data/app/controllers/metro_areas_controller.rb +0 -74
  143. data/app/controllers/statistics_controller.rb +0 -35
  144. data/app/views/admin/comments.html.haml +0 -53
  145. data/app/views/admin/events.html.haml +0 -26
  146. data/app/views/admin/messages.html.haml +0 -3
  147. data/app/views/admin/update.js.erb +0 -1
  148. data/app/views/admin/users.html.haml +0 -57
  149. data/app/views/ads/_form.html.haml +0 -21
  150. data/app/views/ads/edit.html.haml +0 -7
  151. data/app/views/ads/index.html.haml +0 -29
  152. data/app/views/ads/new.html.haml +0 -6
  153. data/app/views/ads/show.html.haml +0 -19
  154. data/app/views/categories/_form.html.haml +0 -8
  155. data/app/views/categories/edit.html.haml +0 -4
  156. data/app/views/categories/index.html.haml +0 -20
  157. data/app/views/categories/new.html.haml +0 -4
  158. data/app/views/homepage_features/_form.html.haml +0 -6
  159. data/app/views/homepage_features/edit.html.haml +0 -6
  160. data/app/views/homepage_features/index.html.haml +0 -24
  161. data/app/views/homepage_features/new.html.haml +0 -2
  162. data/app/views/homepage_features/show.html.haml +0 -27
  163. data/app/views/metro_areas/_form.html.haml +0 -6
  164. data/app/views/metro_areas/edit.html.haml +0 -8
  165. data/app/views/metro_areas/index.html.haml +0 -21
  166. data/app/views/metro_areas/new.html.haml +0 -6
  167. data/app/views/metro_areas/show.html.haml +0 -14
  168. data/app/views/pages/_form.html.haml +0 -18
  169. data/app/views/pages/edit.html.haml +0 -4
  170. data/app/views/pages/index.html.haml +0 -34
  171. data/app/views/pages/new.html.haml +0 -7
  172. data/app/views/shared/_admin_nav.html.haml +0 -17
  173. data/app/views/shared/_load_tinymce.js.erb +0 -15
  174. data/app/views/statistics/activities.xml.builder +0 -33
  175. data/app/views/statistics/index.html.haml +0 -48
  176. data/app/views/tags/edit.html.haml +0 -12
  177. data/app/views/tags/manage.html.haml +0 -30
  178. data/app/views/users/update.js.erb +0 -1
  179. data/test/functional/ads_controller_test.rb +0 -51
  180. data/test/functional/homepage_features_controller_test.rb +0 -69
  181. data/test/functional/metro_areas_controller_test.rb +0 -63
  182. data/test/functional/statistics_controller_test.rb +0 -18
  183. data/test/unit/acts_as_taggable_on/tag_test.rb +0 -22
  184. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/README +0 -3
  185. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/Rakefile +0 -22
  186. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -34
  187. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/generators/publishing/templates/migration.rb +0 -13
  188. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/install.rb +0 -3
  189. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/test/acts_as_publishable_test.rb +0 -8
  190. data/vendor/converted2.3plugins_to_lib_leftovers/acts_as_publishable/uninstall.rb +0 -1
  191. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/README +0 -4
  192. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/Rakefile +0 -22
  193. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/atom_feed_test.rb +0 -85
  194. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/rss_feed_test.rb +0 -61
  195. data/vendor/converted2.3plugins_to_lib_leftovers/resource_feeder/test/test_helper.rb +0 -60
  196. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/README +0 -35
  197. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/Rakefile +0 -22
  198. data/vendor/converted2.3plugins_to_lib_leftovers/white_list/test/white_list_test.rb +0 -120
@@ -0,0 +1,3 @@
1
+ # TODO
2
+
3
+ * datepicker for events
@@ -1,61 +1,67 @@
1
1
  Upgrading to v3.0.0
2
2
  ===================
3
- Follow the various guides for converting to Rails 4 from Rails 3.x
3
+ * Follow the various guides for converting from Rails 3.x to Rails 4
4
+ * Run `bundle exec rake app:community_engine:install:migrations`
5
+ * Run `rake db:migrate`
6
+ * Run `rake test && take community_engine:test`
4
7
 
5
- Run `bundle exec rake app:community_engine:install:migrations`
6
- Run `rake db:migrate`
7
- Run `rake test && take community_engine:test`
8
-
9
- Somethings may not be compatible. Some of the views and forms have changed.
8
+ Some things may not be compatible; some of the views and forms have changed.
10
9
 
11
10
  Upgrading to v1.2.1
12
11
  ===================
13
- Run `ruby script/generate plugin_migration`
14
- Run `rake db:migrate`
15
- Run `rake test && rake community_engine:test`
12
+ * Run `ruby script/generate plugin_migration`
13
+ * Run `rake db:migrate`
14
+ * Run `rake test && rake community_engine:test`
16
15
 
17
16
 
18
17
  Upgrading to v1.2.0
19
18
  ===================
20
- Run `ruby script/generate plugin_migration`
21
- Run `rake db:migrate`
22
- Run `rake test && rake community_engine:test`
19
+ * Run `ruby script/generate plugin_migration`
20
+ * Run `rake db:migrate`
21
+ * Run `rake test && rake community_engine:test`
22
+
23
23
  To migrate existing private messages to the new threaded message format, run `rake community_engine:add_threads_to_existing_messages` on your production server (CAREFUL: make backups first!)
24
24
 
25
25
 
26
26
  Upgrading to v1.1.0
27
27
  =====================
28
- Run `ruby script/generate plugin_migration`
29
- Run `rake db:migrate`
30
- Run `rake test && rake community_engine:test`
28
+ * Run `ruby script/generate plugin_migration`
29
+ * Run `rake db:migrate`
30
+ * Run `rake test && rake community_engine:test`
31
31
 
32
32
 
33
33
  Upgrading to v1.0.4.2
34
34
  =====================
35
- Run `rake gems:install`
36
- Run `ruby script/generate plugin_migration`
37
- Run `rake db:migrate`
38
- Run `rake test && rake community_engine:test`
35
+ * Run `rake gems:install`
36
+ * Run `ruby script/generate plugin_migration`
37
+ * Run `rake db:migrate`
38
+ * Run `rake test && rake community_engine:test`
39
+
39
40
  That's it!
40
41
 
41
42
  Note: this version adds a counter_cache to taggings, so you may need to update the counter on your existing tags by doing something like:
42
43
 
44
+ ```ruby
43
45
  ActsAsTaggableOn::Tag.all.each do |tag|
44
- tag.update_counters tag.id, :taggings_count => tag.taggings.length
46
+ tag.update_counters tag.id, :taggings_count => tag.taggings.length
45
47
  end
48
+ ```
46
49
 
47
- If you have many tags, this could take a while, though.
50
+ If you have many tags, this could take a while.
48
51
 
49
52
  Upgrading to v1.0.4
50
53
  ===================
51
- Run `ruby script/generate plugin_migration`
52
- Make sure you have the following in your `environment.rb`:
54
+ * Run `ruby script/generate plugin_migration`.
55
+ * Make sure you have the following in your `environment.rb`:
56
+
57
+ ```
58
+ config.gem 'authlogic'
59
+ config.gem 'icalendar'
60
+ config.gem 'calendar_date_select'
61
+ ```
53
62
 
54
- config.gem 'authlogic'
55
- config.gem 'icalendar'
56
- config.gem 'calendar_date_select'
63
+ * Run `rake db:migrate`
57
64
 
58
- Run `rake db:migrate`
59
65
  That's it!
60
66
 
61
67
 
@@ -71,18 +77,18 @@ Upgrading an Engines-based CE app to use the new Desert-based CE is easy:
71
77
 
72
78
  2. Delete the engines plugin directory (`rm -rf vendor/plugins/engines`). If you had submoduled it, make sure to delete the submodule info as well:
73
79
 
74
- Delete the relevant line from the .gitmodules file.
75
- Delete the relevant section from .git/config.
76
- Run git rm --cached vendor/plugins/engines (no trailing slash).
77
- Run rm -rf vendor/plugins/engines
78
- Commit your changes
80
+ * Delete the relevant line from the `.gitmodules` file
81
+ * Delete the relevant section from `.git/config`
82
+ * Run `git rm --cached vendor/plugins/engines` (no trailing slash)
83
+ * Run `rm -rf vendor/plugins/engines`
84
+ * Commit your changes
79
85
 
80
86
 
81
- 2. run `rake:rails:update` (coming from anything < Rails 2.3)
87
+ 2. Run `rake:rails:update` (coming from anything < Rails 2.3)
82
88
 
83
89
  3. Update your app's `test_helper.rb`, replacing `Test::Unit::TestCase` with `ActiveSupport::TestCase`
84
90
 
85
- 4. `rake test` && `rake community_engine:test`
91
+ 4. Run `rake test` && `rake community_engine:test`
86
92
 
87
93
 
88
94
 
@@ -94,10 +100,14 @@ Here's a regex that might help you in doing that:
94
100
 
95
101
  Find:
96
102
 
97
- (Engines|Rails)\.plugins\[\"community_engine\"\]\.migrate\(([0-9]+)\)
103
+ ```
104
+ (Engines|Rails)\.plugins\[\"community_engine\"\]\.migrate\(([0-9]+)\)
105
+ ```
98
106
 
99
107
  Replace:
100
108
 
101
- migrate_plugin(:community_engine, $2)
109
+ ```
110
+ migrate_plugin(:community_engine, $2)`
111
+ ```
102
112
 
103
113
  Also, you need to run `rake community_engine:db:migrate:upgrade_desert_plugin_migrations` before you migrate any _new_ CE migrations, to ensure your plugin migrations are listed in the correct table. Please note that you'll have to do this (carefully, and with backups) in production as well. Please post any questions to the CE Google Group.
@@ -0,0 +1,19 @@
1
+ #= require active_admin/base
2
+ #= require jquery.turbolinks
3
+ #= require turbolinks
4
+ #= require ckeditor/init
5
+ #= require tag-it/tag-it
6
+ #= require_directory ./ckeditor/rte
7
+
8
+ $(document).on 'page:receive', ->
9
+ $('input#tags').each ->
10
+ $.ajax
11
+ type: 'get'
12
+ url: $(this).data('auto_complete_url')
13
+ success: (data) ->
14
+ $(this).tagit
15
+ availableTags: data
16
+ allowSpaces: true
17
+ tagLimit: '20'
18
+ stopWritingOnTagLimit: true
19
+ return
@@ -0,0 +1,175 @@
1
+ CKEDITOR.editorConfig = (config) ->
2
+ config.startupMode = 'source'
3
+ config.toolbar = [
4
+ {
5
+ name: 'document'
6
+ groups: [
7
+ 'mode'
8
+ 'document'
9
+ 'doctools'
10
+ ]
11
+ items: [ 'Source' ]
12
+ }
13
+ {
14
+ name: 'clipboard'
15
+ groups: [
16
+ 'clipboard'
17
+ 'undo'
18
+ ]
19
+ items: [
20
+ 'Cut'
21
+ 'Copy'
22
+ 'Paste'
23
+ 'PasteText'
24
+ 'PasteFromWord'
25
+ '-'
26
+ 'Undo'
27
+ 'Redo'
28
+ ]
29
+ }
30
+ {
31
+ name: 'links'
32
+ items: [
33
+ 'Link'
34
+ 'Unlink'
35
+ 'Anchor'
36
+ ]
37
+ }
38
+ {
39
+ name: 'insert'
40
+ items: [
41
+ 'Image'
42
+ 'Flash'
43
+ 'Table'
44
+ 'HorizontalRule'
45
+ 'SpecialChar'
46
+ ]
47
+ }
48
+ {
49
+ name: 'paragraph'
50
+ groups: [
51
+ 'list'
52
+ 'indent'
53
+ 'blocks'
54
+ 'align'
55
+ 'bidi'
56
+ ]
57
+ items: [
58
+ 'NumberedList'
59
+ 'BulletedList'
60
+ '-'
61
+ 'Outdent'
62
+ 'Indent'
63
+ '-'
64
+ 'Blockquote'
65
+ 'CreateDiv'
66
+ '-'
67
+ 'JustifyLeft'
68
+ 'JustifyCenter'
69
+ 'JustifyRight'
70
+ 'JustifyBlock'
71
+ ]
72
+ }
73
+ '/'
74
+ {
75
+ name: 'styles'
76
+ items: [
77
+ 'Styles'
78
+ 'Format'
79
+ 'Font'
80
+ 'FontSize'
81
+ ]
82
+ }
83
+ {
84
+ name: 'colors'
85
+ items: [
86
+ 'TextColor'
87
+ 'BGColor'
88
+ ]
89
+ }
90
+ {
91
+ name: 'basicstyles'
92
+ groups: [
93
+ 'basicstyles'
94
+ 'cleanup'
95
+ ]
96
+ items: [
97
+ 'Bold'
98
+ 'Italic'
99
+ 'Underline'
100
+ 'Strike'
101
+ 'Subscript'
102
+ 'Superscript'
103
+ '-'
104
+ 'RemoveFormat'
105
+ ]
106
+ }
107
+ ]
108
+ config.toolbar_mini = [
109
+ {
110
+ name: 'paragraph'
111
+ groups: [
112
+ 'list'
113
+ 'indent'
114
+ 'blocks'
115
+ 'align'
116
+ 'bidi'
117
+ ]
118
+ items: [
119
+ 'NumberedList'
120
+ 'BulletedList'
121
+ '-'
122
+ 'Outdent'
123
+ 'Indent'
124
+ '-'
125
+ 'Blockquote'
126
+ 'CreateDiv'
127
+ '-'
128
+ 'JustifyLeft'
129
+ 'JustifyCenter'
130
+ 'JustifyRight'
131
+ 'JustifyBlock'
132
+ ]
133
+ }
134
+ {
135
+ name: 'styles'
136
+ items: [
137
+ 'Font'
138
+ 'FontSize'
139
+ ]
140
+ }
141
+ {
142
+ name: 'colors'
143
+ items: [
144
+ 'TextColor'
145
+ 'BGColor'
146
+ ]
147
+ }
148
+ {
149
+ name: 'basicstyles'
150
+ groups: [
151
+ 'basicstyles'
152
+ 'cleanup'
153
+ ]
154
+ items: [
155
+ 'Bold'
156
+ 'Italic'
157
+ 'Underline'
158
+ 'Strike'
159
+ 'Subscript'
160
+ 'Superscript'
161
+ '-'
162
+ 'RemoveFormat'
163
+ ]
164
+ }
165
+ {
166
+ name: 'insert'
167
+ items: [
168
+ 'Image'
169
+ 'Table'
170
+ 'HorizontalRule'
171
+ 'SpecialChar'
172
+ ]
173
+ }
174
+ ]
175
+ return
@@ -0,0 +1,2 @@
1
+ CKEDITOR.editorConfig = (config) ->
2
+ config.toolbar = [["Image", "Bold", "Italic", "Underline"], ["Link", "Unlink"], ["NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote"]]
@@ -0,0 +1,248 @@
1
+
2
+ CKEDITOR.editorConfig = (config) ->
3
+ ### Filebrowser routes ###
4
+
5
+ # # The location of an external file browser, that should be launched when "Browse Server" button is pressed.
6
+ # config.filebrowserBrowseUrl = '/ckeditor/attachment_files'
7
+ # # The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
8
+ # config.filebrowserFlashBrowseUrl = '/ckeditor/attachment_files'
9
+ # # The location of a script that handles file uploads in the Flash dialog.
10
+ # config.filebrowserFlashUploadUrl = '/ckeditor/attachment_files'
11
+ # # The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
12
+ # config.filebrowserImageBrowseLinkUrl = '/manage_photos'
13
+ # The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
14
+
15
+ config.filebrowserImageBrowseUrl = '/manage_photos'
16
+ # The location of a script that handles file uploads in the Image dialog.
17
+ config.filebrowserImageUploadUrl = '/manage_photos'
18
+
19
+ # The location of a script that handles file uploads.
20
+ # config.filebrowserUploadUrl = '/ckeditor/attachment_files'
21
+
22
+ config.allowedContent = true
23
+ # Rails CSRF token
24
+
25
+ config.filebrowserParams = ->
26
+ csrf_token = undefined
27
+ csrf_param = undefined
28
+ meta = undefined
29
+ metas = document.getElementsByTagName('meta')
30
+ params = new Object
31
+ i = 0
32
+ while i < metas.length
33
+ meta = metas[i]
34
+ switch meta.name
35
+ when 'csrf-token'
36
+ csrf_token = meta.content
37
+ when 'csrf-param'
38
+ csrf_param = meta.content
39
+ else
40
+ i++
41
+ continue
42
+ i++
43
+ if csrf_param != undefined and csrf_token != undefined
44
+ params[csrf_param] = csrf_token
45
+ params
46
+
47
+ config.addQueryString = (url, params) ->
48
+ queryString = []
49
+ if !params
50
+ return url
51
+ else
52
+ for i of params
53
+ queryString.push i + '=' + encodeURIComponent(params[i])
54
+ url + (if url.indexOf('?') != -1 then '&' else '?') + queryString.join('&')
55
+
56
+ # Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash)
57
+ CKEDITOR.on 'dialogDefinition', (ev) ->
58
+ # Take the dialog name and its definition from the event data.
59
+ dialogName = ev.data.name
60
+ dialogDefinition = ev.data.definition
61
+ content = undefined
62
+ upload = undefined
63
+ if CKEDITOR.tools.indexOf([
64
+ 'link'
65
+ 'image'
66
+ 'attachment'
67
+ 'flash'
68
+ ], dialogName) > -1
69
+ content = dialogDefinition.getContents('Upload') or dialogDefinition.getContents('upload')
70
+ upload = if content == null then null else content.get('upload')
71
+ if upload and upload.filebrowser and upload.filebrowser['params'] == undefined
72
+ upload.filebrowser['params'] = config.filebrowserParams()
73
+ upload.action = config.addQueryString(upload.action, upload.filebrowser['params'])
74
+ return
75
+ # Toolbar groups configuration.
76
+ config.toolbar = [
77
+ {
78
+ name: 'document'
79
+ groups: [
80
+ 'mode'
81
+ 'document'
82
+ 'doctools'
83
+ ]
84
+ items: [ 'Source' ]
85
+ }
86
+ {
87
+ name: 'clipboard'
88
+ groups: [
89
+ 'clipboard'
90
+ 'undo'
91
+ ]
92
+ items: [
93
+ 'Cut'
94
+ 'Copy'
95
+ 'Paste'
96
+ 'PasteText'
97
+ 'PasteFromWord'
98
+ '-'
99
+ 'Undo'
100
+ 'Redo'
101
+ ]
102
+ }
103
+ {
104
+ name: 'links'
105
+ items: [
106
+ 'Link'
107
+ 'Unlink'
108
+ 'Anchor'
109
+ ]
110
+ }
111
+ {
112
+ name: 'insert'
113
+ items: [
114
+ 'Image'
115
+ 'Flash'
116
+ 'Table'
117
+ 'HorizontalRule'
118
+ 'SpecialChar'
119
+ ]
120
+ }
121
+ {
122
+ name: 'paragraph'
123
+ groups: [
124
+ 'list'
125
+ 'indent'
126
+ 'blocks'
127
+ 'align'
128
+ 'bidi'
129
+ ]
130
+ items: [
131
+ 'NumberedList'
132
+ 'BulletedList'
133
+ '-'
134
+ 'Outdent'
135
+ 'Indent'
136
+ '-'
137
+ 'Blockquote'
138
+ 'CreateDiv'
139
+ '-'
140
+ 'JustifyLeft'
141
+ 'JustifyCenter'
142
+ 'JustifyRight'
143
+ 'JustifyBlock'
144
+ ]
145
+ }
146
+ '/'
147
+ {
148
+ name: 'styles'
149
+ items: [
150
+ 'Styles'
151
+ 'Format'
152
+ 'Font'
153
+ 'FontSize'
154
+ ]
155
+ }
156
+ {
157
+ name: 'colors'
158
+ items: [
159
+ 'TextColor'
160
+ 'BGColor'
161
+ ]
162
+ }
163
+ {
164
+ name: 'basicstyles'
165
+ groups: [
166
+ 'basicstyles'
167
+ 'cleanup'
168
+ ]
169
+ items: [
170
+ 'Bold'
171
+ 'Italic'
172
+ 'Underline'
173
+ 'Strike'
174
+ 'Subscript'
175
+ 'Superscript'
176
+ '-'
177
+ 'RemoveFormat'
178
+ ]
179
+ }
180
+ ]
181
+ config.toolbar_mini = [
182
+ {
183
+ name: 'paragraph'
184
+ groups: [
185
+ 'list'
186
+ 'indent'
187
+ 'blocks'
188
+ 'align'
189
+ 'bidi'
190
+ ]
191
+ items: [
192
+ 'NumberedList'
193
+ 'BulletedList'
194
+ '-'
195
+ 'Outdent'
196
+ 'Indent'
197
+ '-'
198
+ 'Blockquote'
199
+ 'CreateDiv'
200
+ '-'
201
+ 'JustifyLeft'
202
+ 'JustifyCenter'
203
+ 'JustifyRight'
204
+ 'JustifyBlock'
205
+ ]
206
+ }
207
+ {
208
+ name: 'styles'
209
+ items: [
210
+ 'Font'
211
+ 'FontSize'
212
+ ]
213
+ }
214
+ {
215
+ name: 'colors'
216
+ items: [
217
+ 'TextColor'
218
+ 'BGColor'
219
+ ]
220
+ }
221
+ {
222
+ name: 'basicstyles'
223
+ groups: [
224
+ 'basicstyles'
225
+ 'cleanup'
226
+ ]
227
+ items: [
228
+ 'Bold'
229
+ 'Italic'
230
+ 'Underline'
231
+ 'Strike'
232
+ 'Subscript'
233
+ 'Superscript'
234
+ '-'
235
+ 'RemoveFormat'
236
+ ]
237
+ }
238
+ {
239
+ name: 'insert'
240
+ items: [
241
+ 'Image'
242
+ 'Table'
243
+ 'HorizontalRule'
244
+ 'SpecialChar'
245
+ ]
246
+ }
247
+ ]
248
+ return