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