##// END OF EJS Templates
fixed: error when clicking "add" with no block selected on my/page_layout...
Jean-Philippe Lang -
r258:4f2d74e25f00
parent child
Show More
@@ -1,135 +1,136
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
2 # Copyright (C) 2006 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class MyController < ApplicationController
18 class MyController < ApplicationController
19 layout 'base'
19 layout 'base'
20 before_filter :require_login
20 before_filter :require_login
21
21
22 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
22 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
23 'issuesreportedbyme' => :label_reported_issues,
23 'issuesreportedbyme' => :label_reported_issues,
24 'news' => :label_news_latest,
24 'news' => :label_news_latest,
25 'calendar' => :label_calendar,
25 'calendar' => :label_calendar,
26 'documents' => :label_document_plural
26 'documents' => :label_document_plural
27 }.freeze
27 }.freeze
28
28
29 DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
29 DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
30 'right' => ['issuesreportedbyme']
30 'right' => ['issuesreportedbyme']
31 }.freeze
31 }.freeze
32
32
33 verify :xhr => true,
33 verify :xhr => true,
34 :session => :page_layout,
34 :session => :page_layout,
35 :only => [:add_block, :remove_block, :order_blocks]
35 :only => [:add_block, :remove_block, :order_blocks]
36
36
37 def index
37 def index
38 page
38 page
39 render :action => 'page'
39 render :action => 'page'
40 end
40 end
41
41
42 # Show user's page
42 # Show user's page
43 def page
43 def page
44 @user = self.logged_in_user
44 @user = self.logged_in_user
45 @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
45 @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
46 end
46 end
47
47
48 # Edit user's account
48 # Edit user's account
49 def account
49 def account
50 @user = self.logged_in_user
50 @user = self.logged_in_user
51 @pref = @user.pref
51 @pref = @user.pref
52 @user.attributes = params[:user]
52 @user.attributes = params[:user]
53 @user.pref.attributes = params[:pref]
53 @user.pref.attributes = params[:pref]
54 if request.post? and @user.save and @user.pref.save
54 if request.post? and @user.save and @user.pref.save
55 set_localization
55 set_localization
56 flash.now[:notice] = l(:notice_account_updated)
56 flash.now[:notice] = l(:notice_account_updated)
57 self.logged_in_user.reload
57 self.logged_in_user.reload
58 end
58 end
59 end
59 end
60
60
61 # Change user's password
61 # Change user's password
62 def change_password
62 def change_password
63 @user = self.logged_in_user
63 @user = self.logged_in_user
64 flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
64 flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
65 if @user.check_password?(params[:password])
65 if @user.check_password?(params[:password])
66 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
66 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
67 if @user.save
67 if @user.save
68 flash[:notice] = l(:notice_account_password_updated)
68 flash[:notice] = l(:notice_account_password_updated)
69 else
69 else
70 render :action => 'account'
70 render :action => 'account'
71 return
71 return
72 end
72 end
73 else
73 else
74 flash[:notice] = l(:notice_account_wrong_password)
74 flash[:notice] = l(:notice_account_wrong_password)
75 end
75 end
76 redirect_to :action => 'account'
76 redirect_to :action => 'account'
77 end
77 end
78
78
79 # User's page layout configuration
79 # User's page layout configuration
80 def page_layout
80 def page_layout
81 @user = self.logged_in_user
81 @user = self.logged_in_user
82 @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup
82 @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup
83 session[:page_layout] = @blocks
83 session[:page_layout] = @blocks
84 %w(top left right).each {|f| session[:page_layout][f] ||= [] }
84 %w(top left right).each {|f| session[:page_layout][f] ||= [] }
85 @block_options = []
85 @block_options = []
86 BLOCKS.each {|k, v| @block_options << [l(v), k]}
86 BLOCKS.each {|k, v| @block_options << [l(v), k]}
87 end
87 end
88
88
89 # Add a block to user's page
89 # Add a block to user's page
90 # The block is added on top of the page
90 # The block is added on top of the page
91 # params[:block] : id of the block to add
91 # params[:block] : id of the block to add
92 def add_block
92 def add_block
93 @user = self.logged_in_user
94 block = params[:block]
93 block = params[:block]
94 render(:nothing => true) and return unless block && (BLOCKS.keys.include? block)
95 @user = self.logged_in_user
95 # remove if already present in a group
96 # remove if already present in a group
96 %w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
97 %w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
97 # add it on top
98 # add it on top
98 session[:page_layout]['top'].unshift block
99 session[:page_layout]['top'].unshift block
99 render :partial => "block", :locals => {:user => @user, :block_name => block}
100 render :partial => "block", :locals => {:user => @user, :block_name => block}
100 end
101 end
101
102
102 # Remove a block to user's page
103 # Remove a block to user's page
103 # params[:block] : id of the block to remove
104 # params[:block] : id of the block to remove
104 def remove_block
105 def remove_block
105 block = params[:block]
106 block = params[:block]
106 # remove block in all groups
107 # remove block in all groups
107 %w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
108 %w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
108 render :nothing => true
109 render :nothing => true
109 end
110 end
110
111
111 # Change blocks order on user's page
112 # Change blocks order on user's page
112 # params[:group] : group to order (top, left or right)
113 # params[:group] : group to order (top, left or right)
113 # params[:list-(top|left|right)] : array of block ids of the group
114 # params[:list-(top|left|right)] : array of block ids of the group
114 def order_blocks
115 def order_blocks
115 group = params[:group]
116 group = params[:group]
116 group_items = params["list-#{group}"]
117 group_items = params["list-#{group}"]
117 if group_items and group_items.is_a? Array
118 if group_items and group_items.is_a? Array
118 # remove group blocks if they are presents in other groups
119 # remove group blocks if they are presents in other groups
119 %w(top left right).each {|f|
120 %w(top left right).each {|f|
120 session[:page_layout][f] = (session[:page_layout][f] || []) - group_items
121 session[:page_layout][f] = (session[:page_layout][f] || []) - group_items
121 }
122 }
122 session[:page_layout][group] = group_items
123 session[:page_layout][group] = group_items
123 end
124 end
124 render :nothing => true
125 render :nothing => true
125 end
126 end
126
127
127 # Save user's page layout
128 # Save user's page layout
128 def page_layout_save
129 def page_layout_save
129 @user = self.logged_in_user
130 @user = self.logged_in_user
130 @user.pref[:my_page_layout] = session[:page_layout] if session[:page_layout]
131 @user.pref[:my_page_layout] = session[:page_layout] if session[:page_layout]
131 @user.pref.save
132 @user.pref.save
132 session[:page_layout] = nil
133 session[:page_layout] = nil
133 redirect_to :action => 'page'
134 redirect_to :action => 'page'
134 end
135 end
135 end
136 end
@@ -1,140 +1,145
1 == redMine changelog
1 == redMine changelog
2
2
3 redMine - project management software
3 redMine - project management software
4 Copyright (C) 2006-2007 Jean-Philippe Lang
4 Copyright (C) 2006-2007 Jean-Philippe Lang
5 http://redmine.rubyforge.org/
5 http://redmine.rubyforge.org/
6
6
7
7
8 == 02/18/2006 v0.4.2
8 == xx/xx/2007 v0.4.3
9
10 * fixed: error when clicking "add" with no block selected on my/page_layout
11
12
13 == 02/18/2007 v0.4.2
9
14
10 * Rails 1.2 is now required
15 * Rails 1.2 is now required
11 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
16 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
12 * added project roadmap view
17 * added project roadmap view
13 * mail notifications added when a document, a file or an attachment is added
18 * mail notifications added when a document, a file or an attachment is added
14 * tooltips added on Gantt chart and calender to view the details of the issues
19 * tooltips added on Gantt chart and calender to view the details of the issues
15 * ability to set the sort order for roles, trackers, issue statuses
20 * ability to set the sort order for roles, trackers, issue statuses
16 * added missing fields to csv export: priority, start date, due date, done ratio
21 * added missing fields to csv export: priority, start date, due date, done ratio
17 * added total number of issues per tracker on project overview
22 * added total number of issues per tracker on project overview
18 * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-)
23 * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-)
19 * added back "fixed version" field on issue screen and in filters
24 * added back "fixed version" field on issue screen and in filters
20 * project settings screen split in 4 tabs
25 * project settings screen split in 4 tabs
21 * custom fields screen split in 3 tabs (one for each kind of custom field)
26 * custom fields screen split in 3 tabs (one for each kind of custom field)
22 * multiple issues pdf export now rendered as a table
27 * multiple issues pdf export now rendered as a table
23 * added a button on users/list to manually activate an account
28 * added a button on users/list to manually activate an account
24 * added a setting option to disable "password lost" functionality
29 * added a setting option to disable "password lost" functionality
25 * added a setting option to set max number of issues in csv/pdf exports
30 * added a setting option to set max number of issues in csv/pdf exports
26 * fixed: subprojects count is always 0 on projects list
31 * fixed: subprojects count is always 0 on projects list
27 * fixed: locked users are proposed when adding a member to a project
32 * fixed: locked users are proposed when adding a member to a project
28 * fixed: setting an issue status as default status leads to an sql error with SQLite
33 * fixed: setting an issue status as default status leads to an sql error with SQLite
29 * fixed: unable to delete an issue status even if it's not used yet
34 * fixed: unable to delete an issue status even if it's not used yet
30 * fixed: filters ignored when exporting a predefined query to csv/pdf
35 * fixed: filters ignored when exporting a predefined query to csv/pdf
31 * fixed: crash when french "issue_edit" email notification is sent
36 * fixed: crash when french "issue_edit" email notification is sent
32 * fixed: hide mail preference not saved (my/account)
37 * fixed: hide mail preference not saved (my/account)
33 * fixed: crash when a new user try to edit its "my page" layout
38 * fixed: crash when a new user try to edit its "my page" layout
34
39
35
40
36 == 01/03/2006 v0.4.1
41 == 01/03/2007 v0.4.1
37
42
38 * fixed: emails have no recipient when one of the project members has notifications disabled
43 * fixed: emails have no recipient when one of the project members has notifications disabled
39
44
40
45
41 == 01/02/2006 v0.4.0
46 == 01/02/2007 v0.4.0
42
47
43 * simple SVN browser added (just needs svn binaries in PATH)
48 * simple SVN browser added (just needs svn binaries in PATH)
44 * comments can now be added on news
49 * comments can now be added on news
45 * "my page" is now customizable
50 * "my page" is now customizable
46 * more powerfull and savable filters for issues lists
51 * more powerfull and savable filters for issues lists
47 * improved issues change history
52 * improved issues change history
48 * new functionality: move an issue to another project or tracker
53 * new functionality: move an issue to another project or tracker
49 * new functionality: add a note to an issue
54 * new functionality: add a note to an issue
50 * new report: project activity
55 * new report: project activity
51 * "start date" and "% done" fields added on issues
56 * "start date" and "% done" fields added on issues
52 * project calendar added
57 * project calendar added
53 * gantt chart added (exportable to pdf)
58 * gantt chart added (exportable to pdf)
54 * single/multiple issues pdf export added
59 * single/multiple issues pdf export added
55 * issues reports improvements
60 * issues reports improvements
56 * multiple file upload for issues, documents and files
61 * multiple file upload for issues, documents and files
57 * option to set maximum size of uploaded files
62 * option to set maximum size of uploaded files
58 * textile formating of issue and news descritions (RedCloth required)
63 * textile formating of issue and news descritions (RedCloth required)
59 * integration of DotClear jstoolbar for textile formatting
64 * integration of DotClear jstoolbar for textile formatting
60 * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar)
65 * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar)
61 * new filter in issues list: Author
66 * new filter in issues list: Author
62 * ajaxified paginators
67 * ajaxified paginators
63 * news rss feed added
68 * news rss feed added
64 * option to set number of results per page on issues list
69 * option to set number of results per page on issues list
65 * localized csv separator (comma/semicolon)
70 * localized csv separator (comma/semicolon)
66 * csv output encoded to ISO-8859-1
71 * csv output encoded to ISO-8859-1
67 * user custom field displayed on account/show
72 * user custom field displayed on account/show
68 * default configuration improved (default roles, trackers, status, permissions and workflows)
73 * default configuration improved (default roles, trackers, status, permissions and workflows)
69 * language for default configuration data can now be chosen when running 'load_default_data' task
74 * language for default configuration data can now be chosen when running 'load_default_data' task
70 * javascript added on custom field form to show/hide fields according to the format of custom field
75 * javascript added on custom field form to show/hide fields according to the format of custom field
71 * fixed: custom fields not in csv exports
76 * fixed: custom fields not in csv exports
72 * fixed: project settings now displayed according to user's permissions
77 * fixed: project settings now displayed according to user's permissions
73 * fixed: application error when no version is selected on projects/add_file
78 * fixed: application error when no version is selected on projects/add_file
74 * fixed: public actions not authorized for members of non public projects
79 * fixed: public actions not authorized for members of non public projects
75 * fixed: non public projects were shown on welcome screen even if current user is not a member
80 * fixed: non public projects were shown on welcome screen even if current user is not a member
76
81
77
82
78 == 10/08/2006 v0.3.0
83 == 10/08/2006 v0.3.0
79
84
80 * user authentication against multiple LDAP (optional)
85 * user authentication against multiple LDAP (optional)
81 * token based "lost password" functionality
86 * token based "lost password" functionality
82 * user self-registration functionality (optional)
87 * user self-registration functionality (optional)
83 * custom fields now available for issues, users and projects
88 * custom fields now available for issues, users and projects
84 * new custom field format "text" (displayed as a textarea field)
89 * new custom field format "text" (displayed as a textarea field)
85 * project & administration drop down menus in navigation bar for quicker access
90 * project & administration drop down menus in navigation bar for quicker access
86 * text formatting is preserved for long text fields (issues, projects and news descriptions)
91 * text formatting is preserved for long text fields (issues, projects and news descriptions)
87 * urls and emails are turned into clickable links in long text fields
92 * urls and emails are turned into clickable links in long text fields
88 * "due date" field added on issues
93 * "due date" field added on issues
89 * tracker selection filter added on change log
94 * tracker selection filter added on change log
90 * Localization plugin replaced with GLoc 1.1.0 (iconv required)
95 * Localization plugin replaced with GLoc 1.1.0 (iconv required)
91 * error messages internationalization
96 * error messages internationalization
92 * german translation added (thanks to Karim Trott)
97 * german translation added (thanks to Karim Trott)
93 * data locking for issues to prevent update conflicts (using ActiveRecord builtin optimistic locking)
98 * data locking for issues to prevent update conflicts (using ActiveRecord builtin optimistic locking)
94 * new filter in issues list: "Fixed version"
99 * new filter in issues list: "Fixed version"
95 * active filters are displayed with colored background on issues list
100 * active filters are displayed with colored background on issues list
96 * custom configuration is now defined in config/config_custom.rb
101 * custom configuration is now defined in config/config_custom.rb
97 * user object no more stored in session (only user_id)
102 * user object no more stored in session (only user_id)
98 * news summary field is no longer required
103 * news summary field is no longer required
99 * tables and forms redesign
104 * tables and forms redesign
100 * Fixed: boolean custom field not working
105 * Fixed: boolean custom field not working
101 * Fixed: error messages for custom fields are not displayed
106 * Fixed: error messages for custom fields are not displayed
102 * Fixed: invalid custom fields should have a red border
107 * Fixed: invalid custom fields should have a red border
103 * Fixed: custom fields values are not validated on issue update
108 * Fixed: custom fields values are not validated on issue update
104 * Fixed: unable to choose an empty value for 'List' custom fields
109 * Fixed: unable to choose an empty value for 'List' custom fields
105 * Fixed: no issue categories sorting
110 * Fixed: no issue categories sorting
106 * Fixed: incorrect versions sorting
111 * Fixed: incorrect versions sorting
107
112
108
113
109 == 07/12/2006 - v0.2.2
114 == 07/12/2006 - v0.2.2
110
115
111 * Fixed: bug in "issues list"
116 * Fixed: bug in "issues list"
112
117
113
118
114 == 07/09/2006 - v0.2.1
119 == 07/09/2006 - v0.2.1
115
120
116 * new databases supported: Oracle, PostgreSQL, SQL Server
121 * new databases supported: Oracle, PostgreSQL, SQL Server
117 * projects/subprojects hierarchy (1 level of subprojects only)
122 * projects/subprojects hierarchy (1 level of subprojects only)
118 * environment information display in admin/info
123 * environment information display in admin/info
119 * more filter options in issues list (rev6)
124 * more filter options in issues list (rev6)
120 * default language based on browser settings (Accept-Language HTTP header)
125 * default language based on browser settings (Accept-Language HTTP header)
121 * issues list exportable to CSV (rev6)
126 * issues list exportable to CSV (rev6)
122 * simple_format and auto_link on long text fields
127 * simple_format and auto_link on long text fields
123 * more data validations
128 * more data validations
124 * Fixed: error when all mail notifications are unchecked in admin/mail_options
129 * Fixed: error when all mail notifications are unchecked in admin/mail_options
125 * Fixed: all project news are displayed on project summary
130 * Fixed: all project news are displayed on project summary
126 * Fixed: Can't change user password in users/edit
131 * Fixed: Can't change user password in users/edit
127 * Fixed: Error on tables creation with PostgreSQL (rev5)
132 * Fixed: Error on tables creation with PostgreSQL (rev5)
128 * Fixed: SQL error in "issue reports" view with PostgreSQL (rev5)
133 * Fixed: SQL error in "issue reports" view with PostgreSQL (rev5)
129
134
130
135
131 == 06/25/2006 - v0.1.0
136 == 06/25/2006 - v0.1.0
132
137
133 * multiple users/multiple projects
138 * multiple users/multiple projects
134 * role based access control
139 * role based access control
135 * issue tracking system
140 * issue tracking system
136 * fully customizable workflow
141 * fully customizable workflow
137 * documents/files repository
142 * documents/files repository
138 * email notifications on issue creation and update
143 * email notifications on issue creation and update
139 * multilanguage support (except for error messages):english, french, spanish
144 * multilanguage support (except for error messages):english, french, spanish
140 * online manual in french (unfinished) No newline at end of file
145 * online manual in french (unfinished)
General Comments 0
You need to be logged in to leave comments. Login now