community_engine 3.0.0 → 3.2.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 (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
@@ -1,5 +1,5 @@
1
1
  class AuthorizationsController < BaseController
2
- before_filter :login_required, :only => [:destroy]
2
+ before_action :login_required, :only => [:destroy]
3
3
 
4
4
  def create
5
5
  omniauth = request.env['omniauth.auth'] #this is where you get all the data from your provider through omniauth
@@ -3,19 +3,21 @@ require 'open-uri'
3
3
  require 'pp'
4
4
 
5
5
  class BaseController < ApplicationController
6
-
7
6
  include AuthenticatedSystem
7
+ include Pundit
8
8
  include LocalizedApplication
9
9
  include BaseHelper
10
10
 
11
- around_filter :set_locale
12
- skip_before_filter :verify_authenticity_token, :only => :footer_content
13
- before_filter :initialize_header_tabs
14
- before_filter :initialize_admin_tabs
15
- before_filter :store_location, :except => :footer_content
11
+ around_action :set_locale
12
+ skip_before_action :verify_authenticity_token, :only => :footer_content
13
+ before_action :initialize_header_tabs
14
+
15
+ before_action :store_location, :except => :footer_content
16
16
 
17
17
  caches_action :site_index, :footer_content, :if => Proc.new{|c| c.cache_action? }
18
18
 
19
+ rescue_from Pundit::NotAuthorizedError, with: :access_denied
20
+
19
21
  def cache_action?
20
22
  !logged_in? && controller_name.eql?('base') && params[:format].blank?
21
23
  end
@@ -60,28 +62,8 @@ class BaseController < ApplicationController
60
62
  def advertise
61
63
  end
62
64
 
63
- protected
64
- def self.uses_tiny_mce(options = {}, &block)
65
- if block_given?
66
- options = block.call
67
- end
68
-
69
- new_configuration = TinyMCE::Rails.configuration.merge(options.delete(:options)).options
70
- new_configuration.stringify_keys!
71
-
72
- # Set instance vars in the current class
73
- p = Proc.new do |c|
74
- configuration = c.instance_variable_get(:@tiny_mce_configuration) || {}
75
-
76
- c.instance_variable_set(:@tiny_mce_configuration, configuration.merge(new_configuration))
77
- c.instance_variable_set(:@uses_tiny_mce, true)
78
- end
79
-
80
- before_filter p, options
81
- end
82
-
83
-
84
65
  private
66
+
85
67
  def admin_required
86
68
  current_user && current_user.admin? ? true : access_denied
87
69
  end
@@ -147,10 +129,5 @@ class BaseController < ApplicationController
147
129
  # Usage: @header_tabs << {:name => "My tab", :url => my_tab_path, :section => 'my_tab_section' }
148
130
  @header_tabs = []
149
131
  end
150
- def initialize_admin_tabs
151
- # This hook allows plugins or host apps to easily add tabs to the admin nav by adding to the @admin_nav_links array
152
- # Usage: @admin_nav_links << {:name => "My link", :url => my_link_path, }
153
- @admin_nav_links = []
154
- end
155
132
 
156
133
  end
@@ -1,19 +1,6 @@
1
1
  class CategoriesController < BaseController
2
- before_filter :login_required, :except => [:show, :most_viewed, :rss]
3
- before_filter :admin_required, :only => [:new, :edit, :update, :create, :destroy, :index]
2
+ before_action :login_required, :except => [:show, :most_viewed, :rss]
4
3
 
5
- cache_sweeper :category_sweeper, :only => [:create, :update, :destroy]
6
-
7
- # GET /categories
8
- # GET /categories.xml
9
- def index
10
- @categories = Category.all
11
-
12
- respond_to do |format|
13
- format.html # index.rhtml
14
- format.xml { render :xml => @categories.to_xml }
15
- end
16
- end
17
4
 
18
5
  # GET /categories/1
19
6
  # GET /categories/1.xml
@@ -44,64 +31,6 @@ class CategoriesController < BaseController
44
31
  end
45
32
  end
46
33
 
47
- # GET /categories/new
48
- def new
49
- @category = Category.new
50
- end
51
-
52
- # GET /categories/1;edit
53
- def edit
54
- @category = Category.find(params[:id])
55
- end
56
-
57
- # POST /categories
58
- # POST /categories.xml
59
- def create
60
- @category = Category.new(category_params)
61
-
62
- respond_to do |format|
63
- if @category.save
64
- flash[:notice] = :category_was_successfully_created.l
65
-
66
- format.html { redirect_to category_url(@category) }
67
- format.xml do
68
- headers["Location"] = category_url(@category)
69
- render :nothing => true, :status => "201 Created"
70
- end
71
- else
72
- format.html { render :action => "new" }
73
- format.xml { render :xml => @category.errors.to_xml }
74
- end
75
- end
76
- end
77
-
78
- # patch /categories/1
79
- # patch /categories/1.xml
80
- def update
81
- @category = Category.find(params[:id])
82
-
83
- respond_to do |format|
84
- if @category.update_attributes(category_params)
85
- format.html { redirect_to category_url(@category) }
86
- format.xml { render :nothing => true }
87
- else
88
- format.html { render :action => "edit" }
89
- format.xml { render :xml => @category.errors.to_xml }
90
- end
91
- end
92
- end
93
-
94
- # DELETE /categories/1
95
- # DELETE /categories/1.xml
96
- def destroy
97
- @category = Category.find(params[:id])
98
- @category.destroy
99
-
100
- respond_to do |format|
101
- format.html { redirect_to categories_url }
102
- format.xml { render :nothing => true }
103
- end
104
- end
105
34
 
106
35
  def show_tips
107
36
  @category = Category.find(params[:id] )
@@ -111,10 +40,4 @@ class CategoriesController < BaseController
111
40
  end
112
41
 
113
42
 
114
- private
115
-
116
- def category_params
117
- params[:category].permit(:name, :tips, :new_post_text, :nav_text)
118
- end
119
-
120
43
  end
@@ -1,11 +1,7 @@
1
1
  class ClippingsController < BaseController
2
- before_filter :login_required, :only => [:new, :edit, :update, :create, :destroy, :new_clipping]
3
- before_filter :find_user, :only => [:new, :edit, :index, :show]
4
- before_filter :require_current_user, :only => [:new, :edit, :update, :destroy]
5
-
6
- uses_tiny_mce do
7
- {:only => [:show,:new_clipping], :options => configatron.default_mce_options}
8
- end
2
+ before_action :login_required, :only => [:new, :edit, :update, :create, :destroy, :new_clipping]
3
+ before_action :find_user, :only => [:new, :edit, :index, :show]
4
+ before_action :require_current_user, :only => [:new, :edit, :update, :destroy]
9
5
 
10
6
  cache_sweeper :taggable_sweeper, :only => [:create, :update, :destroy]
11
7
 
@@ -1,14 +1,10 @@
1
1
  class CommentsController < BaseController
2
- before_filter :login_required, :except => [:index, :unsubscribe]
3
- before_filter :admin_or_moderator_required, :only => [:delete_selected, :edit, :update, :approve, :disapprove]
2
+ before_action :login_required, :except => [:index, :unsubscribe]
3
+ before_action :admin_or_moderator_required, :only => [:delete_selected, :edit, :update, :approve, :disapprove]
4
4
 
5
5
  if configatron.allow_anonymous_commenting
6
- skip_before_filter :verify_authenticity_token, :only => [:create] #because the auth token might be cached anyway
7
- skip_before_filter :login_required, :only => [:create]
8
- end
9
-
10
- uses_tiny_mce do
11
- {:only => [:index, :edit, :update], :options => configatron.simple_mce_options}
6
+ skip_before_action :verify_authenticity_token, :only => [:create] #because the auth token might be cached anyway
7
+ skip_before_action :login_required, :only => [:create]
12
8
  end
13
9
 
14
10
  cache_sweeper :comment_sweeper, :only => [:create, :destroy]
@@ -141,22 +137,6 @@ class CommentsController < BaseController
141
137
  end
142
138
  end
143
139
 
144
- def delete_selected
145
- if request.delete?
146
- if params[:delete]
147
- params[:delete].each { |id|
148
- comment = Comment.find(id)
149
- comment.spam! if params[:spam] && configatron.has_key?(:akismet_key)
150
- comment.destroy if comment.can_be_deleted_by(current_user)
151
- }
152
- end
153
- flash[:notice] = :comments_deleted.l
154
- else
155
- flash[:error] = :comments_not_deleted.l
156
- end
157
- redirect_to admin_comments_path
158
- end
159
-
160
140
 
161
141
  def unsubscribe
162
142
  @comment = Comment.find(params[:id])
@@ -4,16 +4,7 @@ class EventsController < BaseController
4
4
  caches_page :ical
5
5
  cache_sweeper :event_sweeper, :only => [:create, :update, :destroy]
6
6
 
7
-
8
- uses_tiny_mce do
9
- {:only => [:new, :edit, :create, :update, :clone ], :options => configatron.default_mce_options}
10
- end
11
-
12
- uses_tiny_mce do
13
- {:only => [:show], :options => configatron.simple_mce_options}
14
- end
15
-
16
- before_filter :admin_required, :except => [:index, :show, :ical]
7
+ before_action :admin_required, :except => [:index, :show, :ical]
17
8
 
18
9
  def ical
19
10
  @calendar = RiCal.Calendar
@@ -25,7 +16,7 @@ class EventsController < BaseController
25
16
  event.dtend = ce_event.end_time
26
17
  event.summary = ce_event.name + (ce_event.metro_area.blank? ? '' : " (#{ce_event.metro_area})")
27
18
  coder = HTMLEntities.new
28
- event.description = (ce_event.description.blank? ? '' : coder.decode(help.strip_tags(ce_event.description).to_s) + "\n\n") + event_url(ce_event)
19
+ event.description = (ce_event.description.blank? ? '' : coder.decode(view_context.strip_tags(ce_event.description).to_s) + "\n\n") + event_url(ce_event)
29
20
  event.location = ce_event.location unless ce_event.location.blank?
30
21
  end
31
22
  @calendar.add_subcomponent rical_event
@@ -146,7 +137,7 @@ class EventsController < BaseController
146
137
  elsif object.is_a? User
147
138
  states = object.country.states if object.country
148
139
  if object.state
149
- metro_areas = object.state.metro_areas..order("name")
140
+ metro_areas = object.state.metro_areas.order("name")
150
141
  else
151
142
  metro_areas = object.country.metro_areas.order("name")
152
143
  end
@@ -1,6 +1,6 @@
1
1
  class FavoritesController < BaseController
2
- before_filter :login_required, :only => [:destroy]
3
- before_filter :find_user, :only => [:show, :index]
2
+ before_action :login_required, :only => [:destroy]
3
+ before_action :find_user, :only => [:show, :index]
4
4
 
5
5
  cache_sweeper :favorite_sweeper, :only => [:create, :destroy]
6
6
 
@@ -1,10 +1,6 @@
1
1
  class ForumsController < BaseController
2
2
  before_action :admin_required, :except => [:index, :show]
3
3
 
4
- uses_tiny_mce do
5
- {:options => configatron.default_mce_options}
6
- end
7
-
8
4
  def index
9
5
  @forums = Forum.order("position")
10
6
  respond_to do |format|
@@ -22,7 +18,7 @@ class ForumsController < BaseController
22
18
 
23
19
  @topics = @forum.topics.includes(:replied_by_user).order('sticky DESC, replied_at DESC').page(params[:page]).per(20)
24
20
  end
25
-
21
+
26
22
  format.xml do
27
23
  render :xml => @forum
28
24
  end
@@ -32,7 +28,7 @@ class ForumsController < BaseController
32
28
  def new
33
29
  @forum = Forum.new
34
30
  end
35
-
31
+
36
32
  def create
37
33
  @forum = Forum.new(forum_params)
38
34
  @forum.tag_list = params[:tag_list] || ''
@@ -56,7 +52,7 @@ class ForumsController < BaseController
56
52
  format.xml { head 200 }
57
53
  end
58
54
  end
59
-
55
+
60
56
  def destroy
61
57
  @forum = Forum.find(params[:id])
62
58
  @forum.destroy
@@ -65,11 +61,11 @@ class ForumsController < BaseController
65
61
  format.xml { head 200 }
66
62
  end
67
63
  end
68
-
64
+
69
65
  private
70
66
 
71
67
  def forum_params
72
68
  params[:forum].permit(:name, :position, :description)
73
69
  end
74
-
70
+
75
71
  end
@@ -1,5 +1,5 @@
1
1
  class InvitationsController < BaseController
2
- before_filter :login_required
2
+ before_action :login_required
3
3
 
4
4
  def index
5
5
  @user = current_user
@@ -1,13 +1,9 @@
1
1
  class MessagesController < BaseController
2
- before_filter :find_user
3
- before_filter :login_required
4
- before_filter :require_ownership_or_moderator, :except => [:auto_complete_for_username]
2
+ before_action :find_user
3
+ before_action :login_required
4
+ before_action :require_ownership_or_moderator, :except => [:auto_complete_for_username]
5
5
 
6
- skip_before_filter :verify_authenticity_token, :only => [:auto_complete_for_username]
7
-
8
- uses_tiny_mce do
9
- {:options => configatron.default_mce_options}
10
- end
6
+ skip_before_action :verify_authenticity_token, :only => [:auto_complete_for_username]
11
7
 
12
8
  def auto_complete_for_username
13
9
  @usernames = User.active.where.not(login: @user.login).pluck(:login)
@@ -1,5 +1,5 @@
1
1
  class ModeratorsController < BaseController
2
- before_filter :admin_required
2
+ before_action :admin_required
3
3
 
4
4
  def create
5
5
  @forum = Forum.find(params[:forum_id])
@@ -1,5 +1,5 @@
1
1
  class MonitorshipsController < BaseController
2
- before_filter :login_required
2
+ before_action :login_required
3
3
 
4
4
  def create
5
5
  @monitorship = Monitorship.find_or_initialize_by(:user_id => current_user.id, :topic_id => params[:topic_id])
@@ -1,27 +1,11 @@
1
1
  class PagesController < BaseController
2
- uses_tiny_mce do
3
- {:only => [:new, :edit, :update, :create ], :options => configatron.default_mce_options}
4
- end
5
2
 
6
- cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
7
3
  caches_action :show, :if => Proc.new{|c| c.cache_action? }
8
4
 
9
5
  def cache_action?
10
6
  !logged_in? && controller_name.eql?('pages')
11
7
  end
12
8
 
13
- before_filter :login_required, :only => [:index, :new, :edit, :update, :destroy, :create, :preview]
14
- before_filter :require_moderator, :only => [:index, :new, :edit, :update, :destroy, :create, :preview]
15
-
16
- def index
17
- @pages = Page.unscoped.order('created_at DESC').page(params[:page])
18
- end
19
-
20
- def preview
21
- @page = Page.unscoped.find(params[:id])
22
- render :action => :show
23
- end
24
-
25
9
  def show
26
10
  @page = Page.live.find(params[:id])
27
11
  unless logged_in? || @page.page_public
@@ -32,51 +16,5 @@ class PagesController < BaseController
32
16
  flash[:error] = :page_not_found.l
33
17
  redirect_to home_path
34
18
  end
35
-
36
- def new
37
- @page = Page.new
38
- end
39
-
40
- def edit
41
- @page = Page.unscoped.find(params[:id])
42
- end
43
-
44
- def create
45
- @page = Page.new(page_params)
46
- if @page.save
47
- flash[:notice] = :page_was_successfully_created.l
48
- redirect_to admin_pages_path
49
- else
50
- render :action => :new
51
- end
52
- end
53
-
54
- def update
55
- if @page.update_attributes(page_params)
56
- flash[:notice] = :page_was_successfully_updated.l
57
- redirect_to admin_pages_path
58
- else
59
- render :action => :edit
60
- end
61
- end
62
-
63
- def destroy
64
- @page.destroy
65
- flash[:notice] = :page_was_successfully_deleted.l
66
- redirect_to admin_pages_path
67
- end
68
-
69
- private
70
-
71
- def require_moderator
72
- @page ||= Page.unscoped.find(params[:id]) if params[:id]
73
- unless admin? || moderator?
74
- redirect_to :controller => 'sessions', :action => 'new' and return false
75
- end
76
- end
77
-
78
- def page_params
79
- params.require(:page).permit(:title, :body, :published_as, :page_public)
80
- end
81
19
 
82
20
  end