Feature #3058 » 0003-move-changesets-to-its-own-tab.patch
| app/helpers/issues_helper.rb | ||
|---|---|---|
| 550 | 550 |       journals_without_notes = @journals.select{|value| value.notes.blank?} | 
| 551 | 551 |       journals_with_notes = @journals.reject{|value| value.notes.blank?} | 
| 552 | 552 | |
| 553 |       tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'history', :locals => {:issue => @issue, :journals => @journals}} | |
| 553 |       tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}} | |
| 554 | 554 |       tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any? | 
| 555 | 555 |       tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any? | 
| 556 | 556 | end | 
| 557 |     tabs << {:name => 'changesets', :label => :label_associated_revisions, :partial => 'issues/tabs/changesets', :locals => {:changesets => @changesets}} if @changesets.present? | |
| 557 | 558 | tabs | 
| 558 | 559 | end | 
| 559 | 560 | end | 
| app/views/issues/_history.html.erb | ||
|---|---|---|
| 1 | <% | |
| 2 | issue = tab[:locals][:issue] | |
| 3 | journals = tab[:locals][:journals] | |
| 4 | %> | |
| 5 | ||
| 6 | <% reply_links = issue.notes_addable? -%> | |
| 7 | <% for journal in journals %> | |
| 8 | <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>"> | |
| 9 | <div id="note-<%= journal.indice %>"> | |
| 10 | <div class="contextual"> | |
| 11 | <span class="journal-actions"><%= render_journal_actions(issue, journal, :reply_links => reply_links) %></span> | |
| 12 | <a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a> | |
| 13 | </div> | |
| 14 | <h4> | |
| 15 | <%= avatar(journal.user, :size => "24") %> | |
| 16 | <%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %> | |
| 17 | <%= render_private_notes_indicator(journal) %> | |
| 18 | </h4> | |
| 19 | ||
| 20 | <% if journal.details.any? %> | |
| 21 | <ul class="details"> | |
| 22 | <% details_to_strings(journal.visible_details).each do |string| %> | |
| 23 | <li><%= string %></li> | |
| 24 | <% end %> | |
| 25 | </ul> | |
| 26 | <% if Setting.thumbnails_enabled? && (thumbnail_attachments = journal_thumbnail_attachments(journal)).any? %> | |
| 27 | <div class="thumbnails"> | |
| 28 | <% thumbnail_attachments.each do |attachment| %> | |
| 29 | <div><%= thumbnail_tag(attachment) %></div> | |
| 30 | <% end %> | |
| 31 | </div> | |
| 32 | <% end %> | |
| 33 | <% end %> | |
| 34 | <%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> | |
| 35 | </div> | |
| 36 | </div> | |
| 37 |   <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> | |
| 38 | <% end %> | |
| 39 | ||
| 40 | <% heads_for_wiki_formatter if User.current.allowed_to?(:edit_issue_notes, issue.project) || User.current.allowed_to?(:edit_own_issue_notes, issue.project) %> | |
| app/views/issues/show.html.erb | ||
|---|---|---|
| 120 | 120 | |
| 121 | 121 | </div> | 
| 122 | 122 | |
| 123 | <% if @changesets.present? %> | |
| 124 | <div id="issue-changesets"> | |
| 125 | <h3><%=l(:label_associated_revisions)%></h3> | |
| 126 | <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> | |
| 127 | </div> | |
| 128 | <% end %> | |
| 129 | ||
| 130 | 123 | <%= render partial: 'action_menu_edit' if User.current.wants_comments_in_reverse_order? %> | 
| 131 | 124 | |
| 132 | 125 | <div id="history"> | 
| 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 %> | |
| app/views/issues/tabs/_history.html.erb | ||
|---|---|---|
| 1 | <% | |
| 2 | issue = tab[:locals][:issue] | |
| 3 | journals = tab[:locals][:journals] | |
| 4 | %> | |
| 5 | ||
| 6 | <% reply_links = issue.notes_addable? -%> | |
| 7 | <% for journal in journals %> | |
| 8 | <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>"> | |
| 9 | <div id="note-<%= journal.indice %>"> | |
| 10 | <div class="contextual"> | |
| 11 | <span class="journal-actions"><%= render_journal_actions(issue, journal, :reply_links => reply_links) %></span> | |
| 12 | <a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a> | |
| 13 | </div> | |
| 14 | <h4> | |
| 15 | <%= avatar(journal.user, :size => "24") %> | |
| 16 | <%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %> | |
| 17 | <%= render_private_notes_indicator(journal) %> | |
| 18 | </h4> | |
| 19 | ||
| 20 | <% if journal.details.any? %> | |
| 21 | <ul class="details"> | |
| 22 | <% details_to_strings(journal.visible_details).each do |string| %> | |
| 23 | <li><%= string %></li> | |
| 24 | <% end %> | |
| 25 | </ul> | |
| 26 | <% if Setting.thumbnails_enabled? && (thumbnail_attachments = journal_thumbnail_attachments(journal)).any? %> | |
| 27 | <div class="thumbnails"> | |
| 28 | <% thumbnail_attachments.each do |attachment| %> | |
| 29 | <div><%= thumbnail_tag(attachment) %></div> | |
| 30 | <% end %> | |
| 31 | </div> | |
| 32 | <% end %> | |
| 33 | <% end %> | |
| 34 | <%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> | |
| 35 | </div> | |
| 36 | </div> | |
| 37 |   <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> | |
| 38 | <% end %> | |
| 39 | ||
| 40 | <% heads_for_wiki_formatter if User.current.allowed_to?(:edit_issue_notes, issue.project) || User.current.allowed_to?(:edit_own_issue_notes, issue.project) %> | |
| test/functional/issues_controller_test.rb | ||
|---|---|---|
| 2478 | 2478 | end | 
| 2479 | 2479 | end | 
| 2480 | 2480 | |
| 2481 | def test_show_display_changesets_tab_for_issue_with_changesets | |
| 2482 | project = Project.find(2) | |
| 2483 | issue = Issue.find(3) | |
| 2484 | issue.changeset_ids = [102] | |
| 2485 | issue.save! | |
| 2486 | ||
| 2487 | @request.session[:user_id] = 2 | |
| 2488 |     get :show, :params => {:id => 3} | |
| 2489 | ||
| 2490 | assert_select '#history' do | |
| 2491 | assert_select 'div.tabs ul a', 1 | |
| 2492 | assert_select 'div.tabs a[id=?]', 'tab-changesets', :text => 'Associated revisions' | |
| 2493 | end | |
| 2494 | end | |
| 2495 | ||
| 2481 | 2496 | def test_get_new | 
| 2482 | 2497 | @request.session[:user_id] = 2 | 
| 2483 | 2498 |     get :new, :params => { |