Ver código fonte

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
tags/4.1.0
Jean-Philippe Lang 5 anos atrás
pai
commit
be660e11cc

+ 2
- 1
app/helpers/issues_helper.rb Ver arquivo

@@ -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

+ 0
- 9
app/views/issues/show.html.erb Ver arquivo

@@ -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' %>

+ 24
- 0
app/views/issues/tabs/_changesets.html.erb Ver arquivo

@@ -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 %>

app/views/issues/_history.html.erb → app/views/issues/tabs/_history.html.erb Ver arquivo


+ 15
- 0
test/functional/issues_controller_test.rb Ver arquivo

@@ -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 => {

Carregando…
Cancelar
Salvar