Patch #15616 » delete-project.diff
app/controllers/projects_controller.rb | ||
---|---|---|
21 | 21 |
menu_item :settings, :only => :settings |
22 | 22 | |
23 | 23 |
before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] |
24 |
before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
|
|
24 |
before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive] |
|
25 | 25 |
before_filter :authorize_global, :only => [:new, :create] |
26 |
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
|
|
26 |
before_filter :require_admin, :only => [ :copy, :archive, :unarchive ] |
|
27 | 27 |
accept_rss_auth :index |
28 | 28 |
accept_api_auth :index, :show, :create, :update, :destroy |
29 | 29 | |
... | ... | |
232 | 232 |
# Delete @project |
233 | 233 |
def destroy |
234 | 234 |
@project_to_destroy = @project |
235 |
if request.referer.include?(admin_projects_path) |
|
236 |
@destroy_redirect = admin_projects_path |
|
237 |
else |
|
238 |
@destroy_redirect = home_path |
|
239 |
p = @project |
|
240 |
while p.parent |
|
241 |
if User.current.allowed_to?(:view_project, p.parent) |
|
242 |
@destroy_redirect = project_path(p.parent) |
|
243 |
break |
|
244 |
end |
|
245 |
p = p.parent |
|
246 |
end |
|
247 |
end |
|
235 | 248 |
if api_request? || params[:confirm] |
236 | 249 |
@project_to_destroy.destroy |
237 | 250 |
respond_to do |format| |
238 |
format.html { redirect_to admin_projects_path }
|
|
251 |
format.html { redirect_to @destroy_redirect }
|
|
239 | 252 |
format.api { render_api_ok } |
240 | 253 |
end |
241 | 254 |
end |
app/views/projects/destroy.html.erb | ||
---|---|---|
13 | 13 |
<%= form_tag(project_path(@project_to_destroy), :method => :delete) do %> |
14 | 14 |
<label><%= check_box_tag 'confirm', 1 %> <%= l(:general_text_Yes) %></label> |
15 | 15 |
<%= submit_tag l(:button_delete) %> |
16 |
<%= link_to l(:button_cancel), :controller => 'admin', :action => 'projects' %>
|
|
16 |
<%= link_to l(:button_cancel), :back %>
|
|
17 | 17 |
<% end %> |
18 | 18 |
</p> |
19 | 19 |
</div> |
app/views/projects/show.html.erb | ||
---|---|---|
9 | 9 |
<%= link_to l(:button_reopen), reopen_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-unlock' %> |
10 | 10 |
<% end %> |
11 | 11 |
<% end %> |
12 |
<% if User.current.allowed_to?(:delete_project, @project) %> |
|
13 |
<%= link_to(l(:button_delete), project_path(@project), :method => :delete, :class => 'icon icon-del') %> |
|
14 |
<% end %> |
|
12 | 15 |
</div> |
13 | 16 | |
14 | 17 |
<h2><%=l(:label_overview)%></h2> |
config/locales/en-GB.yml | ||
---|---|---|
1035 | 1035 |
setting_session_timeout: Session inactivity timeout |
1036 | 1036 |
label_session_expiration: Session expiration |
1037 | 1037 |
permission_close_project: Close / reopen the project |
1038 |
permission_delete_project: Delete the project |
|
1038 | 1039 |
label_show_closed_projects: View closed projects |
1039 | 1040 |
button_close: Close |
1040 | 1041 |
button_reopen: Reopen |
config/locales/en.yml | ||
---|---|---|
413 | 413 |
permission_add_subprojects: Create subprojects |
414 | 414 |
permission_edit_project: Edit project |
415 | 415 |
permission_close_project: Close / reopen the project |
416 |
permission_delete_project: Delete the project |
|
416 | 417 |
permission_select_project_modules: Select project modules |
417 | 418 |
permission_manage_members: Manage members |
418 | 419 |
permission_manage_project_activities: Manage project activities |
config/locales/fr.yml | ||
---|---|---|
410 | 410 |
permission_add_subprojects: Créer des sous-projets |
411 | 411 |
permission_edit_project: Modifier le projet |
412 | 412 |
permission_close_project: Fermer / réouvrir le projet |
413 |
permission_delete_project: Détruire le projet |
|
413 | 414 |
permission_select_project_modules: Choisir les modules |
414 | 415 |
permission_manage_members: Gérer les membres |
415 | 416 |
permission_manage_versions: Gérer les versions |
lib/redmine.rb | ||
---|---|---|
92 | 92 |
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
93 | 93 |
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
94 | 94 |
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true |
95 |
map.permission :delete_project, {:projects => [:destroy]}, :require => :member, :read => true |
|
95 | 96 |
map.permission :select_project_modules, {:projects => :modules}, :require => :member |
96 | 97 |
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member |
97 | 98 |
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |