Feature #36370 » feature-36370.patch
| app/views/projects/show.html.erb | ||
|---|---|---|
|
<% 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' %>
|
||
| ... | ... | |
|
<%= 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 %>
|
||
| test/functional/projects_controller_test.rb | ||
|---|---|---|
|
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})
|
||