03_move-changesets-to-its-own-tab_r16963.patch

Marius BALTEANU, 2017-09-10 14:18

Download (4.13 KB)

View differences:

app/helpers/issues_helper.rb
548 548
      journals_without_notes = @journals.select{|value| value.notes.blank?}
549 549
      journals_with_notes = @journals.reject{|value| value.notes.blank?}
550 550

  
551
      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'history', :locals => {:issue => @issue, :journals => @journals}}
551
      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
552 552
      tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any?
553 553
      tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any?
554 554
    end
555
    tabs << {:name => 'changesets', :label => :label_associated_revisions, :partial => 'issues/tabs/changesets', :locals => {:changesets => @changesets}} if @changesets.present?
555 556
    tabs
556 557
  end
557 558
end
app/views/issues/show.html.erb
118 118

  
119 119
</div>
120 120

  
121
<% if @changesets.present? %>
122
<div id="issue-changesets">
123
<h3><%=l(:label_associated_revisions)%></h3>
124
<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %>
125
</div>
126
<% end %>
127

  
128 121
<div id="history">
129 122
<h3><%=l(:label_history)%></h3>
130 123
<%= render_tabs issue_history_tabs, params[:tab] ? params[:tab] : 'notes' %>
app/views/issues/tabs/_changesets.html.erb
1
<% tab[:locals][:changesets].each do |changeset| %>
2
  <div id="changeset-<%= changeset.id %>" class="changeset journal">
3
    <h4>
4
      <%= avatar(changeset.user, :size => "24") %>
5
      <%= authoring changeset.committed_on, changeset.author, :label => :label_added_time_by %>
6
    </h4>
7
    <p><%= link_to_revision(changeset, changeset.repository,
8
                        :text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
9
    <% if changeset.filechanges.any? && User.current.allowed_to?(:browse_repository, changeset.project) %>
10
    (<%= link_to(l(:label_diff),
11
           :controller => 'repositories',
12
           :action => 'diff',
13
           :id     => changeset.project,
14
           :repository_id => changeset.repository.identifier_param,
15
           :path   => "",
16
           :rev    => changeset.identifier) %>)
17
    <% end %></p>
18

  
19
    <div class="wiki changeset-comments">
20
      <%= format_changeset_comments changeset %>
21
    </div>
22
  </div>
23
  <%= call_hook(:view_issues_history_changeset_bottom, { :changeset => changeset }) %>
24
<% end %>
test/functional/issues_controller_test.rb
2334 2334
    end
2335 2335
  end
2336 2336

  
2337
  def test_show_display_changesets_tab_for_issue_with_changesets
2338
    project = Project.find(2)
2339
    issue = Issue.find(3)
2340
    issue.changeset_ids = [102]
2341
    issue.save!
2342

  
2343
    @request.session[:user_id] = 2
2344
    get :show, :params => {:id => 3}
2345

  
2346
    assert_select '#history' do
2347
      assert_select 'div.tabs ul a', 1
2348
      assert_select 'div.tabs a[id=?]', 'tab-changesets', :text => 'Associated revisions'
2349
    end
2350
  end
2351

  
2337 2352
  def test_get_new
2338 2353
    @request.session[:user_id] = 2
2339 2354
    get :new, :params => {