summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 07:08:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 07:08:27 +0000
commitbe660e11cc2bf68b94451f77e612e0ee0cd666cc (patch)
tree130496134ee7db4212b9a19ad913ceab00d00f0d
parentb132b8e914c5612218bb161af19aa916b18deab3 (diff)
downloadredmine-be660e11cc2bf68b94451f77e612e0ee0cd666cc.tar.gz
redmine-be660e11cc2bf68b94451f77e612e0ee0cd666cc.zip
Move changesets to its own tab (#3058).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18273 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/issues_helper.rb3
-rw-r--r--app/views/issues/show.html.erb9
-rw-r--r--app/views/issues/tabs/_changesets.html.erb24
-rw-r--r--app/views/issues/tabs/_history.html.erb (renamed from app/views/issues/_history.html.erb)0
-rw-r--r--test/functional/issues_controller_test.rb15
5 files changed, 41 insertions, 10 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index ccf89e8fa..16ac24602 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -553,10 +553,11 @@ module IssuesHelper
journals_without_notes = @journals.select{|value| value.notes.blank?}
journals_with_notes = @journals.reject{|value| value.notes.blank?}
- tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'history', :locals => {:issue => @issue, :journals => @journals}}
+ tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any?
tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any?
end
+ tabs << {:name => 'changesets', :label => :label_associated_revisions, :partial => 'issues/tabs/changesets', :locals => {:changesets => @changesets}} if @changesets.present?
tabs
end
end
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index 3a17cc49a..d50f5e226 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -122,15 +122,6 @@ end %>
<%= render partial: 'action_menu_edit' if User.current.wants_comments_in_reverse_order? %>
-<% if @changesets.present? %>
-<div id="issue-changesets">
-<h3><%=l(:label_associated_revisions)%></h3>
-<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %>
-</div>
-<% end %>
-
-<%= render partial: 'action_menu_edit' if User.current.wants_comments_in_reverse_order? %>
-
<div id="history">
<h3><%=l(:label_history)%></h3>
<%= render_tabs issue_history_tabs, params[:tab] ? params[:tab] : 'notes' %>
diff --git a/app/views/issues/tabs/_changesets.html.erb b/app/views/issues/tabs/_changesets.html.erb
new file mode 100644
index 000000000..7e2b01a3d
--- /dev/null
+++ b/app/views/issues/tabs/_changesets.html.erb
@@ -0,0 +1,24 @@
+<% tab[:locals][:changesets].each do |changeset| %>
+ <div id="changeset-<%= changeset.id %>" class="changeset journal">
+ <h4>
+ <%= avatar(changeset.user, :size => "24") %>
+ <%= authoring changeset.committed_on, changeset.author, :label => :label_added_time_by %>
+ </h4>
+ <p><%= link_to_revision(changeset, changeset.repository,
+ :text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
+ <% if changeset.filechanges.any? && User.current.allowed_to?(:browse_repository, changeset.project) %>
+ (<%= link_to(l(:label_diff),
+ :controller => 'repositories',
+ :action => 'diff',
+ :id => changeset.project,
+ :repository_id => changeset.repository.identifier_param,
+ :path => "",
+ :rev => changeset.identifier) %>)
+ <% end %></p>
+
+ <div class="wiki changeset-comments">
+ <%= format_changeset_comments changeset %>
+ </div>
+ </div>
+ <%= call_hook(:view_issues_history_changeset_bottom, { :changeset => changeset }) %>
+<% end %>
diff --git a/app/views/issues/_history.html.erb b/app/views/issues/tabs/_history.html.erb
index 6571bea45..6571bea45 100644
--- a/app/views/issues/_history.html.erb
+++ b/app/views/issues/tabs/_history.html.erb
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 54515e10c..517d7ce01 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2535,6 +2535,21 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
+ def test_show_display_changesets_tab_for_issue_with_changesets
+ project = Project.find(2)
+ issue = Issue.find(3)
+ issue.changeset_ids = [102]
+ issue.save!
+
+ @request.session[:user_id] = 2
+ get :show, :params => {:id => 3}
+
+ assert_select '#history' do
+ assert_select 'div.tabs ul a', 1
+ assert_select 'div.tabs a[id=?]', 'tab-changesets', :text => 'Associated revisions'
+ end
+ end
+
def test_get_new
@request.session[:user_id] = 2
get :new, :params => {