##// END OF EJS Templates
replaced deprecated controller instance variables: @params, @session, @request...
Jean-Philippe Lang -
r124:95cc65f14e02
parent child
Show More
@@ -31,7 +31,7 class AdminController < ApplicationController
31 31 @project_count = Project.count
32 32 @project_pages = Paginator.new self, @project_count,
33 33 15,
34 @params['page']
34 params['page']
35 35 @projects = Project.find :all, :order => sort_clause,
36 36 :limit => @project_pages.items_per_page,
37 37 :offset => @project_pages.current.offset
@@ -71,7 +71,7 class ApplicationController < ActionController::Base
71 71 end
72 72
73 73 # authorizes the user for the requested action.
74 def authorize(ctrl = @params[:controller], action = @params[:action])
74 def authorize(ctrl = params[:controller], action = params[:action])
75 75 # check if action is allowed on public projects
76 76 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
77 77 return true
@@ -92,7 +92,7 class ApplicationController < ActionController::Base
92 92 # store current uri in session.
93 93 # return to this location by calling redirect_back_or_default
94 94 def store_location
95 session[:return_to] = @request.request_uri
95 session[:return_to] = request.request_uri
96 96 end
97 97
98 98 # move to the last store_location call or to the passed default one
@@ -23,11 +23,11 class HelpController < ApplicationController
23 23 # displays help page for the requested controller/action
24 24 def index
25 25 # select help page to display
26 if @params[:ctrl] and @help_config['pages'][@params[:ctrl]]
27 if @params[:page] and @help_config['pages'][@params[:ctrl]][@params[:page]]
28 template = @help_config['pages'][@params[:ctrl]][@params[:page]]
26 if params[:ctrl] and @help_config['pages'][params[:ctrl]]
27 if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]
28 template = @help_config['pages'][params[:ctrl]][params[:page]]
29 29 else
30 template = @help_config['pages'][@params[:ctrl]]['index']
30 template = @help_config['pages'][params[:ctrl]]['index']
31 31 end
32 32 end
33 33 # choose language according to available help translations
@@ -72,7 +72,7 class IssuesController < ApplicationController
72 72 #@history.status = @issue.status
73 73 if @issue.save
74 74 flash[:notice] = l(:notice_successful_update)
75 Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
75 Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
76 76 redirect_to :action => 'show', :id => @issue
77 77 return
78 78 end
@@ -97,7 +97,7 class IssuesController < ApplicationController
97 97 @issue.status = @new_status
98 98 if @issue.update_attributes(params[:issue])
99 99 flash[:notice] = l(:notice_successful_update)
100 Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
100 Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
101 101 redirect_to :action => 'show', :id => @issue
102 102 end
103 103 rescue ActiveRecord::StaleObjectError
@@ -58,7 +58,7 class MyController < ApplicationController
58 58 def change_password
59 59 @user = self.logged_in_user
60 60 flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
61 if @user.check_password?(@params[:password])
61 if @user.check_password?(params[:password])
62 62 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
63 63 if @user.save
64 64 flash[:notice] = l(:notice_account_password_updated)
@@ -42,7 +42,7 class ProjectsController < ApplicationController
42 42 @project_count = Project.count(["is_public=?", true])
43 43 @project_pages = Paginator.new self, @project_count,
44 44 15,
45 @params['page']
45 params['page']
46 46 @projects = Project.find :all, :order => sort_clause,
47 47 :conditions => ["is_public=?", true],
48 48 :limit => @project_pages.items_per_page,
@@ -59,7 +59,7 class ProjectsController < ApplicationController
59 59 if request.get?
60 60 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
61 61 else
62 @project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
62 @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
63 63 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
64 64 @project.custom_values = @custom_values
65 65 if params[:repository_enabled] && params[:repository_enabled] == "1"
@@ -95,7 +95,7 class ProjectsController < ApplicationController
95 95 # Edit @project
96 96 def edit
97 97 if request.post?
98 @project.custom_fields = IssueCustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
98 @project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
99 99 if params[:custom_fields]
100 100 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
101 101 @project.custom_values = @custom_values
@@ -213,7 +213,7 class ProjectsController < ApplicationController
213 213 if @issue.save
214 214 @attachments.each(&:save)
215 215 flash[:notice] = l(:notice_successful_create)
216 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
216 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
217 217 redirect_to :action => 'list_issues', :id => @project
218 218 end
219 219 end
@@ -236,7 +236,7 class ProjectsController < ApplicationController
236 236
237 237 if @query.valid?
238 238 @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
239 @issue_pages = Paginator.new self, @issue_count, @results_per_page, @params['page']
239 @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
240 240 @issues = Issue.find :all, :order => sort_clause,
241 241 :include => [ :author, :status, :tracker, :project ],
242 242 :conditions => @query.statement,
@@ -32,7 +32,7 class RolesController < ApplicationController
32 32 def new
33 33 @role = Role.new(params[:role])
34 34 if request.post?
35 @role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids]
35 @role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids]
36 36 if @role.save
37 37 flash[:notice] = l(:notice_successful_create)
38 38 redirect_to :action => 'list'
@@ -44,7 +44,7 class RolesController < ApplicationController
44 44 def edit
45 45 @role = Role.find(params[:id])
46 46 if request.post? and @role.update_attributes(params[:role])
47 @role.permissions = Permission.find(@params[:permission_ids] || [])
47 @role.permissions = Permission.find(params[:permission_ids] || [])
48 48 Permission.allowed_to_role_expired
49 49 flash[:notice] = l(:notice_successful_update)
50 50 redirect_to :action => 'list'
@@ -35,7 +35,7 class UsersController < ApplicationController
35 35 @user_count = User.count
36 36 @user_pages = Paginator.new self, @user_count,
37 37 15,
38 @params['page']
38 params['page']
39 39 @users = User.find :all,:order => sort_clause,
40 40 :limit => @user_pages.items_per_page,
41 41 :offset => @user_pages.current.offset
@@ -70,17 +70,17 module ApplicationHelper
70 70 html = ''
71 71 html << link_to_remote(('&#171; ' + l(:label_previous)),
72 72 {:update => "content", :url => { :page => paginator.current.previous }},
73 {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
73 {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
74 74
75 75 html << (pagination_links_each(paginator, options) do |n|
76 76 link_to_remote(n.to_s,
77 {:url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'content'},
78 {:href => url_for(:action => 'list', :params => @params.merge({:page => n}))})
77 {:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},
78 {:href => url_for(:action => 'list', :params => params.merge({:page => n}))})
79 79 end || '')
80 80
81 81 html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
82 82 {:update => "content", :url => { :page => paginator.current.next }},
83 {:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.next}))}) if paginator.current.next
83 {:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
84 84 html
85 85 end
86 86
@@ -61,7 +61,7 module SortHelper
61 61 # defaults to '<controller_name>_sort'.
62 62 #
63 63 def sort_init(default_key, default_order='asc', name=nil)
64 @sort_name = name || @params[:controller] + @params[:action] + '_sort'
64 @sort_name = name || params[:controller] + params[:action] + '_sort'
65 65 @sort_default = {:key => default_key, :order => default_order}
66 66 end
67 67
@@ -69,21 +69,21 module SortHelper
69 69 # sort_clause.
70 70 #
71 71 def sort_update()
72 if @params[:sort_key]
73 sort = {:key => @params[:sort_key], :order => @params[:sort_order]}
74 elsif @session[@sort_name]
75 sort = @session[@sort_name] # Previous sort.
72 if params[:sort_key]
73 sort = {:key => params[:sort_key], :order => params[:sort_order]}
74 elsif session[@sort_name]
75 sort = session[@sort_name] # Previous sort.
76 76 else
77 77 sort = @sort_default
78 78 end
79 @session[@sort_name] = sort
79 session[@sort_name] = sort
80 80 end
81 81
82 82 # Returns an SQL sort clause corresponding to the current sort state.
83 83 # Use this to sort the controller's table items collection.
84 84 #
85 85 def sort_clause()
86 @session[@sort_name][:key] + ' ' + @session[@sort_name][:order]
86 session[@sort_name][:key] + ' ' + session[@sort_name][:order]
87 87 end
88 88
89 89 # Returns a link which sorts by the named column.
@@ -93,7 +93,7 module SortHelper
93 93 # - A sort icon image is positioned to the right of the sort link.
94 94 #
95 95 def sort_link(column, caption=nil)
96 key, order = @session[@sort_name][:key], @session[@sort_name][:order]
96 key, order = session[@sort_name][:key], session[@sort_name][:order]
97 97 if key == column
98 98 if order.downcase == 'asc'
99 99 icon = 'sort_asc'
@@ -2,7 +2,7
2 2
3 3 <% Enumeration::OPTIONS.each do |option, name| %>
4 4
5 <% if @params[:opt]==option %>
5 <% if params[:opt]==option %>
6 6
7 7 <p><%= image_tag 'dir_open' %> <b><%= l(name) %></b></p>
8 8 <ul>
@@ -49,7 +49,7
49 49 <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "picAdmin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
50 50 <% end %>
51 51
52 <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => @params[:controller], :page => @params[:action] }, :target => "new", :class => "picHelp" %></li>
52 <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :target => "new", :class => "picHelp" %></li>
53 53
54 54 <% if loggedin? %>
55 55 <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>
General Comments 0
You need to be logged in to leave comments. Login now