Commit d7af47e3d9e166332f5b559b327ab0bb845766a0

Authored by Antonio Terceiro
1 parent f8df6354

Replace @controller by controller in views and helpers

On Rails 3 support for @controller was removed
app/helpers/application_helper.rb
... ... @@ -163,7 +163,7 @@ module ApplicationHelper
163 163 # should be a current profile (i.e. while viewing some profile's pages, or the
164 164 # profile info, etc), because if there is no profile an exception is thrown.
165 165 def profile
166   - @controller.send(:profile)
  166 + controller.send(:profile)
167 167 end
168 168  
169 169 def category_color
... ... @@ -290,7 +290,7 @@ module ApplicationHelper
290 290 def partial_for_class(klass, suffix=nil)
291 291 raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?' if klass.nil?
292 292 name = klass.name.underscore
293   - @controller.view_paths.each do |view_path|
  293 + controller.view_paths.each do |view_path|
294 294 partial = partial_for_class_in_view_path(klass, view_path, suffix)
295 295 return partial if partial
296 296 end
... ... @@ -310,7 +310,7 @@ module ApplicationHelper
310 310 end
311 311  
312 312 def user
313   - @controller.send(:user)
  313 + controller.send(:user)
314 314 end
315 315  
316 316 # DEPRECATED. Do not use this.
... ... @@ -433,7 +433,7 @@ module ApplicationHelper
433 433 end
434 434  
435 435 def is_testing_theme
436   - !@controller.session[:theme].nil?
  436 + !controller.session[:theme].nil?
437 437 end
438 438  
439 439 def theme_owner
... ... @@ -939,7 +939,7 @@ module ApplicationHelper
939 939 (@topic ? @topic.title + ' - ' : '') +
940 940 (@section ? @section.title + ' - ' : '') +
941 941 (@toc ? _('Online Manual') + ' - ' : '') +
942   - (@controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') +
  942 + (controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') +
943 943 environment.name +
944 944 (@category ? " - #{@category.full_name}" : '')
945 945 end
... ... @@ -963,7 +963,7 @@ module ApplicationHelper
963 963  
964 964 # DEPRECATED. Do not use this·
965 965 def import_controller_stylesheets(options = {})
966   - stylesheet_import( "controller_"+ @controller.controller_name(), options )
  966 + stylesheet_import( "controller_"+ controller.controller_name(), options )
967 967 end
968 968  
969 969 def pngfix_stylesheet_path
... ... @@ -1125,7 +1125,7 @@ module ApplicationHelper
1125 1125 def render_environment_features(folder)
1126 1126 result = ''
1127 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 1129 if File.exists?(file)
1130 1130 result << render(:file => file, :use_full_path => false)
1131 1131 end
... ...
app/helpers/boxes_helper.rb
1 1 module BoxesHelper
2 2  
3 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 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 10 else
11 11 content_tag('div',
12 12 content_tag('div',
... ... @@ -16,7 +16,7 @@ module BoxesHelper
16 16 :class => 'no-boxes'
17 17 )
18 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 20 end
21 21 end
22 22  
... ... @@ -99,7 +99,7 @@ module BoxesHelper
99 99 unless block.visible?
100 100 options[:title] = _("This block is invisible. Your visitors will not see it.")
101 101 end
102   - @controller.send(:content_editor?) || @plugins.each do |plugin|
  102 + controller.send(:content_editor?) || @plugins.each do |plugin|
103 103 result = plugin.parse_content(result)
104 104 end
105 105 box_decorator.block_target(block.box, block) +
... ... @@ -220,7 +220,7 @@ module BoxesHelper
220 220 end
221 221  
222 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 224 end
225 225  
226 226 # DEPRECATED. Do not use this.
... ...
app/views/layouts/application-ng.html.erb
... ... @@ -33,8 +33,8 @@
33 33 </head>
34 34 <body class="<%=
35 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 38 " template-"+ ( profile.nil? ? "default" : profile.layout_template ) +
39 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 33  
34 34 <body class='noosfero category<%= category_color %><%=
35 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 38 %>' onload='noosfero_init();'
39 39 onresize="registerDocumentSize()">
40 40 <script type="text/javascript">
... ...