##// END OF EJS Templates
Keep status filter on the projects list when un/archiving a project (#3530)....
Jean-Philippe Lang -
r2706:937823a0d849
parent child
Show More
@@ -1,326 +1,326
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, :copy, :activity ]
26 before_filter :find_project, :except => [ :index, :list, :add, :copy, :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, :copy, :archive, :unarchive, :destroy, :activity ]
28 before_filter :authorize, :except => [ :index, :list, :add, :copy, :archive, :unarchive, :destroy, :activity ]
29 before_filter :authorize_global, :only => :add
29 before_filter :authorize_global, :only => :add
30 before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
30 before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
31 accept_key_auth :activity
31 accept_key_auth :activity
32
32
33 after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do |controller|
33 after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do |controller|
34 if controller.request.post?
34 if controller.request.post?
35 controller.send :expire_action, :controller => 'welcome', :action => 'robots.txt'
35 controller.send :expire_action, :controller => 'welcome', :action => 'robots.txt'
36 end
36 end
37 end
37 end
38
38
39 helper :sort
39 helper :sort
40 include SortHelper
40 include SortHelper
41 helper :custom_fields
41 helper :custom_fields
42 include CustomFieldsHelper
42 include CustomFieldsHelper
43 helper :issues
43 helper :issues
44 helper IssuesHelper
44 helper IssuesHelper
45 helper :queries
45 helper :queries
46 include QueriesHelper
46 include QueriesHelper
47 helper :repositories
47 helper :repositories
48 include RepositoriesHelper
48 include RepositoriesHelper
49 include ProjectsHelper
49 include ProjectsHelper
50
50
51 # Lists visible projects
51 # Lists visible projects
52 def index
52 def index
53 respond_to do |format|
53 respond_to do |format|
54 format.html {
54 format.html {
55 @projects = Project.visible.find(:all, :order => 'lft')
55 @projects = Project.visible.find(:all, :order => 'lft')
56 }
56 }
57 format.atom {
57 format.atom {
58 projects = Project.visible.find(:all, :order => 'created_on DESC',
58 projects = Project.visible.find(:all, :order => 'created_on DESC',
59 :limit => Setting.feeds_limit.to_i)
59 :limit => Setting.feeds_limit.to_i)
60 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
60 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
61 }
61 }
62 end
62 end
63 end
63 end
64
64
65 # Add a new project
65 # Add a new project
66 def add
66 def add
67 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
67 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
68 @trackers = Tracker.all
68 @trackers = Tracker.all
69 @project = Project.new(params[:project])
69 @project = Project.new(params[:project])
70 if request.get?
70 if request.get?
71 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
71 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
72 @project.trackers = Tracker.all
72 @project.trackers = Tracker.all
73 @project.is_public = Setting.default_projects_public?
73 @project.is_public = Setting.default_projects_public?
74 @project.enabled_module_names = Redmine::AccessControl.available_project_modules
74 @project.enabled_module_names = Redmine::AccessControl.available_project_modules
75 else
75 else
76 @project.enabled_module_names = params[:enabled_modules]
76 @project.enabled_module_names = params[:enabled_modules]
77 if @project.save
77 if @project.save
78 @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id')
78 @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id')
79 # Add current user as a project member if he is not admin
79 # Add current user as a project member if he is not admin
80 unless User.current.admin?
80 unless User.current.admin?
81 r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
81 r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
82 m = Member.new(:user => User.current, :roles => [r])
82 m = Member.new(:user => User.current, :roles => [r])
83 @project.members << m
83 @project.members << m
84 end
84 end
85 flash[:notice] = l(:notice_successful_create)
85 flash[:notice] = l(:notice_successful_create)
86 redirect_to :controller => 'projects', :action => 'settings', :id => @project
86 redirect_to :controller => 'projects', :action => 'settings', :id => @project
87 end
87 end
88 end
88 end
89 end
89 end
90
90
91 def copy
91 def copy
92 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
92 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
93 @trackers = Tracker.all
93 @trackers = Tracker.all
94 @root_projects = Project.find(:all,
94 @root_projects = Project.find(:all,
95 :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
95 :conditions => "parent_id IS NULL AND status = #{Project::STATUS_ACTIVE}",
96 :order => 'name')
96 :order => 'name')
97 if request.get?
97 if request.get?
98 @project = Project.copy_from(params[:id])
98 @project = Project.copy_from(params[:id])
99 if @project
99 if @project
100 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
100 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
101 else
101 else
102 redirect_to :controller => 'admin', :action => 'projects'
102 redirect_to :controller => 'admin', :action => 'projects'
103 end
103 end
104 else
104 else
105 @project = Project.new(params[:project])
105 @project = Project.new(params[:project])
106 @project.enabled_module_names = params[:enabled_modules]
106 @project.enabled_module_names = params[:enabled_modules]
107 if @project.copy(params[:id])
107 if @project.copy(params[:id])
108 flash[:notice] = l(:notice_successful_create)
108 flash[:notice] = l(:notice_successful_create)
109 redirect_to :controller => 'admin', :action => 'projects'
109 redirect_to :controller => 'admin', :action => 'projects'
110 end
110 end
111 end
111 end
112 end
112 end
113
113
114
114
115 # Show @project
115 # Show @project
116 def show
116 def show
117 if params[:jump]
117 if params[:jump]
118 # try to redirect to the requested menu item
118 # try to redirect to the requested menu item
119 redirect_to_project_menu_item(@project, params[:jump]) && return
119 redirect_to_project_menu_item(@project, params[:jump]) && return
120 end
120 end
121
121
122 @users_by_role = @project.users_by_role
122 @users_by_role = @project.users_by_role
123 @subprojects = @project.children.visible
123 @subprojects = @project.children.visible
124 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
124 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
125 @trackers = @project.rolled_up_trackers
125 @trackers = @project.rolled_up_trackers
126
126
127 cond = @project.project_condition(Setting.display_subprojects_issues?)
127 cond = @project.project_condition(Setting.display_subprojects_issues?)
128
128
129 @open_issues_by_tracker = Issue.visible.count(:group => :tracker,
129 @open_issues_by_tracker = Issue.visible.count(:group => :tracker,
130 :include => [:project, :status, :tracker],
130 :include => [:project, :status, :tracker],
131 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false])
131 :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false])
132 @total_issues_by_tracker = Issue.visible.count(:group => :tracker,
132 @total_issues_by_tracker = Issue.visible.count(:group => :tracker,
133 :include => [:project, :status, :tracker],
133 :include => [:project, :status, :tracker],
134 :conditions => cond)
134 :conditions => cond)
135
135
136 TimeEntry.visible_by(User.current) do
136 TimeEntry.visible_by(User.current) do
137 @total_hours = TimeEntry.sum(:hours,
137 @total_hours = TimeEntry.sum(:hours,
138 :include => :project,
138 :include => :project,
139 :conditions => cond).to_f
139 :conditions => cond).to_f
140 end
140 end
141 @key = User.current.rss_key
141 @key = User.current.rss_key
142 end
142 end
143
143
144 def settings
144 def settings
145 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
145 @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
146 @issue_category ||= IssueCategory.new
146 @issue_category ||= IssueCategory.new
147 @member ||= @project.members.new
147 @member ||= @project.members.new
148 @trackers = Tracker.all
148 @trackers = Tracker.all
149 @repository ||= @project.repository
149 @repository ||= @project.repository
150 @wiki ||= @project.wiki
150 @wiki ||= @project.wiki
151 end
151 end
152
152
153 # Edit @project
153 # Edit @project
154 def edit
154 def edit
155 if request.post?
155 if request.post?
156 @project.attributes = params[:project]
156 @project.attributes = params[:project]
157 if @project.save
157 if @project.save
158 @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id')
158 @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id')
159 flash[:notice] = l(:notice_successful_update)
159 flash[:notice] = l(:notice_successful_update)
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 def modules
168 def modules
169 @project.enabled_module_names = params[:enabled_modules]
169 @project.enabled_module_names = params[:enabled_modules]
170 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
170 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
171 end
171 end
172
172
173 def archive
173 def archive
174 @project.archive if request.post? && @project.active?
174 @project.archive if request.post? && @project.active?
175 redirect_to :controller => 'admin', :action => 'projects'
175 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
176 end
176 end
177
177
178 def unarchive
178 def unarchive
179 @project.unarchive if request.post? && !@project.active?
179 @project.unarchive if request.post? && !@project.active?
180 redirect_to :controller => 'admin', :action => 'projects'
180 redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
181 end
181 end
182
182
183 # Delete @project
183 # Delete @project
184 def destroy
184 def destroy
185 @project_to_destroy = @project
185 @project_to_destroy = @project
186 if request.post? and params[:confirm]
186 if request.post? and params[:confirm]
187 @project_to_destroy.destroy
187 @project_to_destroy.destroy
188 redirect_to :controller => 'admin', :action => 'projects'
188 redirect_to :controller => 'admin', :action => 'projects'
189 end
189 end
190 # hide project in layout
190 # hide project in layout
191 @project = nil
191 @project = nil
192 end
192 end
193
193
194 # Add a new issue category to @project
194 # Add a new issue category to @project
195 def add_issue_category
195 def add_issue_category
196 @category = @project.issue_categories.build(params[:category])
196 @category = @project.issue_categories.build(params[:category])
197 if request.post? and @category.save
197 if request.post? and @category.save
198 respond_to do |format|
198 respond_to do |format|
199 format.html do
199 format.html do
200 flash[:notice] = l(:notice_successful_create)
200 flash[:notice] = l(:notice_successful_create)
201 redirect_to :action => 'settings', :tab => 'categories', :id => @project
201 redirect_to :action => 'settings', :tab => 'categories', :id => @project
202 end
202 end
203 format.js do
203 format.js do
204 # IE doesn't support the replace_html rjs method for select box options
204 # IE doesn't support the replace_html rjs method for select box options
205 render(:update) {|page| page.replace "issue_category_id",
205 render(:update) {|page| page.replace "issue_category_id",
206 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]')
206 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]')
207 }
207 }
208 end
208 end
209 end
209 end
210 end
210 end
211 end
211 end
212
212
213 # Add a new version to @project
213 # Add a new version to @project
214 def add_version
214 def add_version
215 @version = @project.versions.build(params[:version])
215 @version = @project.versions.build(params[:version])
216 if request.post? and @version.save
216 if request.post? and @version.save
217 flash[:notice] = l(:notice_successful_create)
217 flash[:notice] = l(:notice_successful_create)
218 redirect_to :action => 'settings', :tab => 'versions', :id => @project
218 redirect_to :action => 'settings', :tab => 'versions', :id => @project
219 end
219 end
220 end
220 end
221
221
222 def add_file
222 def add_file
223 if request.post?
223 if request.post?
224 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
224 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
225 attachments = attach_files(container, params[:attachments])
225 attachments = attach_files(container, params[:attachments])
226 if !attachments.empty? && Setting.notified_events.include?('file_added')
226 if !attachments.empty? && Setting.notified_events.include?('file_added')
227 Mailer.deliver_attachments_added(attachments)
227 Mailer.deliver_attachments_added(attachments)
228 end
228 end
229 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
229 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
230 return
230 return
231 end
231 end
232 @versions = @project.versions.sort
232 @versions = @project.versions.sort
233 end
233 end
234
234
235 def list_files
235 def list_files
236 sort_init 'filename', 'asc'
236 sort_init 'filename', 'asc'
237 sort_update 'filename' => "#{Attachment.table_name}.filename",
237 sort_update 'filename' => "#{Attachment.table_name}.filename",
238 'created_on' => "#{Attachment.table_name}.created_on",
238 'created_on' => "#{Attachment.table_name}.created_on",
239 'size' => "#{Attachment.table_name}.filesize",
239 'size' => "#{Attachment.table_name}.filesize",
240 'downloads' => "#{Attachment.table_name}.downloads"
240 'downloads' => "#{Attachment.table_name}.downloads"
241
241
242 @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
242 @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
243 @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
243 @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
244 render :layout => !request.xhr?
244 render :layout => !request.xhr?
245 end
245 end
246
246
247 # Show changelog for @project
247 # Show changelog for @project
248 def changelog
248 def changelog
249 @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
249 @trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
250 retrieve_selected_tracker_ids(@trackers)
250 retrieve_selected_tracker_ids(@trackers)
251 @versions = @project.versions.sort
251 @versions = @project.versions.sort
252 end
252 end
253
253
254 def roadmap
254 def roadmap
255 @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true])
255 @trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true])
256 retrieve_selected_tracker_ids(@trackers)
256 retrieve_selected_tracker_ids(@trackers)
257 @versions = @project.versions.sort
257 @versions = @project.versions.sort
258 @versions = @versions.select {|v| !v.completed? } unless params[:completed]
258 @versions = @versions.select {|v| !v.completed? } unless params[:completed]
259 end
259 end
260
260
261 def activity
261 def activity
262 @days = Setting.activity_days_default.to_i
262 @days = Setting.activity_days_default.to_i
263
263
264 if params[:from]
264 if params[:from]
265 begin; @date_to = params[:from].to_date + 1; rescue; end
265 begin; @date_to = params[:from].to_date + 1; rescue; end
266 end
266 end
267
267
268 @date_to ||= Date.today + 1
268 @date_to ||= Date.today + 1
269 @date_from = @date_to - @days
269 @date_from = @date_to - @days
270 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
270 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
271 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
271 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
272
272
273 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
273 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
274 :with_subprojects => @with_subprojects,
274 :with_subprojects => @with_subprojects,
275 :author => @author)
275 :author => @author)
276 @activity.scope_select {|t| !params["show_#{t}"].nil?}
276 @activity.scope_select {|t| !params["show_#{t}"].nil?}
277 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
277 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
278
278
279 events = @activity.events(@date_from, @date_to)
279 events = @activity.events(@date_from, @date_to)
280
280
281 respond_to do |format|
281 respond_to do |format|
282 format.html {
282 format.html {
283 @events_by_day = events.group_by(&:event_date)
283 @events_by_day = events.group_by(&:event_date)
284 render :layout => false if request.xhr?
284 render :layout => false if request.xhr?
285 }
285 }
286 format.atom {
286 format.atom {
287 title = l(:label_activity)
287 title = l(:label_activity)
288 if @author
288 if @author
289 title = @author.name
289 title = @author.name
290 elsif @activity.scope.size == 1
290 elsif @activity.scope.size == 1
291 title = l("label_#{@activity.scope.first.singularize}_plural")
291 title = l("label_#{@activity.scope.first.singularize}_plural")
292 end
292 end
293 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
293 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
294 }
294 }
295 end
295 end
296
296
297 rescue ActiveRecord::RecordNotFound
297 rescue ActiveRecord::RecordNotFound
298 render_404
298 render_404
299 end
299 end
300
300
301 private
301 private
302 # Find project of id params[:id]
302 # Find project of id params[:id]
303 # if not found, redirect to project list
303 # if not found, redirect to project list
304 # Used as a before_filter
304 # Used as a before_filter
305 def find_project
305 def find_project
306 @project = Project.find(params[:id])
306 @project = Project.find(params[:id])
307 rescue ActiveRecord::RecordNotFound
307 rescue ActiveRecord::RecordNotFound
308 render_404
308 render_404
309 end
309 end
310
310
311 def find_optional_project
311 def find_optional_project
312 return true unless params[:id]
312 return true unless params[:id]
313 @project = Project.find(params[:id])
313 @project = Project.find(params[:id])
314 authorize
314 authorize
315 rescue ActiveRecord::RecordNotFound
315 rescue ActiveRecord::RecordNotFound
316 render_404
316 render_404
317 end
317 end
318
318
319 def retrieve_selected_tracker_ids(selectable_trackers)
319 def retrieve_selected_tracker_ids(selectable_trackers)
320 if ids = params[:tracker_ids]
320 if ids = params[:tracker_ids]
321 @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
321 @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
322 else
322 else
323 @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s }
323 @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s }
324 end
324 end
325 end
325 end
326 end
326 end
@@ -1,44 +1,44
1 <div class="contextual">
1 <div class="contextual">
2 <%= link_to l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add' %>
2 <%= link_to l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add' %>
3 </div>
3 </div>
4
4
5 <h2><%=l(:label_project_plural)%></h2>
5 <h2><%=l(:label_project_plural)%></h2>
6
6
7 <% form_tag({}, :method => :get) do %>
7 <% form_tag({}, :method => :get) do %>
8 <fieldset><legend><%= l(:label_filter_plural) %></legend>
8 <fieldset><legend><%= l(:label_filter_plural) %></legend>
9 <label><%= l(:field_status) %> :</label>
9 <label><%= l(:field_status) %> :</label>
10 <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
10 <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
11 <label><%= l(:label_project) %>:</label>
11 <label><%= l(:label_project) %>:</label>
12 <%= text_field_tag 'name', params[:name], :size => 30 %>
12 <%= text_field_tag 'name', params[:name], :size => 30 %>
13 <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
13 <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
14 </fieldset>
14 </fieldset>
15 <% end %>
15 <% end %>
16 &nbsp;
16 &nbsp;
17
17
18 <table class="list">
18 <table class="list">
19 <thead><tr>
19 <thead><tr>
20 <th><%=l(:label_project)%></th>
20 <th><%=l(:label_project)%></th>
21 <th><%=l(:field_description)%></th>
21 <th><%=l(:field_description)%></th>
22 <th><%=l(:field_is_public)%></th>
22 <th><%=l(:field_is_public)%></th>
23 <th><%=l(:field_created_on)%></th>
23 <th><%=l(:field_created_on)%></th>
24 <th></th>
24 <th></th>
25 </tr></thead>
25 </tr></thead>
26 <tbody>
26 <tbody>
27 <% for project in @projects %>
27 <% for project in @projects %>
28 <tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %>">
28 <tr class="<%= cycle("odd", "even") %> <%= css_project_classes(project) %>">
29 <td class="name" style="padding-left: <%= project.level %>em;"><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %></td>
29 <td class="name" style="padding-left: <%= project.level %>em;"><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %></td>
30 <td><%= textilizable project.short_description, :project => project %></td>
30 <td><%= textilizable project.short_description, :project => project %></td>
31 <td align="center"><%= image_tag 'true.png' if project.is_public? %></td>
31 <td align="center"><%= image_tag 'true.png' if project.is_public? %></td>
32 <td align="center"><%= format_date(project.created_on) %></td>
32 <td align="center"><%= format_date(project.created_on) %></td>
33 <td class="buttons">
33 <td class="buttons">
34 <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %>
34 <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %>
35 <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project }, :method => :post, :class => 'icon icon-unlock') if !project.active? && (project.parent.nil? || project.parent.active?) %>
35 <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if !project.active? && (project.parent.nil? || project.parent.active?) %>
36 <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
36 <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
37 <%= link_to(l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => 'icon icon-del') %>
37 <%= link_to(l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => 'icon icon-del') %>
38 </td>
38 </td>
39 </tr>
39 </tr>
40 <% end %>
40 <% end %>
41 </tbody>
41 </tbody>
42 </table>
42 </table>
43
43
44 <% html_title(l(:label_project_plural)) -%>
44 <% html_title(l(:label_project_plural)) -%>
General Comments 0
You need to be logged in to leave comments. Login now