Project

General

Profile

Patch #28510 » 0001-Show-assignee-avatar-in-Roadmap-and-Version.patch

Marius BĂLTEANU, 2019-05-21 18:14

View differences:

app/helpers/avatars_helper.rb
return '' unless user
options.merge!(:title => l(:field_assigned_to) + ": " + user.name)
avatar(user, options).html_safe
avatar(user, options)
end
def author_avatar(user, options={})
return '' unless user
options.merge!(:title => l(:field_author) + ": " + user.name)
avatar(user, options).html_safe
avatar(user, options)
end
# Returns the avatar image tag for the given +user+ if avatars are enabled
app/views/versions/index.html.erb
<table class="list related-issues">
<caption><%= l(:label_related_issues) %></caption>
<% issues.each do |issue| -%>
<tr class="hascontextmenu">
<tr class="issue hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td class="assigned_to"><%= assignee_avatar(issue.assigned_to, :size => 16) %></td>
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr>
app/views/versions/show.html.erb
<%- @issues.each do |issue| -%>
<tr class="issue hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td class="assigned_to"><%= assignee_avatar(issue.assigned_to, :size => 16) %></td>
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr>
public/stylesheets/application.css
div#roadmap .related-issues { margin-bottom: 1em; }
div#roadmap .related-issues td.checkbox { display: none; }
div#roadmap .related-issues td.assigned_to { width:1px; white-space:nowrap; padding: 0; }
div#roadmap .related-issues td.assigned_to img { padding-left: 4px; padding-right: 4px;}
div#roadmap .wiki h1:first-child { display: none; }
div#roadmap .wiki h1 { font-size: 120%; }
div#roadmap .wiki h2 { font-size: 110%; }
test/functional/versions_controller_test.rb
end
end
def test_index_should_show_issue_assignee
with_settings :gravatar_enabled => '1' do
Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => User.find_by_login('jsmith'))
Issue.generate!(:project_id => 3, :fixed_version_id => 4)
get :index, :params => {:project_id => 3}
assert_response :success
assert_select 'table.related-issues' do
assert_select 'tr.issue', :count => 2 do
assert_select 'img.gravatar[title=?]', 'Assignee: John Smith', :count => 1
end
end
end
end
def test_show
get :show, :params => {:id => 2}
assert_response :success
assert_select 'h2', :text => /1.0/
assert_select 'span[class=?]', 'badge badge-status-locked', :text => 'locked'
# no issue avatar when gravatar is disabled
assert_select 'img.gravatar', :count => 0
end
def test_show_should_show_issue_assignee
with_settings :gravatar_enabled => '1' do
get :show, :params => {:id => 2}
assert_response :success
assert_select 'table.related-issues' do
assert_select 'tr.issue td.assigned_to', :count => 2 do
assert_select 'img.gravatar[title=?]', 'Assignee: Dave Lopper', :count => 1
end
end
end
end
def test_show_issue_calculations_should_take_into_account_only_visible_issues
(12-12/12)