@@ -1,285 +1,285 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 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 ProjectsController < ApplicationController |
|
18 | class ProjectsController < ApplicationController | |
19 | menu_item :overview |
|
19 | menu_item :overview | |
20 | menu_item :activity, :only => :activity |
|
20 | menu_item :activity, :only => :activity | |
21 | menu_item :roadmap, :only => :roadmap |
|
21 | menu_item :roadmap, :only => :roadmap | |
22 | menu_item :files, :only => [:list_files, :add_file] |
|
22 | menu_item :files, :only => [:list_files, :add_file] | |
23 | menu_item :settings, :only => :settings |
|
23 | menu_item :settings, :only => :settings | |
24 | menu_item :issues, :only => [:changelog] |
|
24 | menu_item :issues, :only => [:changelog] | |
25 |
|
25 | |||
26 | before_filter :find_project, :except => [ :index, :list, :add, :activity ] |
|
26 | before_filter :find_project, :except => [ :index, :list, :add, :activity ] | |
27 | before_filter :find_optional_project, :only => :activity |
|
27 | before_filter :find_optional_project, :only => :activity | |
28 | before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ] |
|
28 | before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ] | |
29 | before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ] |
|
29 | before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ] | |
30 | accept_key_auth :activity |
|
30 | accept_key_auth :activity | |
31 |
|
31 | |||
32 | helper :sort |
|
32 | helper :sort | |
33 | include SortHelper |
|
33 | include SortHelper | |
34 | helper :custom_fields |
|
34 | helper :custom_fields | |
35 | include CustomFieldsHelper |
|
35 | include CustomFieldsHelper | |
36 | helper :ifpdf |
|
36 | helper :ifpdf | |
37 | include IfpdfHelper |
|
37 | include IfpdfHelper | |
38 | helper :issues |
|
38 | helper :issues | |
39 | helper IssuesHelper |
|
39 | helper IssuesHelper | |
40 | helper :queries |
|
40 | helper :queries | |
41 | include QueriesHelper |
|
41 | include QueriesHelper | |
42 | helper :repositories |
|
42 | helper :repositories | |
43 | include RepositoriesHelper |
|
43 | include RepositoriesHelper | |
44 | include ProjectsHelper |
|
44 | include ProjectsHelper | |
45 |
|
45 | |||
46 | # Lists visible projects |
|
46 | # Lists visible projects | |
47 | def index |
|
47 | def index | |
48 | projects = Project.find :all, |
|
48 | projects = Project.find :all, | |
49 | :conditions => Project.visible_by(User.current), |
|
49 | :conditions => Project.visible_by(User.current), | |
50 | :include => :parent |
|
50 | :include => :parent | |
51 | respond_to do |format| |
|
51 | respond_to do |format| | |
52 | format.html { |
|
52 | format.html { | |
53 | @project_tree = projects.group_by {|p| p.parent || p} |
|
53 | @project_tree = projects.group_by {|p| p.parent || p} | |
54 | @project_tree.keys.each {|p| @project_tree[p] -= [p]} |
|
54 | @project_tree.keys.each {|p| @project_tree[p] -= [p]} | |
55 | } |
|
55 | } | |
56 | format.atom { |
|
56 | format.atom { | |
57 | render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), |
|
57 | render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), | |
58 | :title => "#{Setting.app_title}: #{l(:label_project_latest)}") |
|
58 | :title => "#{Setting.app_title}: #{l(:label_project_latest)}") | |
59 | } |
|
59 | } | |
60 | end |
|
60 | end | |
61 | end |
|
61 | end | |
62 |
|
62 | |||
63 | # Add a new project |
|
63 | # Add a new project | |
64 | def add |
|
64 | def add | |
65 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") |
|
65 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") | |
66 | @trackers = Tracker.all |
|
66 | @trackers = Tracker.all | |
67 | @root_projects = Project.find(:all, |
|
67 | @root_projects = Project.find(:all, | |
68 | :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}", |
|
68 | :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}", | |
69 | :order => 'name') |
|
69 | :order => 'name') | |
70 | @project = Project.new(params[:project]) |
|
70 | @project = Project.new(params[:project]) | |
71 | if request.get? |
|
71 | if request.get? | |
72 | @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers? |
|
72 | @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers? | |
73 | @project.trackers = Tracker.all |
|
73 | @project.trackers = Tracker.all | |
74 | @project.is_public = Setting.default_projects_public? |
|
74 | @project.is_public = Setting.default_projects_public? | |
75 | @project.enabled_module_names = Redmine::AccessControl.available_project_modules |
|
75 | @project.enabled_module_names = Redmine::AccessControl.available_project_modules | |
76 | else |
|
76 | else | |
77 | @project.enabled_module_names = params[:enabled_modules] |
|
77 | @project.enabled_module_names = params[:enabled_modules] | |
78 | if @project.save |
|
78 | if @project.save | |
79 | flash[:notice] = l(:notice_successful_create) |
|
79 | flash[:notice] = l(:notice_successful_create) | |
80 | redirect_to :controller => 'admin', :action => 'projects' |
|
80 | redirect_to :controller => 'admin', :action => 'projects' | |
81 | end |
|
81 | end | |
82 | end |
|
82 | end | |
83 | end |
|
83 | end | |
84 |
|
84 | |||
85 | # Show @project |
|
85 | # Show @project | |
86 | def show |
|
86 | def show | |
87 | @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} |
|
87 | @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} | |
88 | @subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current)) |
|
88 | @subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current)) | |
89 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") |
|
89 | @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") | |
90 | @trackers = @project.rolled_up_trackers |
|
90 | @trackers = @project.rolled_up_trackers | |
91 |
|
91 | |||
92 | cond = @project.project_condition(Setting.display_subprojects_issues?) |
|
92 | cond = @project.project_condition(Setting.display_subprojects_issues?) | |
93 | Issue.visible_by(User.current) do |
|
93 | Issue.visible_by(User.current) do | |
94 | @open_issues_by_tracker = Issue.count(:group => :tracker, |
|
94 | @open_issues_by_tracker = Issue.count(:group => :tracker, | |
95 | :include => [:project, :status, :tracker], |
|
95 | :include => [:project, :status, :tracker], | |
96 | :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) |
|
96 | :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) | |
97 | @total_issues_by_tracker = Issue.count(:group => :tracker, |
|
97 | @total_issues_by_tracker = Issue.count(:group => :tracker, | |
98 | :include => [:project, :status, :tracker], |
|
98 | :include => [:project, :status, :tracker], | |
99 | :conditions => cond) |
|
99 | :conditions => cond) | |
100 | end |
|
100 | end | |
101 | TimeEntry.visible_by(User.current) do |
|
101 | TimeEntry.visible_by(User.current) do | |
102 | @total_hours = TimeEntry.sum(:hours, |
|
102 | @total_hours = TimeEntry.sum(:hours, | |
103 | :include => :project, |
|
103 | :include => :project, | |
104 | :conditions => cond).to_f |
|
104 | :conditions => cond).to_f | |
105 | end |
|
105 | end | |
106 | @key = User.current.rss_key |
|
106 | @key = User.current.rss_key | |
107 | end |
|
107 | end | |
108 |
|
108 | |||
109 | def settings |
|
109 | def settings | |
110 | @root_projects = Project.find(:all, |
|
110 | @root_projects = Project.find(:all, | |
111 | :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id], |
|
111 | :conditions => ["parent_id IS NULL AND status = #{Project::STATUS_ACTIVE} AND id <> ?", @project.id], | |
112 | :order => 'name') |
|
112 | :order => 'name') | |
113 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") |
|
113 | @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") | |
114 | @issue_category ||= IssueCategory.new |
|
114 | @issue_category ||= IssueCategory.new | |
115 | @member ||= @project.members.new |
|
115 | @member ||= @project.members.new | |
116 | @trackers = Tracker.all |
|
116 | @trackers = Tracker.all | |
117 | @repository ||= @project.repository |
|
117 | @repository ||= @project.repository | |
118 | @wiki ||= @project.wiki |
|
118 | @wiki ||= @project.wiki | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | # Edit @project |
|
121 | # Edit @project | |
122 | def edit |
|
122 | def edit | |
123 | if request.post? |
|
123 | if request.post? | |
124 | @project.attributes = params[:project] |
|
124 | @project.attributes = params[:project] | |
125 | if @project.save |
|
125 | if @project.save | |
126 | flash[:notice] = l(:notice_successful_update) |
|
126 | flash[:notice] = l(:notice_successful_update) | |
127 | redirect_to :action => 'settings', :id => @project |
|
127 | redirect_to :action => 'settings', :id => @project | |
128 | else |
|
128 | else | |
129 | settings |
|
129 | settings | |
130 | render :action => 'settings' |
|
130 | render :action => 'settings' | |
131 | end |
|
131 | end | |
132 | end |
|
132 | end | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | def modules |
|
135 | def modules | |
136 | @project.enabled_module_names = params[:enabled_modules] |
|
136 | @project.enabled_module_names = params[:enabled_modules] | |
137 | redirect_to :action => 'settings', :id => @project, :tab => 'modules' |
|
137 | redirect_to :action => 'settings', :id => @project, :tab => 'modules' | |
138 | end |
|
138 | end | |
139 |
|
139 | |||
140 | def archive |
|
140 | def archive | |
141 | @project.archive if request.post? && @project.active? |
|
141 | @project.archive if request.post? && @project.active? | |
142 | redirect_to :controller => 'admin', :action => 'projects' |
|
142 | redirect_to :controller => 'admin', :action => 'projects' | |
143 | end |
|
143 | end | |
144 |
|
144 | |||
145 | def unarchive |
|
145 | def unarchive | |
146 | @project.unarchive if request.post? && !@project.active? |
|
146 | @project.unarchive if request.post? && !@project.active? | |
147 | redirect_to :controller => 'admin', :action => 'projects' |
|
147 | redirect_to :controller => 'admin', :action => 'projects' | |
148 | end |
|
148 | end | |
149 |
|
149 | |||
150 | # Delete @project |
|
150 | # Delete @project | |
151 | def destroy |
|
151 | def destroy | |
152 | @project_to_destroy = @project |
|
152 | @project_to_destroy = @project | |
153 | if request.post? and params[:confirm] |
|
153 | if request.post? and params[:confirm] | |
154 | @project_to_destroy.destroy |
|
154 | @project_to_destroy.destroy | |
155 | redirect_to :controller => 'admin', :action => 'projects' |
|
155 | redirect_to :controller => 'admin', :action => 'projects' | |
156 | end |
|
156 | end | |
157 | # hide project in layout |
|
157 | # hide project in layout | |
158 | @project = nil |
|
158 | @project = nil | |
159 | end |
|
159 | end | |
160 |
|
160 | |||
161 | # Add a new issue category to @project |
|
161 | # Add a new issue category to @project | |
162 | def add_issue_category |
|
162 | def add_issue_category | |
163 | @category = @project.issue_categories.build(params[:category]) |
|
163 | @category = @project.issue_categories.build(params[:category]) | |
164 | if request.post? and @category.save |
|
164 | if request.post? and @category.save | |
165 | respond_to do |format| |
|
165 | respond_to do |format| | |
166 | format.html do |
|
166 | format.html do | |
167 | flash[:notice] = l(:notice_successful_create) |
|
167 | flash[:notice] = l(:notice_successful_create) | |
168 | redirect_to :action => 'settings', :tab => 'categories', :id => @project |
|
168 | redirect_to :action => 'settings', :tab => 'categories', :id => @project | |
169 | end |
|
169 | end | |
170 | format.js do |
|
170 | format.js do | |
171 | # IE doesn't support the replace_html rjs method for select box options |
|
171 | # IE doesn't support the replace_html rjs method for select box options | |
172 | render(:update) {|page| page.replace "issue_category_id", |
|
172 | render(:update) {|page| page.replace "issue_category_id", | |
173 | content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') |
|
173 | content_tag('select', '<option></option>' + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') | |
174 | } |
|
174 | } | |
175 | end |
|
175 | end | |
176 | end |
|
176 | end | |
177 | end |
|
177 | end | |
178 | end |
|
178 | end | |
179 |
|
179 | |||
180 | # Add a new version to @project |
|
180 | # Add a new version to @project | |
181 | def add_version |
|
181 | def add_version | |
182 | @version = @project.versions.build(params[:version]) |
|
182 | @version = @project.versions.build(params[:version]) | |
183 | if request.post? and @version.save |
|
183 | if request.post? and @version.save | |
184 | flash[:notice] = l(:notice_successful_create) |
|
184 | flash[:notice] = l(:notice_successful_create) | |
185 | redirect_to :action => 'settings', :tab => 'versions', :id => @project |
|
185 | redirect_to :action => 'settings', :tab => 'versions', :id => @project | |
186 | end |
|
186 | end | |
187 | end |
|
187 | end | |
188 |
|
188 | |||
189 | def add_file |
|
189 | def add_file | |
190 | if request.post? |
|
190 | if request.post? | |
191 | @version = @project.versions.find_by_id(params[:version_id]) |
|
191 | @version = @project.versions.find_by_id(params[:version_id]) | |
192 | attachments = attach_files(@version, params[:attachments]) |
|
192 | attachments = attach_files(@version, params[:attachments]) | |
193 | Mailer.deliver_attachments_added(attachments) if !attachments.empty? && Setting.notified_events.include?('file_added') |
|
193 | Mailer.deliver_attachments_added(attachments) if !attachments.empty? && Setting.notified_events.include?('file_added') | |
194 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project |
|
194 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project | |
195 | end |
|
195 | end | |
196 | @versions = @project.versions.sort |
|
196 | @versions = @project.versions.sort | |
197 | end |
|
197 | end | |
198 |
|
198 | |||
199 | def list_files |
|
199 | def list_files | |
200 | sort_init "#{Attachment.table_name}.filename", "asc" |
|
200 | sort_init "#{Attachment.table_name}.filename", "asc" | |
201 | sort_update |
|
201 | sort_update | |
202 | @versions = @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse |
|
202 | @versions = @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse | |
203 | render :layout => !request.xhr? |
|
203 | render :layout => !request.xhr? | |
204 | end |
|
204 | end | |
205 |
|
205 | |||
206 | # Show changelog for @project |
|
206 | # Show changelog for @project | |
207 | def changelog |
|
207 | def changelog | |
208 | @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') |
|
208 | @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') | |
209 | retrieve_selected_tracker_ids(@trackers) |
|
209 | retrieve_selected_tracker_ids(@trackers) | |
210 | @versions = @project.versions.sort |
|
210 | @versions = @project.versions.sort | |
211 | end |
|
211 | end | |
212 |
|
212 | |||
213 | def roadmap |
|
213 | def roadmap | |
214 | @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true]) |
|
214 | @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true]) | |
215 | retrieve_selected_tracker_ids(@trackers) |
|
215 | retrieve_selected_tracker_ids(@trackers) | |
216 | @versions = @project.versions.sort |
|
216 | @versions = @project.versions.sort | |
217 | @versions = @versions.select {|v| !v.completed? } unless params[:completed] |
|
217 | @versions = @versions.select {|v| !v.completed? } unless params[:completed] | |
218 | end |
|
218 | end | |
219 |
|
219 | |||
220 | def activity |
|
220 | def activity | |
221 | @days = Setting.activity_days_default.to_i |
|
221 | @days = Setting.activity_days_default.to_i | |
222 |
|
222 | |||
223 | if params[:from] |
|
223 | if params[:from] | |
224 | begin; @date_to = params[:from].to_date + 1; rescue; end |
|
224 | begin; @date_to = params[:from].to_date + 1; rescue; end | |
225 | end |
|
225 | end | |
226 |
|
226 | |||
227 | @date_to ||= Date.today + 1 |
|
227 | @date_to ||= Date.today + 1 | |
228 | @date_from = @date_to - @days |
|
228 | @date_from = @date_to - @days | |
229 | @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') |
|
229 | @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') | |
230 |
@author = (params[:user_id] ? User.active.find(params[:user_id]) |
|
230 | @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) | |
231 |
|
231 | |||
232 | @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, |
|
232 | @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, | |
233 | :with_subprojects => @with_subprojects, |
|
233 | :with_subprojects => @with_subprojects, | |
234 | :author => @author) |
|
234 | :author => @author) | |
235 | @activity.scope_select {|t| !params["show_#{t}"].nil?} |
|
235 | @activity.scope_select {|t| !params["show_#{t}"].nil?} | |
236 | @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? |
|
236 | @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? | |
237 |
|
237 | |||
238 | events = @activity.events(@date_from, @date_to) |
|
238 | events = @activity.events(@date_from, @date_to) | |
239 |
|
239 | |||
240 | respond_to do |format| |
|
240 | respond_to do |format| | |
241 | format.html { |
|
241 | format.html { | |
242 | @events_by_day = events.group_by(&:event_date) |
|
242 | @events_by_day = events.group_by(&:event_date) | |
243 | render :layout => false if request.xhr? |
|
243 | render :layout => false if request.xhr? | |
244 | } |
|
244 | } | |
245 | format.atom { |
|
245 | format.atom { | |
246 | title = l(:label_activity) |
|
246 | title = l(:label_activity) | |
247 | if @author |
|
247 | if @author | |
248 | title = @author.name |
|
248 | title = @author.name | |
249 | elsif @activity.scope.size == 1 |
|
249 | elsif @activity.scope.size == 1 | |
250 | title = l("label_#{@activity.scope.first.singularize}_plural") |
|
250 | title = l("label_#{@activity.scope.first.singularize}_plural") | |
251 | end |
|
251 | end | |
252 | render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") |
|
252 | render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") | |
253 | } |
|
253 | } | |
254 | end |
|
254 | end | |
255 |
|
255 | |||
256 | rescue ActiveRecord::RecordNotFound |
|
256 | rescue ActiveRecord::RecordNotFound | |
257 | render_404 |
|
257 | render_404 | |
258 | end |
|
258 | end | |
259 |
|
259 | |||
260 | private |
|
260 | private | |
261 | # Find project of id params[:id] |
|
261 | # Find project of id params[:id] | |
262 | # if not found, redirect to project list |
|
262 | # if not found, redirect to project list | |
263 | # Used as a before_filter |
|
263 | # Used as a before_filter | |
264 | def find_project |
|
264 | def find_project | |
265 | @project = Project.find(params[:id]) |
|
265 | @project = Project.find(params[:id]) | |
266 | rescue ActiveRecord::RecordNotFound |
|
266 | rescue ActiveRecord::RecordNotFound | |
267 | render_404 |
|
267 | render_404 | |
268 | end |
|
268 | end | |
269 |
|
269 | |||
270 | def find_optional_project |
|
270 | def find_optional_project | |
271 | return true unless params[:id] |
|
271 | return true unless params[:id] | |
272 | @project = Project.find(params[:id]) |
|
272 | @project = Project.find(params[:id]) | |
273 | authorize |
|
273 | authorize | |
274 | rescue ActiveRecord::RecordNotFound |
|
274 | rescue ActiveRecord::RecordNotFound | |
275 | render_404 |
|
275 | render_404 | |
276 | end |
|
276 | end | |
277 |
|
277 | |||
278 | def retrieve_selected_tracker_ids(selectable_trackers) |
|
278 | def retrieve_selected_tracker_ids(selectable_trackers) | |
279 | if ids = params[:tracker_ids] |
|
279 | if ids = params[:tracker_ids] | |
280 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } |
|
280 | @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } | |
281 | else |
|
281 | else | |
282 | @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s } |
|
282 | @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s } | |
283 | end |
|
283 | end | |
284 | end |
|
284 | end | |
285 | end |
|
285 | end |
@@ -1,60 +1,60 | |||||
1 | <h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2> |
|
1 | <h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2> | |
2 | <p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p> |
|
2 | <p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p> | |
3 |
|
3 | |||
4 | <div id="activity"> |
|
4 | <div id="activity"> | |
5 | <% @events_by_day.keys.sort.reverse.each do |day| %> |
|
5 | <% @events_by_day.keys.sort.reverse.each do |day| %> | |
6 | <h3><%= format_activity_day(day) %></h3> |
|
6 | <h3><%= format_activity_day(day) %></h3> | |
7 | <dl> |
|
7 | <dl> | |
8 | <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> |
|
8 | <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> | |
9 | <dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> |
|
9 | <dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> | |
10 | <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> |
|
10 | <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> | |
11 | <span class="time"><%= format_time(e.event_datetime, false) %></span> |
|
11 | <span class="time"><%= format_time(e.event_datetime, false) %></span> | |
12 | <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> |
|
12 | <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> | |
13 | <%= link_to format_activity_title(e.event_title), e.event_url %></dt> |
|
13 | <%= link_to format_activity_title(e.event_title), e.event_url %></dt> | |
14 | <dd><span class="description"><%= format_activity_description(e.event_description) %></span> |
|
14 | <dd><span class="description"><%= format_activity_description(e.event_description) %></span> | |
15 | <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd> |
|
15 | <span class="author"><%= e.event_author if e.respond_to?(:event_author) %></span></dd> | |
16 | <% end -%> |
|
16 | <% end -%> | |
17 | </dl> |
|
17 | </dl> | |
18 | <% end -%> |
|
18 | <% end -%> | |
19 | </div> |
|
19 | </div> | |
20 |
|
20 | |||
21 | <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %> |
|
21 | <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %> | |
22 |
|
22 | |||
23 | <div style="float:left;"> |
|
23 | <div style="float:left;"> | |
24 | <%= link_to_remote(('« ' + l(:label_previous)), |
|
24 | <%= link_to_remote(('« ' + l(:label_previous)), | |
25 | {:update => "content", :url => params.merge(:from => @date_to - @days - 1), :complete => 'window.scrollTo(0,0)'}, |
|
25 | {:update => "content", :url => params.merge(:from => @date_to - @days - 1), :complete => 'window.scrollTo(0,0)'}, | |
26 | {:href => url_for(params.merge(:from => @date_to - @days - 1)), |
|
26 | {:href => url_for(params.merge(:from => @date_to - @days - 1)), | |
27 | :title => "#{l(:label_date_from)} #{format_date(@date_to - 2*@days)} #{l(:label_date_to).downcase} #{format_date(@date_to - @days - 1)}"}) %> |
|
27 | :title => "#{l(:label_date_from)} #{format_date(@date_to - 2*@days)} #{l(:label_date_to).downcase} #{format_date(@date_to - @days - 1)}"}) %> | |
28 | </div> |
|
28 | </div> | |
29 | <div style="float:right;"> |
|
29 | <div style="float:right;"> | |
30 | <%= link_to_remote((l(:label_next) + ' »'), |
|
30 | <%= link_to_remote((l(:label_next) + ' »'), | |
31 | {:update => "content", :url => params.merge(:from => @date_to + @days - 1), :complete => 'window.scrollTo(0,0)'}, |
|
31 | {:update => "content", :url => params.merge(:from => @date_to + @days - 1), :complete => 'window.scrollTo(0,0)'}, | |
32 | {:href => url_for(params.merge(:from => @date_to + @days - 1)), |
|
32 | {:href => url_for(params.merge(:from => @date_to + @days - 1)), | |
33 | :title => "#{l(:label_date_from)} #{format_date(@date_to)} #{l(:label_date_to).downcase} #{format_date(@date_to + @days - 1)}"}) unless @date_to >= Date.today %> |
|
33 | :title => "#{l(:label_date_from)} #{format_date(@date_to)} #{l(:label_date_to).downcase} #{format_date(@date_to + @days - 1)}"}) unless @date_to >= Date.today %> | |
34 | </div> |
|
34 | </div> | |
35 | |
|
35 | | |
36 | <p class="other-formats"> |
|
36 | <p class="other-formats"> | |
37 | <%= l(:label_export_to) %> |
|
37 | <%= l(:label_export_to) %> | |
38 | <%= link_to 'Atom', params.merge(:format => :atom, :from => nil, :key => User.current.rss_key), :class => 'feed' %> |
|
38 | <%= link_to 'Atom', params.merge(:format => :atom, :from => nil, :key => User.current.rss_key), :class => 'feed' %> | |
39 | </p> |
|
39 | </p> | |
40 |
|
40 | |||
41 | <% content_for :header_tags do %> |
|
41 | <% content_for :header_tags do %> | |
42 | <%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> |
|
42 | <%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> | |
43 | <% end %> |
|
43 | <% end %> | |
44 |
|
44 | |||
45 | <% content_for :sidebar do %> |
|
45 | <% content_for :sidebar do %> | |
46 | <% form_tag({}, :method => :get) do %> |
|
46 | <% form_tag({}, :method => :get) do %> | |
47 | <h3><%= l(:label_activity) %></h3> |
|
47 | <h3><%= l(:label_activity) %></h3> | |
48 | <p><% @activity.event_types.each do |t| %> |
|
48 | <p><% @activity.event_types.each do |t| %> | |
49 | <label><%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label><br /> |
|
49 | <label><%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label><br /> | |
50 | <% end %></p> |
|
50 | <% end %></p> | |
51 | <% if @project && @project.active_children.any? %> |
|
51 | <% if @project && @project.active_children.any? %> | |
52 | <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> |
|
52 | <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> | |
53 | <%= hidden_field_tag 'with_subprojects', 0 %> |
|
53 | <%= hidden_field_tag 'with_subprojects', 0 %> | |
54 | <% end %> |
|
54 | <% end %> | |
55 |
<%= hidden_field_tag |
|
55 | <%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> | |
56 | <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> |
|
56 | <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> | |
57 | <% end %> |
|
57 | <% end %> | |
58 | <% end %> |
|
58 | <% end %> | |
59 |
|
59 | |||
60 | <% html_title(l(:label_activity), @author) -%> |
|
60 | <% html_title(l(:label_activity), @author) -%> |
General Comments 0
You need to be logged in to leave comments.
Login now