diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 18b15d840b..76903d748b 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -5,6 +5,9 @@ <% if User.current.allowed_to?(:add_subprojects, @project) %> <%= link_to l(:label_subproject_new), new_project_path(:parent_id => @project), :class => 'icon icon-add' %> <% end %> + <% if User.current.admin? %> + <%= link_to l(:button_copy), copy_project_path(@project), :class => 'icon icon-copy' %> + <% end %> <% if User.current.allowed_to?(:close_project, @project) %> <% if @project.active? %> <%= link_to l(:button_close), close_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock' %> @@ -12,6 +15,9 @@ <%= link_to l(:button_reopen), reopen_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-unlock' %> <% end %> <% end %> + <% if User.current.admin? %> + <%= link_to l(:button_archive), archive_project_path(@project), :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock' %> + <% end %> <% if @project.deletable? %> <%= link_to l(:button_delete), project_path(@project), :method => :delete, :class => 'icon icon-del' %> <% end %> diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 705c1a605c..840b016fe3 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -801,6 +801,30 @@ class ProjectsControllerTest < Redmine::ControllerTest end end + def test_show_should_show_actions + @request.session[:user_id] = 1 + get(:show, params: {id: 'ecookbook'}) + assert_select 'div.drdn-items' do + assert_select 'a.icon-add[href=?]', new_project_path(parent_id: 'ecookbook') + assert_select 'a.icon-copy[href=?]', copy_project_path('ecookbook') + assert_select 'a.icon-lock[href=?]', close_project_path('ecookbook') + assert_select 'a.icon-lock[href=?]', archive_project_path('ecookbook') + assert_select 'a.icon-del[href=?]', project_path('ecookbook') + assert_select 'a.icon-settings[href=?]', settings_project_path('ecookbook') + end + + @request.session[:user_id] = 2 + get(:show, params: {id: 'ecookbook'}) + assert_select 'div.drdn-items' do + assert_select 'a.icon-add[href=?]', new_project_path(parent_id: 'ecookbook'), count: 0 + assert_select 'a.icon-copy[href=?]', copy_project_path('ecookbook'), count: 0 + assert_select 'a.icon-lock[href=?]', close_project_path('ecookbook') + assert_select 'a.icon-lock[href=?]', archive_project_path('ecookbook'), count: 0 + assert_select 'a.icon-del[href=?]', project_path('ecookbook'), count: 0 + assert_select 'a.icon-settings[href=?]', settings_project_path('ecookbook') + end + end + def test_settings @request.session[:user_id] = 2 # manager get(:settings, :params => {:id => 1})