0001-Show-assignee-avatar-in-Roadmap-and-Version.patch

Marius BALTEANU, 2019-05-21 18:14

Download (5.04 KB)

View differences:

app/helpers/avatars_helper.rb
24 24
    return '' unless user
25 25

  
26 26
    options.merge!(:title => l(:field_assigned_to) + ": " + user.name)
27
    avatar(user, options).html_safe
27
    avatar(user, options)
28 28
  end
29 29

  
30 30
  def author_avatar(user, options={})
31 31
    return '' unless user
32 32

  
33 33
    options.merge!(:title => l(:field_author) + ": " + user.name)
34
    avatar(user, options).html_safe
34
    avatar(user, options)
35 35
  end
36 36

  
37 37
  # Returns the avatar image tag for the given +user+ if avatars are enabled
app/views/versions/index.html.erb
28 28
        <table class="list related-issues">
29 29
        <caption><%= l(:label_related_issues) %></caption>
30 30
        <% issues.each do |issue| -%>
31
          <tr class="hascontextmenu">
31
          <tr class="issue hascontextmenu">
32 32
            <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
33
            <td class="assigned_to"><%= assignee_avatar(issue.assigned_to, :size => 16) %></td>
33 34
            <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
34 35
            <td class="buttons"><%= link_to_context_menu %></td>
35 36
          </tr>
app/views/versions/show.html.erb
44 44
  <%- @issues.each do |issue| -%>
45 45
    <tr class="issue hascontextmenu">
46 46
      <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
47
      <td class="assigned_to"><%= assignee_avatar(issue.assigned_to, :size => 16) %></td>
47 48
      <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
48 49
      <td class="buttons"><%= link_to_context_menu %></td>
49 50
    </tr>
public/stylesheets/application.css
582 582

  
583 583
div#roadmap .related-issues { margin-bottom: 1em; }
584 584
div#roadmap .related-issues td.checkbox { display: none; }
585
div#roadmap .related-issues td.assigned_to { width:1px; white-space:nowrap; padding: 0; }
586
div#roadmap .related-issues td.assigned_to img { padding-left: 4px; padding-right: 4px;}
585 587
div#roadmap .wiki h1:first-child { display: none; }
586 588
div#roadmap .wiki h1 { font-size: 120%; }
587 589
div#roadmap .wiki h2 { font-size: 110%; }
test/functional/versions_controller_test.rb
98 98
    end
99 99
  end
100 100

  
101
  def test_index_should_show_issue_assignee
102
    with_settings :gravatar_enabled => '1' do
103
      Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => User.find_by_login('jsmith'))
104
      Issue.generate!(:project_id => 3, :fixed_version_id => 4)
105

  
106
      get :index, :params => {:project_id => 3}
107
      assert_response :success
108

  
109
      assert_select 'table.related-issues' do
110
        assert_select 'tr.issue', :count => 2 do
111
          assert_select 'img.gravatar[title=?]', 'Assignee: John Smith', :count => 1
112
        end
113
      end
114
    end
115
  end
116

  
101 117
  def test_show
102 118
    get :show, :params => {:id => 2}
103 119
    assert_response :success
104 120

  
105 121
    assert_select 'h2', :text => /1.0/
106 122
    assert_select 'span[class=?]', 'badge badge-status-locked', :text => 'locked'
123

  
124
    # no issue avatar when gravatar is disabled
125
    assert_select 'img.gravatar', :count => 0
126
  end
127

  
128
  def test_show_should_show_issue_assignee
129
    with_settings :gravatar_enabled => '1' do
130
      get :show, :params => {:id => 2}
131
      assert_response :success
132

  
133
      assert_select 'table.related-issues' do
134
        assert_select 'tr.issue td.assigned_to', :count => 2 do
135
          assert_select 'img.gravatar[title=?]', 'Assignee: Dave Lopper', :count => 1
136
        end
137
      end
138
    end
107 139
  end
108 140

  
109 141
  def test_show_issue_calculations_should_take_into_account_only_visible_issues
110
-