replaced deprecated controller instance variables: @params, @session, @request
git-svn-id: http://redmine.rubyforge.org/svn/trunk@127 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
b3a3d3e2fa
commit
95cc65f14e
|
@ -31,7 +31,7 @@ class AdminController < ApplicationController
|
||||||
@project_count = Project.count
|
@project_count = Project.count
|
||||||
@project_pages = Paginator.new self, @project_count,
|
@project_pages = Paginator.new self, @project_count,
|
||||||
15,
|
15,
|
||||||
@params['page']
|
params['page']
|
||||||
@projects = Project.find :all, :order => sort_clause,
|
@projects = Project.find :all, :order => sort_clause,
|
||||||
:limit => @project_pages.items_per_page,
|
:limit => @project_pages.items_per_page,
|
||||||
:offset => @project_pages.current.offset
|
:offset => @project_pages.current.offset
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# authorizes the user for the requested action.
|
# authorizes the user for the requested action.
|
||||||
def authorize(ctrl = @params[:controller], action = @params[:action])
|
def authorize(ctrl = params[:controller], action = params[:action])
|
||||||
# check if action is allowed on public projects
|
# check if action is allowed on public projects
|
||||||
if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
|
if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
|
||||||
return true
|
return true
|
||||||
|
@ -92,7 +92,7 @@ class ApplicationController < ActionController::Base
|
||||||
# store current uri in session.
|
# store current uri in session.
|
||||||
# return to this location by calling redirect_back_or_default
|
# return to this location by calling redirect_back_or_default
|
||||||
def store_location
|
def store_location
|
||||||
session[:return_to] = @request.request_uri
|
session[:return_to] = request.request_uri
|
||||||
end
|
end
|
||||||
|
|
||||||
# move to the last store_location call or to the passed default one
|
# move to the last store_location call or to the passed default one
|
||||||
|
|
|
@ -23,11 +23,11 @@ class HelpController < ApplicationController
|
||||||
# displays help page for the requested controller/action
|
# displays help page for the requested controller/action
|
||||||
def index
|
def index
|
||||||
# select help page to display
|
# select help page to display
|
||||||
if @params[:ctrl] and @help_config['pages'][@params[:ctrl]]
|
if params[:ctrl] and @help_config['pages'][params[:ctrl]]
|
||||||
if @params[:page] and @help_config['pages'][@params[:ctrl]][@params[:page]]
|
if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]
|
||||||
template = @help_config['pages'][@params[:ctrl]][@params[:page]]
|
template = @help_config['pages'][params[:ctrl]][params[:page]]
|
||||||
else
|
else
|
||||||
template = @help_config['pages'][@params[:ctrl]]['index']
|
template = @help_config['pages'][params[:ctrl]]['index']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# choose language according to available help translations
|
# choose language according to available help translations
|
||||||
|
|
|
@ -72,7 +72,7 @@ class IssuesController < ApplicationController
|
||||||
#@history.status = @issue.status
|
#@history.status = @issue.status
|
||||||
if @issue.save
|
if @issue.save
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
|
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
|
||||||
redirect_to :action => 'show', :id => @issue
|
redirect_to :action => 'show', :id => @issue
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -97,7 +97,7 @@ class IssuesController < ApplicationController
|
||||||
@issue.status = @new_status
|
@issue.status = @new_status
|
||||||
if @issue.update_attributes(params[:issue])
|
if @issue.update_attributes(params[:issue])
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
|
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
|
||||||
redirect_to :action => 'show', :id => @issue
|
redirect_to :action => 'show', :id => @issue
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::StaleObjectError
|
rescue ActiveRecord::StaleObjectError
|
||||||
|
|
|
@ -58,7 +58,7 @@ class MyController < ApplicationController
|
||||||
def change_password
|
def change_password
|
||||||
@user = self.logged_in_user
|
@user = self.logged_in_user
|
||||||
flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
|
flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
|
||||||
if @user.check_password?(@params[:password])
|
if @user.check_password?(params[:password])
|
||||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
if @user.save
|
if @user.save
|
||||||
flash[:notice] = l(:notice_account_password_updated)
|
flash[:notice] = l(:notice_account_password_updated)
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
|
||||||
@project_count = Project.count(["is_public=?", true])
|
@project_count = Project.count(["is_public=?", true])
|
||||||
@project_pages = Paginator.new self, @project_count,
|
@project_pages = Paginator.new self, @project_count,
|
||||||
15,
|
15,
|
||||||
@params['page']
|
params['page']
|
||||||
@projects = Project.find :all, :order => sort_clause,
|
@projects = Project.find :all, :order => sort_clause,
|
||||||
:conditions => ["is_public=?", true],
|
:conditions => ["is_public=?", true],
|
||||||
:limit => @project_pages.items_per_page,
|
:limit => @project_pages.items_per_page,
|
||||||
|
@ -59,7 +59,7 @@ class ProjectsController < ApplicationController
|
||||||
if request.get?
|
if request.get?
|
||||||
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
|
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
|
||||||
else
|
else
|
||||||
@project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
|
@project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
|
||||||
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
|
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
|
||||||
@project.custom_values = @custom_values
|
@project.custom_values = @custom_values
|
||||||
if params[:repository_enabled] && params[:repository_enabled] == "1"
|
if params[:repository_enabled] && params[:repository_enabled] == "1"
|
||||||
|
@ -95,7 +95,7 @@ class ProjectsController < ApplicationController
|
||||||
# Edit @project
|
# Edit @project
|
||||||
def edit
|
def edit
|
||||||
if request.post?
|
if request.post?
|
||||||
@project.custom_fields = IssueCustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
|
@project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
|
||||||
if params[:custom_fields]
|
if params[:custom_fields]
|
||||||
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
|
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
|
||||||
@project.custom_values = @custom_values
|
@project.custom_values = @custom_values
|
||||||
|
@ -213,7 +213,7 @@ class ProjectsController < ApplicationController
|
||||||
if @issue.save
|
if @issue.save
|
||||||
@attachments.each(&:save)
|
@attachments.each(&:save)
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
|
Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
|
||||||
redirect_to :action => 'list_issues', :id => @project
|
redirect_to :action => 'list_issues', :id => @project
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -236,7 +236,7 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
if @query.valid?
|
if @query.valid?
|
||||||
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
|
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
|
||||||
@issue_pages = Paginator.new self, @issue_count, @results_per_page, @params['page']
|
@issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
|
||||||
@issues = Issue.find :all, :order => sort_clause,
|
@issues = Issue.find :all, :order => sort_clause,
|
||||||
:include => [ :author, :status, :tracker, :project ],
|
:include => [ :author, :status, :tracker, :project ],
|
||||||
:conditions => @query.statement,
|
:conditions => @query.statement,
|
||||||
|
|
|
@ -32,7 +32,7 @@ class RolesController < ApplicationController
|
||||||
def new
|
def new
|
||||||
@role = Role.new(params[:role])
|
@role = Role.new(params[:role])
|
||||||
if request.post?
|
if request.post?
|
||||||
@role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids]
|
@role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids]
|
||||||
if @role.save
|
if @role.save
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
redirect_to :action => 'list'
|
redirect_to :action => 'list'
|
||||||
|
@ -44,7 +44,7 @@ class RolesController < ApplicationController
|
||||||
def edit
|
def edit
|
||||||
@role = Role.find(params[:id])
|
@role = Role.find(params[:id])
|
||||||
if request.post? and @role.update_attributes(params[:role])
|
if request.post? and @role.update_attributes(params[:role])
|
||||||
@role.permissions = Permission.find(@params[:permission_ids] || [])
|
@role.permissions = Permission.find(params[:permission_ids] || [])
|
||||||
Permission.allowed_to_role_expired
|
Permission.allowed_to_role_expired
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to :action => 'list'
|
redirect_to :action => 'list'
|
||||||
|
|
|
@ -35,7 +35,7 @@ class UsersController < ApplicationController
|
||||||
@user_count = User.count
|
@user_count = User.count
|
||||||
@user_pages = Paginator.new self, @user_count,
|
@user_pages = Paginator.new self, @user_count,
|
||||||
15,
|
15,
|
||||||
@params['page']
|
params['page']
|
||||||
@users = User.find :all,:order => sort_clause,
|
@users = User.find :all,:order => sort_clause,
|
||||||
:limit => @user_pages.items_per_page,
|
:limit => @user_pages.items_per_page,
|
||||||
:offset => @user_pages.current.offset
|
:offset => @user_pages.current.offset
|
||||||
|
|
|
@ -70,17 +70,17 @@ module ApplicationHelper
|
||||||
html = ''
|
html = ''
|
||||||
html << link_to_remote(('« ' + l(:label_previous)),
|
html << link_to_remote(('« ' + l(:label_previous)),
|
||||||
{:update => "content", :url => { :page => paginator.current.previous }},
|
{:update => "content", :url => { :page => paginator.current.previous }},
|
||||||
{:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
|
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
|
||||||
|
|
||||||
html << (pagination_links_each(paginator, options) do |n|
|
html << (pagination_links_each(paginator, options) do |n|
|
||||||
link_to_remote(n.to_s,
|
link_to_remote(n.to_s,
|
||||||
{:url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'content'},
|
{:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},
|
||||||
{:href => url_for(:action => 'list', :params => @params.merge({:page => n}))})
|
{:href => url_for(:action => 'list', :params => params.merge({:page => n}))})
|
||||||
end || '')
|
end || '')
|
||||||
|
|
||||||
html << ' ' + link_to_remote((l(:label_next) + ' »'),
|
html << ' ' + link_to_remote((l(:label_next) + ' »'),
|
||||||
{:update => "content", :url => { :page => paginator.current.next }},
|
{:update => "content", :url => { :page => paginator.current.next }},
|
||||||
{:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.next}))}) if paginator.current.next
|
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ module SortHelper
|
||||||
# defaults to '<controller_name>_sort'.
|
# defaults to '<controller_name>_sort'.
|
||||||
#
|
#
|
||||||
def sort_init(default_key, default_order='asc', name=nil)
|
def sort_init(default_key, default_order='asc', name=nil)
|
||||||
@sort_name = name || @params[:controller] + @params[:action] + '_sort'
|
@sort_name = name || params[:controller] + params[:action] + '_sort'
|
||||||
@sort_default = {:key => default_key, :order => default_order}
|
@sort_default = {:key => default_key, :order => default_order}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,21 +69,21 @@ module SortHelper
|
||||||
# sort_clause.
|
# sort_clause.
|
||||||
#
|
#
|
||||||
def sort_update()
|
def sort_update()
|
||||||
if @params[:sort_key]
|
if params[:sort_key]
|
||||||
sort = {:key => @params[:sort_key], :order => @params[:sort_order]}
|
sort = {:key => params[:sort_key], :order => params[:sort_order]}
|
||||||
elsif @session[@sort_name]
|
elsif session[@sort_name]
|
||||||
sort = @session[@sort_name] # Previous sort.
|
sort = session[@sort_name] # Previous sort.
|
||||||
else
|
else
|
||||||
sort = @sort_default
|
sort = @sort_default
|
||||||
end
|
end
|
||||||
@session[@sort_name] = sort
|
session[@sort_name] = sort
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns an SQL sort clause corresponding to the current sort state.
|
# Returns an SQL sort clause corresponding to the current sort state.
|
||||||
# Use this to sort the controller's table items collection.
|
# Use this to sort the controller's table items collection.
|
||||||
#
|
#
|
||||||
def sort_clause()
|
def sort_clause()
|
||||||
@session[@sort_name][:key] + ' ' + @session[@sort_name][:order]
|
session[@sort_name][:key] + ' ' + session[@sort_name][:order]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a link which sorts by the named column.
|
# Returns a link which sorts by the named column.
|
||||||
|
@ -93,7 +93,7 @@ module SortHelper
|
||||||
# - A sort icon image is positioned to the right of the sort link.
|
# - A sort icon image is positioned to the right of the sort link.
|
||||||
#
|
#
|
||||||
def sort_link(column, caption=nil)
|
def sort_link(column, caption=nil)
|
||||||
key, order = @session[@sort_name][:key], @session[@sort_name][:order]
|
key, order = session[@sort_name][:key], session[@sort_name][:order]
|
||||||
if key == column
|
if key == column
|
||||||
if order.downcase == 'asc'
|
if order.downcase == 'asc'
|
||||||
icon = 'sort_asc'
|
icon = 'sort_asc'
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<% Enumeration::OPTIONS.each do |option, name| %>
|
<% Enumeration::OPTIONS.each do |option, name| %>
|
||||||
|
|
||||||
<% if @params[:opt]==option %>
|
<% if params[:opt]==option %>
|
||||||
|
|
||||||
<p><%= image_tag 'dir_open' %> <b><%= l(name) %></b></p>
|
<p><%= image_tag 'dir_open' %> <b><%= l(name) %></b></p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "picAdmin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
|
<li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "picAdmin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => @params[:controller], :page => @params[:action] }, :target => "new", :class => "picHelp" %></li>
|
<li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :target => "new", :class => "picHelp" %></li>
|
||||||
|
|
||||||
<% if loggedin? %>
|
<% if loggedin? %>
|
||||||
<li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>
|
<li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>
|
||||||
|
|
Loading…
Reference in New Issue