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