- <% if User.current.allowed_to?(:manage_versions, version.project) %>
-
- <%= link_to l(:button_edit), edit_version_path(version), :title => l(:button_edit), :class => 'icon-only icon-edit' %>
-
- <% end %>
+
+ <%= link_to(l(:button_edit), edit_version_path(version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, version.project) %>
+ <%= link_to_new_issue(version, version.project) %>
+
<%= link_to_version version, :name => version_anchor(version) %>
<%= l("version_status_#{version.status}") %>
diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb
index 7b2249dfe..42a8e1963 100644
--- a/test/functional/versions_controller_test.rb
+++ b/test/functional/versions_controller_test.rb
@@ -114,6 +114,25 @@ class VersionsControllerTest < Redmine::ControllerTest
end
end
+ def test_index_should_show_contextual
+ @request.session[:user_id] = 1
+ get :index, :params => {:project_id => 1, :completed => 1}
+ assert_response :success
+
+ assert_select 'article.version-open .contextual' do
+ assert_select 'a.icon.icon-add', :text => 'New issue'
+ assert_select 'a.icon.icon-edit'
+ end
+ assert_select 'article.version-locked .contextual' do
+ assert_select 'a.icon.icon-add', :text => 'New issue', :count => 0
+ assert_select 'a.icon.icon-edit'
+ end
+ assert_select 'article.version-closed .contextual' do
+ assert_select 'a.icon.icon-add', :text => 'New issue', :count => 0
+ assert_select 'a.icon.icon-edit'
+ end
+ end
+
def test_show
with_settings :gravatar_enabled => '0' do
get :show, :params => {:id => 2}