From ffd2707b1535400c3407569d0585d2f715b19242 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sun, 2 Dec 2018 20:53:18 +0000 Subject: [PATCH 1/2] Show assignee avatar in Roadmap and Version --- app/helpers/avatars_helper.rb | 4 ++-- app/views/versions/index.html.erb | 3 ++- app/views/versions/show.html.erb | 1 + public/stylesheets/application.css | 2 ++ test/functional/versions_controller_test.rb | 32 +++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 71898a4..34c15c9 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -24,14 +24,14 @@ module AvatarsHelper 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 diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index 429bc5b..ad5d5f4 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -28,8 +28,9 @@ <% issues.each do |issue| -%> - + + diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index ad3ed25..dc43d40 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -44,6 +44,7 @@ <%- @issues.each do |issue| -%> + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 03fd814..15ddc4c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -582,6 +582,8 @@ div#search-results-counts li { list-style-type:none; float: left; margin-left: 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%; } diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index b827a1f..7a9fe7f 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -98,12 +98,44 @@ class VersionsControllerTest < Redmine::ControllerTest 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 -- 2.1.4