feature-33730.patch

Mizuki ISHIKAWA, 2020-07-14 08:30

Download (2.16 KB)

View differences:

app/views/versions/index.html.erb
16 16
  <div id="roadmap">
17 17
  <% @versions.each do |version| %>
18 18
  <article class="version-article <%= version.css_classes %>">
19
    <% if User.current.allowed_to?(:manage_versions, version.project) %>
20
      <div class="contextual">
19
    <div class="contextual">
20
      <%= link_to_new_issue(version, version.project) %>
21
      <% if User.current.allowed_to?(:manage_versions, version.project) %>
21 22
        <%= link_to l(:button_edit), edit_version_path(version), :title => l(:button_edit), :class => 'icon-only icon-edit' %>
22
      </div>
23
    <% end %>
23
      <% end %>
24
    </div>
24 25
    <header>
25 26
      <h3 class="icon icon-package version inline-flex"><%= link_to_version version, :name => version_anchor(version) %></h3>
26 27
      <span class="badge badge-status-<%= version.status %>"><%= l("version_status_#{version.status}") %></span>
test/functional/versions_controller_test.rb
114 114
    end
115 115
  end
116 116

  
117
  def test_index_should_show_contextual
118
    @request.session[:user_id] = 1
119
    get :index, :params => {:project_id => 1, :completed => 1}
120
    assert_response :success
121

  
122
    assert_select 'article.version-open .contextual' do
123
      assert_select 'a.icon.icon-add', :text => 'New issue'
124
      assert_select 'a.icon-only.icon-edit'
125
    end
126
    assert_select 'article.version-locked .contextual' do
127
      assert_select 'a.icon.icon-add', :text => 'New issue', :count => 0
128
      assert_select 'a.icon-only.icon-edit'
129
    end
130
    assert_select 'article.version-closed .contextual' do
131
      assert_select 'a.icon.icon-add', :text => 'New issue', :count => 0
132
      assert_select 'a.icon-only.icon-edit'
133
    end
134
  end
135

  
117 136
  def test_show
118 137
    with_settings :gravatar_enabled => '0' do
119 138
      get :show, :params => {:id => 2}