##// END OF EJS Templates
* replaced "add_issue" links on projects/show by a drop down list...
Jean-Philippe Lang -
r133:470ef4d11ee7
parent child
Show More
@@ -0,0 +1,5
1 <% if authorize_for('projects', 'add_issue') %>
2 <%= start_form_tag({ :controller => 'projects', :action => 'add_issue', :id => @project }, :method => 'get') %>
3 <%= l(:label_issue_new) %>: <%= select_tag 'tracker_id', ("<option></option>" + options_from_collection_for_select(trackers, 'id', 'name')), :onchange => "if (this.value!='') {this.form.submit();}" %>
4 <%= end_form_tag %>
5 <% end %>
@@ -1,531 +1,532
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006 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 layout 'base'
19 layout 'base'
20 before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
20 before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
21 before_filter :require_admin, :only => [ :add, :destroy ]
21 before_filter :require_admin, :only => [ :add, :destroy ]
22
22
23 helper :sort
23 helper :sort
24 include SortHelper
24 include SortHelper
25 helper :custom_fields
25 helper :custom_fields
26 include CustomFieldsHelper
26 include CustomFieldsHelper
27 helper :ifpdf
27 helper :ifpdf
28 include IfpdfHelper
28 include IfpdfHelper
29 helper IssuesHelper
29 helper IssuesHelper
30 helper :queries
30 helper :queries
31 include QueriesHelper
31 include QueriesHelper
32
32
33 def index
33 def index
34 list
34 list
35 render :action => 'list' unless request.xhr?
35 render :action => 'list' unless request.xhr?
36 end
36 end
37
37
38 # Lists public projects
38 # Lists public projects
39 def list
39 def list
40 sort_init 'name', 'asc'
40 sort_init 'name', 'asc'
41 sort_update
41 sort_update
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 params['page']
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,
49 :offset => @project_pages.current.offset
49 :offset => @project_pages.current.offset
50
50
51 render :action => "list", :layout => false if request.xhr?
51 render :action => "list", :layout => false if request.xhr?
52 end
52 end
53
53
54 # Add a new project
54 # Add a new project
55 def add
55 def add
56 @custom_fields = IssueCustomField.find(:all)
56 @custom_fields = IssueCustomField.find(:all)
57 @root_projects = Project.find(:all, :conditions => "parent_id is null")
57 @root_projects = Project.find(:all, :conditions => "parent_id is null")
58 @project = Project.new(params[:project])
58 @project = Project.new(params[:project])
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(params[:custom_field_ids]) if params[:custom_field_ids]
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"
66 @project.repository = Repository.new
66 @project.repository = Repository.new
67 @project.repository.attributes = params[:repository]
67 @project.repository.attributes = params[:repository]
68 end
68 end
69 if @project.save
69 if @project.save
70 flash[:notice] = l(:notice_successful_create)
70 flash[:notice] = l(:notice_successful_create)
71 redirect_to :controller => 'admin', :action => 'projects'
71 redirect_to :controller => 'admin', :action => 'projects'
72 end
72 end
73 end
73 end
74 end
74 end
75
75
76 # Show @project
76 # Show @project
77 def show
77 def show
78 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
78 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
79 @members = @project.members.find(:all, :include => [:user, :role])
79 @members = @project.members.find(:all, :include => [:user, :role])
80 @subprojects = @project.children if @project.children_count > 0
80 @subprojects = @project.children if @project.children_count > 0
81 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
81 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
82 @trackers = Tracker.find(:all)
82 @trackers = Tracker.find(:all)
83 end
83 end
84
84
85 def settings
85 def settings
86 @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
86 @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
87 @custom_fields = IssueCustomField.find(:all)
87 @custom_fields = IssueCustomField.find(:all)
88 @issue_category ||= IssueCategory.new
88 @issue_category ||= IssueCategory.new
89 @member ||= @project.members.new
89 @member ||= @project.members.new
90 @roles = Role.find(:all)
90 @roles = Role.find(:all)
91 @users = User.find(:all) - @project.members.find(:all, :include => :user).collect{|m| m.user }
91 @users = User.find(:all) - @project.members.find(:all, :include => :user).collect{|m| m.user }
92 @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
92 @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
93 end
93 end
94
94
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(params[:custom_field_ids]) if params[:custom_field_ids]
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
102 end
102 end
103 if params[:repository_enabled]
103 if params[:repository_enabled]
104 case params[:repository_enabled]
104 case params[:repository_enabled]
105 when "0"
105 when "0"
106 @project.repository = nil
106 @project.repository = nil
107 when "1"
107 when "1"
108 @project.repository ||= Repository.new
108 @project.repository ||= Repository.new
109 @project.repository.attributes = params[:repository]
109 @project.repository.attributes = params[:repository]
110 end
110 end
111 end
111 end
112 @project.attributes = params[:project]
112 @project.attributes = params[:project]
113 if @project.save
113 if @project.save
114 flash[:notice] = l(:notice_successful_update)
114 flash[:notice] = l(:notice_successful_update)
115 redirect_to :action => 'settings', :id => @project
115 redirect_to :action => 'settings', :id => @project
116 else
116 else
117 settings
117 settings
118 render :action => 'settings'
118 render :action => 'settings'
119 end
119 end
120 end
120 end
121 end
121 end
122
122
123 # Delete @project
123 # Delete @project
124 def destroy
124 def destroy
125 if request.post? and params[:confirm]
125 if request.post? and params[:confirm]
126 @project.destroy
126 @project.destroy
127 redirect_to :controller => 'admin', :action => 'projects'
127 redirect_to :controller => 'admin', :action => 'projects'
128 end
128 end
129 end
129 end
130
130
131 # Add a new issue category to @project
131 # Add a new issue category to @project
132 def add_issue_category
132 def add_issue_category
133 if request.post?
133 if request.post?
134 @issue_category = @project.issue_categories.build(params[:issue_category])
134 @issue_category = @project.issue_categories.build(params[:issue_category])
135 if @issue_category.save
135 if @issue_category.save
136 flash[:notice] = l(:notice_successful_create)
136 flash[:notice] = l(:notice_successful_create)
137 redirect_to :action => 'settings', :id => @project
137 redirect_to :action => 'settings', :id => @project
138 else
138 else
139 settings
139 settings
140 render :action => 'settings'
140 render :action => 'settings'
141 end
141 end
142 end
142 end
143 end
143 end
144
144
145 # Add a new version to @project
145 # Add a new version to @project
146 def add_version
146 def add_version
147 @version = @project.versions.build(params[:version])
147 @version = @project.versions.build(params[:version])
148 if request.post? and @version.save
148 if request.post? and @version.save
149 flash[:notice] = l(:notice_successful_create)
149 flash[:notice] = l(:notice_successful_create)
150 redirect_to :action => 'settings', :id => @project
150 redirect_to :action => 'settings', :id => @project
151 end
151 end
152 end
152 end
153
153
154 # Add a new member to @project
154 # Add a new member to @project
155 def add_member
155 def add_member
156 @member = @project.members.build(params[:member])
156 @member = @project.members.build(params[:member])
157 if request.post?
157 if request.post?
158 if @member.save
158 if @member.save
159 flash[:notice] = l(:notice_successful_create)
159 flash[:notice] = l(:notice_successful_create)
160 redirect_to :action => 'settings', :id => @project
160 redirect_to :action => 'settings', :id => @project
161 else
161 else
162 settings
162 settings
163 render :action => 'settings'
163 render :action => 'settings'
164 end
164 end
165 end
165 end
166 end
166 end
167
167
168 # Show members list of @project
168 # Show members list of @project
169 def list_members
169 def list_members
170 @members = @project.members
170 @members = @project.members
171 end
171 end
172
172
173 # Add a new document to @project
173 # Add a new document to @project
174 def add_document
174 def add_document
175 @categories = Enumeration::get_values('DCAT')
175 @categories = Enumeration::get_values('DCAT')
176 @document = @project.documents.build(params[:document])
176 @document = @project.documents.build(params[:document])
177 if request.post? and @document.save
177 if request.post? and @document.save
178 # Save the attachments
178 # Save the attachments
179 params[:attachments].each { |a|
179 params[:attachments].each { |a|
180 Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0
180 Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0
181 } if params[:attachments] and params[:attachments].is_a? Array
181 } if params[:attachments] and params[:attachments].is_a? Array
182 flash[:notice] = l(:notice_successful_create)
182 flash[:notice] = l(:notice_successful_create)
183 redirect_to :action => 'list_documents', :id => @project
183 redirect_to :action => 'list_documents', :id => @project
184 end
184 end
185 end
185 end
186
186
187 # Show documents list of @project
187 # Show documents list of @project
188 def list_documents
188 def list_documents
189 @documents = @project.documents.find :all, :include => :category
189 @documents = @project.documents.find :all, :include => :category
190 end
190 end
191
191
192 # Add a new issue to @project
192 # Add a new issue to @project
193 def add_issue
193 def add_issue
194 @tracker = Tracker.find(params[:tracker_id])
194 @tracker = Tracker.find(params[:tracker_id])
195 @priorities = Enumeration::get_values('IPRI')
195 @priorities = Enumeration::get_values('IPRI')
196 @issue = Issue.new(:project => @project, :tracker => @tracker)
196 @issue = Issue.new(:project => @project, :tracker => @tracker)
197 if request.get?
197 if request.get?
198 @issue.start_date = Date.today
198 @issue.start_date = Date.today
199 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
199 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
200 else
200 else
201 @issue.attributes = params[:issue]
201 @issue.attributes = params[:issue]
202 @issue.author_id = self.logged_in_user.id if self.logged_in_user
202 @issue.author_id = self.logged_in_user.id if self.logged_in_user
203 # Multiple file upload
203 # Multiple file upload
204 @attachments = []
204 @attachments = []
205 params[:attachments].each { |a|
205 params[:attachments].each { |a|
206 @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0
206 @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0
207 } if params[:attachments] and params[:attachments].is_a? Array
207 } if params[:attachments] and params[:attachments].is_a? Array
208 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
208 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
209 @issue.custom_values = @custom_values
209 @issue.custom_values = @custom_values
210 if @issue.save
210 if @issue.save
211 @attachments.each(&:save)
211 @attachments.each(&:save)
212 flash[:notice] = l(:notice_successful_create)
212 flash[:notice] = l(:notice_successful_create)
213 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
213 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
214 redirect_to :action => 'list_issues', :id => @project
214 redirect_to :action => 'list_issues', :id => @project
215 end
215 end
216 end
216 end
217 end
217 end
218
218
219 # Show filtered/sorted issues list of @project
219 # Show filtered/sorted issues list of @project
220 def list_issues
220 def list_issues
221 sort_init 'issues.id', 'desc'
221 sort_init 'issues.id', 'desc'
222 sort_update
222 sort_update
223
223
224 retrieve_query
224 retrieve_query
225
225
226 @results_per_page_options = [ 15, 25, 50, 100 ]
226 @results_per_page_options = [ 15, 25, 50, 100 ]
227 if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i
227 if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i
228 @results_per_page = params[:per_page].to_i
228 @results_per_page = params[:per_page].to_i
229 session[:results_per_page] = @results_per_page
229 session[:results_per_page] = @results_per_page
230 else
230 else
231 @results_per_page = session[:results_per_page] || 25
231 @results_per_page = session[:results_per_page] || 25
232 end
232 end
233
233
234 if @query.valid?
234 if @query.valid?
235 @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
235 @issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
236 @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
236 @issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
237 @issues = Issue.find :all, :order => sort_clause,
237 @issues = Issue.find :all, :order => sort_clause,
238 :include => [ :author, :status, :tracker, :project ],
238 :include => [ :author, :status, :tracker, :project ],
239 :conditions => @query.statement,
239 :conditions => @query.statement,
240 :limit => @issue_pages.items_per_page,
240 :limit => @issue_pages.items_per_page,
241 :offset => @issue_pages.current.offset
241 :offset => @issue_pages.current.offset
242 end
242 end
243 @trackers = Tracker.find :all
243 render :layout => false if request.xhr?
244 render :layout => false if request.xhr?
244 end
245 end
245
246
246 # Export filtered/sorted issues list to CSV
247 # Export filtered/sorted issues list to CSV
247 def export_issues_csv
248 def export_issues_csv
248 sort_init 'issues.id', 'desc'
249 sort_init 'issues.id', 'desc'
249 sort_update
250 sort_update
250
251
251 retrieve_query
252 retrieve_query
252 render :action => 'list_issues' and return unless @query.valid?
253 render :action => 'list_issues' and return unless @query.valid?
253
254
254 @issues = Issue.find :all, :order => sort_clause,
255 @issues = Issue.find :all, :order => sort_clause,
255 :include => [ :author, :status, :tracker, :project, :custom_values ],
256 :include => [ :author, :status, :tracker, :project, :custom_values ],
256 :conditions => @query.statement
257 :conditions => @query.statement
257
258
258 ic = Iconv.new('ISO-8859-1', 'UTF-8')
259 ic = Iconv.new('ISO-8859-1', 'UTF-8')
259 export = StringIO.new
260 export = StringIO.new
260 CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
261 CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
261 # csv header fields
262 # csv header fields
262 headers = [ "#", l(:field_status), l(:field_tracker), l(:field_subject), l(:field_author), l(:field_created_on), l(:field_updated_on) ]
263 headers = [ "#", l(:field_status), l(:field_tracker), l(:field_subject), l(:field_author), l(:field_created_on), l(:field_updated_on) ]
263 for custom_field in @project.all_custom_fields
264 for custom_field in @project.all_custom_fields
264 headers << custom_field.name
265 headers << custom_field.name
265 end
266 end
266 csv << headers.collect {|c| ic.iconv(c) }
267 csv << headers.collect {|c| ic.iconv(c) }
267 # csv lines
268 # csv lines
268 @issues.each do |issue|
269 @issues.each do |issue|
269 fields = [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, l_datetime(issue.created_on), l_datetime(issue.updated_on)]
270 fields = [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, l_datetime(issue.created_on), l_datetime(issue.updated_on)]
270 for custom_field in @project.all_custom_fields
271 for custom_field in @project.all_custom_fields
271 fields << (show_value issue.custom_value_for(custom_field))
272 fields << (show_value issue.custom_value_for(custom_field))
272 end
273 end
273 csv << fields.collect {|c| ic.iconv(c.to_s) }
274 csv << fields.collect {|c| ic.iconv(c.to_s) }
274 end
275 end
275 end
276 end
276 export.rewind
277 export.rewind
277 send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv')
278 send_data(export.read, :type => 'text/csv; header=present', :filename => 'export.csv')
278 end
279 end
279
280
280 # Export filtered/sorted issues to PDF
281 # Export filtered/sorted issues to PDF
281 def export_issues_pdf
282 def export_issues_pdf
282 sort_init 'issues.id', 'desc'
283 sort_init 'issues.id', 'desc'
283 sort_update
284 sort_update
284
285
285 retrieve_query
286 retrieve_query
286 render :action => 'list_issues' and return unless @query.valid?
287 render :action => 'list_issues' and return unless @query.valid?
287
288
288 @issues = Issue.find :all, :order => sort_clause,
289 @issues = Issue.find :all, :order => sort_clause,
289 :include => [ :author, :status, :tracker, :project, :custom_values ],
290 :include => [ :author, :status, :tracker, :project, :custom_values ],
290 :conditions => @query.statement
291 :conditions => @query.statement
291
292
292 @options_for_rfpdf ||= {}
293 @options_for_rfpdf ||= {}
293 @options_for_rfpdf[:file_name] = "export.pdf"
294 @options_for_rfpdf[:file_name] = "export.pdf"
294 render :layout => false
295 render :layout => false
295 end
296 end
296
297
297 def move_issues
298 def move_issues
298 @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids]
299 @issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids]
299 redirect_to :action => 'list_issues', :id => @project and return unless @issues
300 redirect_to :action => 'list_issues', :id => @project and return unless @issues
300 @projects = []
301 @projects = []
301 # find projects to which the user is allowed to move the issue
302 # find projects to which the user is allowed to move the issue
302 @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)}
303 @logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)}
303 # issue can be moved to any tracker
304 # issue can be moved to any tracker
304 @trackers = Tracker.find(:all)
305 @trackers = Tracker.find(:all)
305 if request.post? and params[:new_project_id] and params[:new_tracker_id]
306 if request.post? and params[:new_project_id] and params[:new_tracker_id]
306 new_project = Project.find(params[:new_project_id])
307 new_project = Project.find(params[:new_project_id])
307 new_tracker = Tracker.find(params[:new_tracker_id])
308 new_tracker = Tracker.find(params[:new_tracker_id])
308 @issues.each { |i|
309 @issues.each { |i|
309 # project dependent properties
310 # project dependent properties
310 unless i.project_id == new_project.id
311 unless i.project_id == new_project.id
311 i.category = nil
312 i.category = nil
312 i.fixed_version = nil
313 i.fixed_version = nil
313 end
314 end
314 # move the issue
315 # move the issue
315 i.project = new_project
316 i.project = new_project
316 i.tracker = new_tracker
317 i.tracker = new_tracker
317 i.save
318 i.save
318 }
319 }
319 flash[:notice] = l(:notice_successful_update)
320 flash[:notice] = l(:notice_successful_update)
320 redirect_to :action => 'list_issues', :id => @project
321 redirect_to :action => 'list_issues', :id => @project
321 end
322 end
322 end
323 end
323
324
324 def add_query
325 def add_query
325 @query = Query.new(params[:query])
326 @query = Query.new(params[:query])
326 @query.project = @project
327 @query.project = @project
327 @query.user = logged_in_user
328 @query.user = logged_in_user
328
329
329 params[:fields].each do |field|
330 params[:fields].each do |field|
330 @query.add_filter(field, params[:operators][field], params[:values][field])
331 @query.add_filter(field, params[:operators][field], params[:values][field])
331 end if params[:fields]
332 end if params[:fields]
332
333
333 if request.post? and @query.save
334 if request.post? and @query.save
334 flash[:notice] = l(:notice_successful_create)
335 flash[:notice] = l(:notice_successful_create)
335 redirect_to :controller => 'reports', :action => 'issue_report', :id => @project
336 redirect_to :controller => 'reports', :action => 'issue_report', :id => @project
336 end
337 end
337 render :layout => false if request.xhr?
338 render :layout => false if request.xhr?
338 end
339 end
339
340
340 # Add a news to @project
341 # Add a news to @project
341 def add_news
342 def add_news
342 @news = News.new(:project => @project)
343 @news = News.new(:project => @project)
343 if request.post?
344 if request.post?
344 @news.attributes = params[:news]
345 @news.attributes = params[:news]
345 @news.author_id = self.logged_in_user.id if self.logged_in_user
346 @news.author_id = self.logged_in_user.id if self.logged_in_user
346 if @news.save
347 if @news.save
347 flash[:notice] = l(:notice_successful_create)
348 flash[:notice] = l(:notice_successful_create)
348 redirect_to :action => 'list_news', :id => @project
349 redirect_to :action => 'list_news', :id => @project
349 end
350 end
350 end
351 end
351 end
352 end
352
353
353 # Show news list of @project
354 # Show news list of @project
354 def list_news
355 def list_news
355 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
356 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
356 render :action => "list_news", :layout => false if request.xhr?
357 render :action => "list_news", :layout => false if request.xhr?
357 end
358 end
358
359
359 def add_file
360 def add_file
360 if request.post?
361 if request.post?
361 @version = @project.versions.find_by_id(params[:version_id])
362 @version = @project.versions.find_by_id(params[:version_id])
362 # Save the attachments
363 # Save the attachments
363 params[:attachments].each { |a|
364 params[:attachments].each { |a|
364 Attachment.create(:container => @version, :file => a, :author => logged_in_user) unless a.size == 0
365 Attachment.create(:container => @version, :file => a, :author => logged_in_user) unless a.size == 0
365 } if params[:attachments] and params[:attachments].is_a? Array
366 } if params[:attachments] and params[:attachments].is_a? Array
366 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
367 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
367 end
368 end
368 @versions = @project.versions
369 @versions = @project.versions
369 end
370 end
370
371
371 def list_files
372 def list_files
372 @versions = @project.versions
373 @versions = @project.versions
373 end
374 end
374
375
375 # Show changelog for @project
376 # Show changelog for @project
376 def changelog
377 def changelog
377 @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
378 @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
378 if request.get?
379 if request.get?
379 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
380 @selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
380 else
381 else
381 @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
382 @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
382 end
383 end
383 @selected_tracker_ids ||= []
384 @selected_tracker_ids ||= []
384 @fixed_issues = @project.issues.find(:all,
385 @fixed_issues = @project.issues.find(:all,
385 :include => [ :fixed_version, :status, :tracker ],
386 :include => [ :fixed_version, :status, :tracker ],
386 :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
387 :conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
387 :order => "versions.effective_date DESC, issues.id DESC"
388 :order => "versions.effective_date DESC, issues.id DESC"
388 ) unless @selected_tracker_ids.empty?
389 ) unless @selected_tracker_ids.empty?
389 @fixed_issues ||= []
390 @fixed_issues ||= []
390 end
391 end
391
392
392 def activity
393 def activity
393 if params[:year] and params[:year].to_i > 1900
394 if params[:year] and params[:year].to_i > 1900
394 @year = params[:year].to_i
395 @year = params[:year].to_i
395 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
396 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
396 @month = params[:month].to_i
397 @month = params[:month].to_i
397 end
398 end
398 end
399 end
399 @year ||= Date.today.year
400 @year ||= Date.today.year
400 @month ||= Date.today.month
401 @month ||= Date.today.month
401
402
402 @date_from = Date.civil(@year, @month, 1)
403 @date_from = Date.civil(@year, @month, 1)
403 @date_to = (@date_from >> 1)-1
404 @date_to = (@date_from >> 1)-1
404
405
405 @events_by_day = {}
406 @events_by_day = {}
406
407
407 unless params[:show_issues] == "0"
408 unless params[:show_issues] == "0"
408 @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i|
409 @project.issues.find(:all, :include => [:author, :status], :conditions => ["issues.created_on>=? and issues.created_on<=?", @date_from, @date_to] ).each { |i|
409 @events_by_day[i.created_on.to_date] ||= []
410 @events_by_day[i.created_on.to_date] ||= []
410 @events_by_day[i.created_on.to_date] << i
411 @events_by_day[i.created_on.to_date] << i
411 }
412 }
412 @show_issues = 1
413 @show_issues = 1
413 end
414 end
414
415
415 unless params[:show_news] == "0"
416 unless params[:show_news] == "0"
416 @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
417 @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
417 @events_by_day[i.created_on.to_date] ||= []
418 @events_by_day[i.created_on.to_date] ||= []
418 @events_by_day[i.created_on.to_date] << i
419 @events_by_day[i.created_on.to_date] << i
419 }
420 }
420 @show_news = 1
421 @show_news = 1
421 end
422 end
422
423
423 unless params[:show_files] == "0"
424 unless params[:show_files] == "0"
424 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
425 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
425 @events_by_day[i.created_on.to_date] ||= []
426 @events_by_day[i.created_on.to_date] ||= []
426 @events_by_day[i.created_on.to_date] << i
427 @events_by_day[i.created_on.to_date] << i
427 }
428 }
428 @show_files = 1
429 @show_files = 1
429 end
430 end
430
431
431 unless params[:show_documents] == "0"
432 unless params[:show_documents] == "0"
432 @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|
433 @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|
433 @events_by_day[i.created_on.to_date] ||= []
434 @events_by_day[i.created_on.to_date] ||= []
434 @events_by_day[i.created_on.to_date] << i
435 @events_by_day[i.created_on.to_date] << i
435 }
436 }
436 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
437 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
437 @events_by_day[i.created_on.to_date] ||= []
438 @events_by_day[i.created_on.to_date] ||= []
438 @events_by_day[i.created_on.to_date] << i
439 @events_by_day[i.created_on.to_date] << i
439 }
440 }
440 @show_documents = 1
441 @show_documents = 1
441 end
442 end
442
443
443 render :layout => false if request.xhr?
444 render :layout => false if request.xhr?
444 end
445 end
445
446
446 def calendar
447 def calendar
447 if params[:year] and params[:year].to_i > 1900
448 if params[:year] and params[:year].to_i > 1900
448 @year = params[:year].to_i
449 @year = params[:year].to_i
449 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
450 if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
450 @month = params[:month].to_i
451 @month = params[:month].to_i
451 end
452 end
452 end
453 end
453 @year ||= Date.today.year
454 @year ||= Date.today.year
454 @month ||= Date.today.month
455 @month ||= Date.today.month
455
456
456 @date_from = Date.civil(@year, @month, 1)
457 @date_from = Date.civil(@year, @month, 1)
457 @date_to = (@date_from >> 1)-1
458 @date_to = (@date_from >> 1)-1
458 # start on monday
459 # start on monday
459 @date_from = @date_from - (@date_from.cwday-1)
460 @date_from = @date_from - (@date_from.cwday-1)
460 # finish on sunday
461 # finish on sunday
461 @date_to = @date_to + (7-@date_to.cwday)
462 @date_to = @date_to + (7-@date_to.cwday)
462
463
463 @issues = @project.issues.find(:all, :include => :tracker, :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])
464 @issues = @project.issues.find(:all, :include => :tracker, :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])
464 render :layout => false if request.xhr?
465 render :layout => false if request.xhr?
465 end
466 end
466
467
467 def gantt
468 def gantt
468 if params[:year] and params[:year].to_i >0
469 if params[:year] and params[:year].to_i >0
469 @year_from = params[:year].to_i
470 @year_from = params[:year].to_i
470 if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12
471 if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12
471 @month_from = params[:month].to_i
472 @month_from = params[:month].to_i
472 else
473 else
473 @month_from = 1
474 @month_from = 1
474 end
475 end
475 else
476 else
476 @month_from ||= (Date.today << 1).month
477 @month_from ||= (Date.today << 1).month
477 @year_from ||= (Date.today << 1).year
478 @year_from ||= (Date.today << 1).year
478 end
479 end
479
480
480 @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2
481 @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2
481 @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6
482 @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6
482
483
483 @date_from = Date.civil(@year_from, @month_from, 1)
484 @date_from = Date.civil(@year_from, @month_from, 1)
484 @date_to = (@date_from >> @months) - 1
485 @date_to = (@date_from >> @months) - 1
485 @issues = @project.issues.find(:all, :order => "start_date, due_date", :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])
486 @issues = @project.issues.find(:all, :order => "start_date, due_date", :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])
486
487
487 if params[:output]=='pdf'
488 if params[:output]=='pdf'
488 @options_for_rfpdf ||= {}
489 @options_for_rfpdf ||= {}
489 @options_for_rfpdf[:file_name] = "gantt.pdf"
490 @options_for_rfpdf[:file_name] = "gantt.pdf"
490 render :template => "projects/gantt.rfpdf", :layout => false
491 render :template => "projects/gantt.rfpdf", :layout => false
491 else
492 else
492 render :template => "projects/gantt.rhtml"
493 render :template => "projects/gantt.rhtml"
493 end
494 end
494 end
495 end
495
496
496 private
497 private
497 # Find project of id params[:id]
498 # Find project of id params[:id]
498 # if not found, redirect to project list
499 # if not found, redirect to project list
499 # Used as a before_filter
500 # Used as a before_filter
500 def find_project
501 def find_project
501 @project = Project.find(params[:id])
502 @project = Project.find(params[:id])
502 @html_title = @project.name
503 @html_title = @project.name
503 rescue ActiveRecord::RecordNotFound
504 rescue ActiveRecord::RecordNotFound
504 render_404
505 render_404
505 end
506 end
506
507
507 # Retrieve query from session or build a new query
508 # Retrieve query from session or build a new query
508 def retrieve_query
509 def retrieve_query
509 if params[:query_id]
510 if params[:query_id]
510 @query = @project.queries.find(params[:query_id])
511 @query = @project.queries.find(params[:query_id])
511 else
512 else
512 if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id
513 if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id
513 # Give it a name, required to be valid
514 # Give it a name, required to be valid
514 @query = Query.new(:name => "_")
515 @query = Query.new(:name => "_")
515 @query.project = @project
516 @query.project = @project
516 if params[:fields] and params[:fields].is_a? Array
517 if params[:fields] and params[:fields].is_a? Array
517 params[:fields].each do |field|
518 params[:fields].each do |field|
518 @query.add_filter(field, params[:operators][field], params[:values][field])
519 @query.add_filter(field, params[:operators][field], params[:values][field])
519 end
520 end
520 else
521 else
521 @query.available_filters.keys.each do |field|
522 @query.available_filters.keys.each do |field|
522 @query.add_short_filter(field, params[field]) if params[field]
523 @query.add_short_filter(field, params[field]) if params[field]
523 end
524 end
524 end
525 end
525 session[:query] = @query
526 session[:query] = @query
526 else
527 else
527 @query = session[:query]
528 @query = session[:query]
528 end
529 end
529 end
530 end
530 end
531 end
531 end
532 end
@@ -1,81 +1,85
1 <% if @query.new_record? %>
1 <% if @query.new_record? %>
2 <div class="contextual">
3 <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
4 </div>
2 <h2><%=l(:label_issue_plural)%></h2>
5 <h2><%=l(:label_issue_plural)%></h2>
3
6
4 <%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %>
7 <%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %>
5 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
8 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
6 <%= end_form_tag %>
9 <%= end_form_tag %>
7 <div class="contextual">
10 <div class="contextual">
8 <%= link_to_remote l(:button_apply),
11 <%= link_to_remote l(:button_apply),
9 { :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },
12 { :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },
10 :update => "content",
13 :update => "content",
11 :with => "Form.serialize('query_form')"
14 :with => "Form.serialize('query_form')"
12 }, :class => 'pic picCheck' %>
15 }, :class => 'pic picCheck' %>
13
16
14 <%= link_to l(:button_clear), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, :class => 'pic picDelete' %>
17 <%= link_to l(:button_clear), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, :class => 'pic picDelete' %>
15 <% if authorize_for('projects', 'add_query') %>
18 <% if authorize_for('projects', 'add_query') %>
16
19
17 <%= link_to_remote l(:button_save),
20 <%= link_to_remote l(:button_save),
18 { :url => { :controller => 'projects', :action => "add_query", :id => @project },
21 { :url => { :controller => 'projects', :action => "add_query", :id => @project },
19 :method => 'get',
22 :method => 'get',
20 :update => "content",
23 :update => "content",
21 :with => "Form.serialize('query_form')"
24 :with => "Form.serialize('query_form')"
22 }, :class => 'pic picEdit' %>
25 }, :class => 'pic picEdit' %>
23 <% end %>
26 <% end %>
24 </div>
27 </div>
25 <br />
28 <br />
26 <% else %>
29 <% else %>
27 <% if authorize_for('projects', 'add_query') %>
28 <div class="contextual">
30 <div class="contextual">
29 <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'pic picEdit' %>
31 <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
30 <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %>
32 <% if authorize_for('projects', 'add_query') %>
33 <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'pic picEdit' %>
34 <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %>
35 <% end %>
31 </div>
36 </div>
32 <% end %>
33 <h2><%= @query.name %></h2>
37 <h2><%= @query.name %></h2>
34 <% end %>
38 <% end %>
35 <%= error_messages_for 'query' %>
39 <%= error_messages_for 'query' %>
36 <% if @query.valid? %>
40 <% if @query.valid? %>
37 <% if @issues.empty? %>
41 <% if @issues.empty? %>
38 <p><i><%= l(:label_no_data) %></i></p>
42 <p><i><%= l(:label_no_data) %></i></p>
39 <% else %>
43 <% else %>
40 &nbsp;
44 &nbsp;
41 <%= start_form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
45 <%= start_form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
42 <table class="list">
46 <table class="list">
43 <thead><tr>
47 <thead><tr>
44 <th></th>
48 <th></th>
45 <%= sort_header_tag('issues.id', :caption => '#') %>
49 <%= sort_header_tag('issues.id', :caption => '#') %>
46 <%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>
50 <%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>
47 <%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>
51 <%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>
48 <th><%=l(:field_subject)%></th>
52 <th><%=l(:field_subject)%></th>
49 <%= sort_header_tag('users.lastname', :caption => l(:field_author)) %>
53 <%= sort_header_tag('users.lastname', :caption => l(:field_author)) %>
50 <%= sort_header_tag('issues.created_on', :caption => l(:field_created_on)) %>
54 <%= sort_header_tag('issues.created_on', :caption => l(:field_created_on)) %>
51 <%= sort_header_tag('issues.updated_on', :caption => l(:field_updated_on)) %>
55 <%= sort_header_tag('issues.updated_on', :caption => l(:field_updated_on)) %>
52 </tr></thead>
56 </tr></thead>
53 <tbody>
57 <tbody>
54 <% for issue in @issues %>
58 <% for issue in @issues %>
55 <tr class="<%= cycle("odd", "even") %>">
59 <tr class="<%= cycle("odd", "even") %>">
56 <th width="15"><%= check_box_tag "issue_ids[]", issue.id %></th>
60 <th width="15"><%= check_box_tag "issue_ids[]", issue.id %></th>
57 <td align="center"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
61 <td align="center"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
58 <td align="center"><%= issue.tracker.name %></td>
62 <td align="center"><%= issue.tracker.name %></td>
59 <td><div class="square" style="background:#<%= issue.status.html_color %>;"></div> <%= issue.status.name %></td>
63 <td><div class="square" style="background:#<%= issue.status.html_color %>;"></div> <%= issue.status.name %></td>
60 <td><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></td>
64 <td><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></td>
61 <td align="center"><%= issue.author.display_name %></td>
65 <td align="center"><%= issue.author.display_name %></td>
62 <td align="center"><%= format_time(issue.created_on) %></td>
66 <td align="center"><%= format_time(issue.created_on) %></td>
63 <td align="center"><%= format_time(issue.updated_on) %></td>
67 <td align="center"><%= format_time(issue.updated_on) %></td>
64 </tr>
68 </tr>
65 <% end %>
69 <% end %>
66 </tbody>
70 </tbody>
67 </table>
71 </table>
68 <div class="contextual">
72 <div class="contextual">
69 <%= l(:label_export_to) %>
73 <%= l(:label_export_to) %>
70 <%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'icon file' %>,
74 <%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'icon file' %>,
71 <%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'pic picPdf' %>
75 <%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'pic picPdf' %>
72 </div>
76 </div>
73
77
74 <%= submit_tag l(:button_move), :class => "button-small" %>
78 <%= submit_tag l(:button_move), :class => "button-small" %>
75 <%= end_form_tag %>
79 <%= end_form_tag %>
76 &nbsp;
80 &nbsp;
77 <%= pagination_links_full @issue_pages %>
81 <%= pagination_links_full @issue_pages %>
78 [ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
82 [ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
79
83
80 <% end %>
84 <% end %>
81 <% end %> No newline at end of file
85 <% end %>
@@ -1,67 +1,62
1 <h2><%=l(:label_overview)%></h2>
1 <h2><%=l(:label_overview)%></h2>
2
2
3 <div class="splitcontentleft">
3 <div class="splitcontentleft">
4 <%= simple_format(auto_link(h(@project.description))) %>
4 <%= simple_format(auto_link(h(@project.description))) %>
5 <ul>
5 <ul>
6 <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
6 <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
7 <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
7 <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
8 <% for custom_value in @custom_values %>
8 <% for custom_value in @custom_values %>
9 <% if !custom_value.value.empty? %>
9 <% if !custom_value.value.empty? %>
10 <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
10 <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
11 <% end %>
11 <% end %>
12 <% end %>
12 <% end %>
13 </ul>
13 </ul>
14
14
15 <div class="box">
15 <div class="box">
16 <div class="contextual">
17 <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %>
18 </div>
16 <h3><%= image_tag "tracker" %> <%=l(:label_tracker_plural)%></h3>
19 <h3><%= image_tag "tracker" %> <%=l(:label_tracker_plural)%></h3>
17 <ul>
20 <ul>
18 <% for tracker in @trackers %>
21 <% for tracker in @trackers %>
19 <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project,
22 <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project,
20 :set_filter => 1,
23 :set_filter => 1,
21 "tracker_id" => tracker.id %>:
24 "tracker_id" => tracker.id %>:
22 <%= issue_count = Issue.count(:conditions => ["project_id=? and tracker_id=? and issue_statuses.is_closed=?", @project.id, tracker.id, false], :include => :status) %>
25 <%= issue_count = Issue.count(:conditions => ["project_id=? and tracker_id=? and issue_statuses.is_closed=?", @project.id, tracker.id, false], :include => :status) %>
23 <%= lwr(:label_open_issues, issue_count) %>
26 <%= lwr(:label_open_issues, issue_count) %>
24 </li>
27 </li>
25 <% end %>
28 <% end %>
26 </ul>
29 </ul>
27 <% if authorize_for 'projects', 'add_issue' %>
28 &#187; <%=l(:label_issue_new)%>:
29 <ul>
30 <% @trackers.each do |tracker| %>
31 <li><%= link_to tracker.name, :controller => 'projects', :action => 'add_issue', :id => @project, :tracker_id => tracker %></li>
32 <% end %>
33 </ul>
34 <% end %>
35 <center><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></center>
30 <center><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></center>
36 </div>
31 </div>
37 </div>
32 </div>
38
33
39 <div class="splitcontentright">
34 <div class="splitcontentright">
40 <div class="box">
35 <div class="box">
41 <h3><%= image_tag "users" %> <%=l(:label_member_plural)%></h3>
36 <h3><%= image_tag "users" %> <%=l(:label_member_plural)%></h3>
42 <% for member in @members %>
37 <% for member in @members %>
43 <%= link_to_user member.user %> (<%= member.role.name %>)<br />
38 <%= link_to_user member.user %> (<%= member.role.name %>)<br />
44 <% end %>
39 <% end %>
45 </div>
40 </div>
46
41
47 <% if @subprojects %>
42 <% if @subprojects %>
48 <div class="box">
43 <div class="box">
49 <h3><%= image_tag "projects" %> <%=l(:label_subproject_plural)%></h3>
44 <h3><%= image_tag "projects" %> <%=l(:label_subproject_plural)%></h3>
50 <% for subproject in @subprojects %>
45 <% for subproject in @subprojects %>
51 <%= link_to subproject.name, :action => 'show', :id => subproject %><br />
46 <%= link_to subproject.name, :action => 'show', :id => subproject %><br />
52 <% end %>
47 <% end %>
53 </div>
48 </div>
54 <% end %>
49 <% end %>
55
50
56 <div class="box">
51 <div class="box">
57 <h3><%=l(:label_news_latest)%></h3>
52 <h3><%=l(:label_news_latest)%></h3>
58 <%= render :partial => 'news/news', :collection => @news %>
53 <%= render :partial => 'news/news', :collection => @news %>
59 <center><small><%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %></small></center>
54 <center><small><%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %></small></center>
60 </div>
55 </div>
61 </div>
56 </div>
62
57
63
58
64
59
65
60
66
61
67
62
General Comments 0
You need to be logged in to leave comments. Login now