Commit d7af47e3d9e166332f5b559b327ab0bb845766a0
1 parent
f8df6354
Exists in
master
and in
29 other branches
Replace @controller by controller in views and helpers
On Rails 3 support for @controller was removed
Showing
4 changed files
with
19 additions
and
19 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -163,7 +163,7 @@ module ApplicationHelper | @@ -163,7 +163,7 @@ module ApplicationHelper | ||
163 | # should be a current profile (i.e. while viewing some profile's pages, or the | 163 | # should be a current profile (i.e. while viewing some profile's pages, or the |
164 | # profile info, etc), because if there is no profile an exception is thrown. | 164 | # profile info, etc), because if there is no profile an exception is thrown. |
165 | def profile | 165 | def profile |
166 | - @controller.send(:profile) | 166 | + controller.send(:profile) |
167 | end | 167 | end |
168 | 168 | ||
169 | def category_color | 169 | def category_color |
@@ -290,7 +290,7 @@ module ApplicationHelper | @@ -290,7 +290,7 @@ module ApplicationHelper | ||
290 | def partial_for_class(klass, suffix=nil) | 290 | def partial_for_class(klass, suffix=nil) |
291 | raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?' if klass.nil? | 291 | raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?' if klass.nil? |
292 | name = klass.name.underscore | 292 | name = klass.name.underscore |
293 | - @controller.view_paths.each do |view_path| | 293 | + controller.view_paths.each do |view_path| |
294 | partial = partial_for_class_in_view_path(klass, view_path, suffix) | 294 | partial = partial_for_class_in_view_path(klass, view_path, suffix) |
295 | return partial if partial | 295 | return partial if partial |
296 | end | 296 | end |
@@ -310,7 +310,7 @@ module ApplicationHelper | @@ -310,7 +310,7 @@ module ApplicationHelper | ||
310 | end | 310 | end |
311 | 311 | ||
312 | def user | 312 | def user |
313 | - @controller.send(:user) | 313 | + controller.send(:user) |
314 | end | 314 | end |
315 | 315 | ||
316 | # DEPRECATED. Do not use this. | 316 | # DEPRECATED. Do not use this. |
@@ -433,7 +433,7 @@ module ApplicationHelper | @@ -433,7 +433,7 @@ module ApplicationHelper | ||
433 | end | 433 | end |
434 | 434 | ||
435 | def is_testing_theme | 435 | def is_testing_theme |
436 | - !@controller.session[:theme].nil? | 436 | + !controller.session[:theme].nil? |
437 | end | 437 | end |
438 | 438 | ||
439 | def theme_owner | 439 | def theme_owner |
@@ -939,7 +939,7 @@ module ApplicationHelper | @@ -939,7 +939,7 @@ module ApplicationHelper | ||
939 | (@topic ? @topic.title + ' - ' : '') + | 939 | (@topic ? @topic.title + ' - ' : '') + |
940 | (@section ? @section.title + ' - ' : '') + | 940 | (@section ? @section.title + ' - ' : '') + |
941 | (@toc ? _('Online Manual') + ' - ' : '') + | 941 | (@toc ? _('Online Manual') + ' - ' : '') + |
942 | - (@controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') + | 942 | + (controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') + |
943 | environment.name + | 943 | environment.name + |
944 | (@category ? " - #{@category.full_name}" : '') | 944 | (@category ? " - #{@category.full_name}" : '') |
945 | end | 945 | end |
@@ -963,7 +963,7 @@ module ApplicationHelper | @@ -963,7 +963,7 @@ module ApplicationHelper | ||
963 | 963 | ||
964 | # DEPRECATED. Do not use this· | 964 | # DEPRECATED. Do not use this· |
965 | def import_controller_stylesheets(options = {}) | 965 | def import_controller_stylesheets(options = {}) |
966 | - stylesheet_import( "controller_"+ @controller.controller_name(), options ) | 966 | + stylesheet_import( "controller_"+ controller.controller_name(), options ) |
967 | end | 967 | end |
968 | 968 | ||
969 | def pngfix_stylesheet_path | 969 | def pngfix_stylesheet_path |
@@ -1125,7 +1125,7 @@ module ApplicationHelper | @@ -1125,7 +1125,7 @@ module ApplicationHelper | ||
1125 | def render_environment_features(folder) | 1125 | def render_environment_features(folder) |
1126 | result = '' | 1126 | result = '' |
1127 | environment.enabled_features.keys.each do |feature| | 1127 | environment.enabled_features.keys.each do |feature| |
1128 | - file = File.join(@controller.view_paths.last, 'shared', folder.to_s, "#{feature}.rhtml") | 1128 | + file = File.join(controller.view_paths.last, 'shared', folder.to_s, "#{feature}.rhtml") |
1129 | if File.exists?(file) | 1129 | if File.exists?(file) |
1130 | result << render(:file => file, :use_full_path => false) | 1130 | result << render(:file => file, :use_full_path => false) |
1131 | end | 1131 | end |
app/helpers/boxes_helper.rb
1 | module BoxesHelper | 1 | module BoxesHelper |
2 | 2 | ||
3 | def insert_boxes(content) | 3 | def insert_boxes(content) |
4 | - if @controller.send(:boxes_editor?) && @controller.send(:uses_design_blocks?) | ||
5 | - content + display_boxes_editor(@controller.boxes_holder) | 4 | + if controller.send(:boxes_editor?) && @controller.send(:uses_design_blocks?) |
5 | + content + display_boxes_editor(controller.boxes_holder) | ||
6 | else | 6 | else |
7 | - maybe_display_custom_element(@controller.boxes_holder, :custom_header_expanded, :id => 'profile-header') + | ||
8 | - if @controller.send(:uses_design_blocks?) | ||
9 | - display_boxes(@controller.boxes_holder, content) | 7 | + maybe_display_custom_element(controller.boxes_holder, :custom_header_expanded, :id => 'profile-header') + |
8 | + if controller.send(:uses_design_blocks?) | ||
9 | + display_boxes(controller.boxes_holder, content) | ||
10 | else | 10 | else |
11 | content_tag('div', | 11 | content_tag('div', |
12 | content_tag('div', | 12 | content_tag('div', |
@@ -16,7 +16,7 @@ module BoxesHelper | @@ -16,7 +16,7 @@ module BoxesHelper | ||
16 | :class => 'no-boxes' | 16 | :class => 'no-boxes' |
17 | ) | 17 | ) |
18 | end + | 18 | end + |
19 | - maybe_display_custom_element(@controller.boxes_holder, :custom_footer_expanded, :id => 'profile-footer') | 19 | + maybe_display_custom_element(controller.boxes_holder, :custom_footer_expanded, :id => 'profile-footer') |
20 | end | 20 | end |
21 | end | 21 | end |
22 | 22 | ||
@@ -99,7 +99,7 @@ module BoxesHelper | @@ -99,7 +99,7 @@ module BoxesHelper | ||
99 | unless block.visible? | 99 | unless block.visible? |
100 | options[:title] = _("This block is invisible. Your visitors will not see it.") | 100 | options[:title] = _("This block is invisible. Your visitors will not see it.") |
101 | end | 101 | end |
102 | - @controller.send(:content_editor?) || @plugins.each do |plugin| | 102 | + controller.send(:content_editor?) || @plugins.each do |plugin| |
103 | result = plugin.parse_content(result) | 103 | result = plugin.parse_content(result) |
104 | end | 104 | end |
105 | box_decorator.block_target(block.box, block) + | 105 | box_decorator.block_target(block.box, block) + |
@@ -220,7 +220,7 @@ module BoxesHelper | @@ -220,7 +220,7 @@ module BoxesHelper | ||
220 | end | 220 | end |
221 | 221 | ||
222 | def current_blocks | 222 | def current_blocks |
223 | - @controller.boxes_holder.boxes.map(&:blocks).inject([]){|ac, a| ac + a} | 223 | + controller.boxes_holder.boxes.map(&:blocks).inject([]){|ac, a| ac + a} |
224 | end | 224 | end |
225 | 225 | ||
226 | # DEPRECATED. Do not use this. | 226 | # DEPRECATED. Do not use this. |
app/views/layouts/application-ng.html.erb
@@ -33,8 +33,8 @@ | @@ -33,8 +33,8 @@ | ||
33 | </head> | 33 | </head> |
34 | <body class="<%= | 34 | <body class="<%= |
35 | # Identify the current controller and action for the CSS: | 35 | # Identify the current controller and action for the CSS: |
36 | - " controller-"+ @controller.controller_name() + | ||
37 | - " action-"+ @controller.controller_name() +"-"+ @controller.action_name() + | 36 | + " controller-"+ controller.controller_name() + |
37 | + " action-"+ controller.controller_name() +"-"+ controller.action_name() + | ||
38 | " template-"+ ( profile.nil? ? "default" : profile.layout_template ) + | 38 | " template-"+ ( profile.nil? ? "default" : profile.layout_template ) + |
39 | (!profile.nil? && profile.is_on_homepage?(request.path,@page) ? " profile-homepage" : "") | 39 | (!profile.nil? && profile.is_on_homepage?(request.path,@page) ? " profile-homepage" : "") |
40 | %>" > | 40 | %>" > |
app/views/layouts/application.html.erb
@@ -33,8 +33,8 @@ | @@ -33,8 +33,8 @@ | ||
33 | 33 | ||
34 | <body class='noosfero category<%= category_color %><%= | 34 | <body class='noosfero category<%= category_color %><%= |
35 | # Identify the current controller and action for the CSS: | 35 | # Identify the current controller and action for the CSS: |
36 | - " controller-"+ @controller.controller_name() + | ||
37 | - " action_"+ @controller.controller_name() +"_"+ @controller.action_name() | 36 | + " controller-"+ controller.controller_name() + |
37 | + " action_"+ controller.controller_name() +"_"+ controller.action_name() | ||
38 | %>' onload='noosfero_init();' | 38 | %>' onload='noosfero_init();' |
39 | onresize="registerDocumentSize()"> | 39 | onresize="registerDocumentSize()"> |
40 | <script type="text/javascript"> | 40 | <script type="text/javascript"> |