Patch #28510 » 28510.patch
| app/helpers/versions_helper.rb | ||
|---|---|---|
| 73 | 73 |
def status_by_options_for_select(value) |
| 74 | 74 |
options_for_select(STATUS_BY_CRITERIAS.collect {|criteria| [l("field_#{criteria}".to_sym), criteria]}, value)
|
| 75 | 75 |
end |
| 76 | ||
| 77 |
def render_issue_subject_with_avatar(issue, project=nil) |
|
| 78 |
s = link_to_issue(issue, :project => (project != issue.project)) |
|
| 79 |
if Setting.gravatar_enabled? && issue.assigned_to |
|
| 80 |
content_tag(:span, avatar(issue.assigned_to, |
|
| 81 |
:size => "16", |
|
| 82 |
:class => "gravatar icon-gravatar", |
|
| 83 |
:title => l(:field_assigned_to) + ": " + issue.assigned_to.name).html_safe + s) |
|
| 84 |
else |
|
| 85 |
content_tag(:span, s, :class => 'icon icon-issue') |
|
| 86 |
end |
|
| 87 |
end |
|
| 88 | ||
| 76 | 89 |
end |
| app/views/versions/index.html.erb | ||
|---|---|---|
| 30 | 30 |
<% issues.each do |issue| -%> |
| 31 | 31 |
<tr class="hascontextmenu"> |
| 32 | 32 |
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td> |
| 33 |
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
|
| 33 |
<td class="subject"><%= render_issue_subject_with_avatar(issue, @project) %></td>
|
|
| 34 | 34 |
<td class="buttons"><%= link_to_context_menu %></td> |
| 35 | 35 |
</tr> |
| 36 | 36 |
<% end -%> |
| 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="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
|
| 47 |
<td class="subject"><%= render_issue_subject_with_avatar(issue, @project) %></td>
|
|
| 48 | 48 |
<td class="buttons"><%= link_to_context_menu %></td> |
| 49 | 49 |
</tr> |
| 50 | 50 |
<% end %> |
| test/functional/versions_controller_test.rb | ||
|---|---|---|
| 98 | 98 |
end |
| 99 | 99 |
end |
| 100 | 100 | |
| 101 |
def test_index_with_avaters |
|
| 102 |
version = Version.create!(:project_id => 1, :name => "version") |
|
| 103 |
assigned_issue = Issue.generate!(:project_id => 1, :fixed_version_id => version.id, :assigned_to => User.find_by_login('jsmith'))
|
|
| 104 |
not_assigned_issue = Issue.generate!(:project_id => 1, :fixed_version_id => version.id, :assigned_to => nil) |
|
| 105 |
with_settings :gravatar_enabled => '1' do |
|
| 106 |
get :index, :params => {:project_id => 1}
|
|
| 107 |
assert_response :success |
|
| 108 |
# Issue with assignee should contain user's avatar |
|
| 109 |
assert_select 'td.subject span img[class=?][title=?], a[href=?]', 'gravatar icon-gravatar', 'Assignee: John Smith', issue_path(assigned_issue) |
|
| 110 |
assert_select 'td.subject span[class=?] a[href=?]', 'icon icon-issue', issue_path(not_assigned_issue) |
|
| 111 |
end |
|
| 112 |
end |
|
| 113 | ||
| 101 | 114 |
def test_show |
| 102 | 115 |
get :show, :params => {:id => 2}
|
| 103 | 116 |
assert_response :success |
| test/helpers/version_helper_test.rb | ||
|---|---|---|
| 20 | 20 |
require File.expand_path('../../test_helper', __FILE__)
|
| 21 | 21 | |
| 22 | 22 |
class VersionsHelperTest < Redmine::HelperTest |
| 23 |
include ERB::Util |
|
| 23 | 24 |
include Rails.application.routes.url_helpers |
| 24 | 25 | |
| 25 | 26 |
fixtures :projects, :versions |
| ... | ... | |
| 53 | 54 |
version.project = Project.find(5) |
| 54 | 55 |
assert_match /^\/issues\?/, version_filtered_issues_path(version) |
| 55 | 56 |
end |
| 57 | ||
| 58 |
def test_link_to_issue_with_avater |
|
| 59 |
with_settings :gravatar_enabled => '1' do |
|
| 60 |
issue = Issue.generate!(:subject => "Assigned Issue", :assigned_to => User.find_by_login('jsmith'))
|
|
| 61 |
avater = avatar(issue.assigned_to, |
|
| 62 |
:size => "16", |
|
| 63 |
:class => "gravatar icon-gravatar", |
|
| 64 |
:title => l(:field_assigned_to) + ": " + issue.assigned_to.name) |
|
| 65 |
str = render_issue_subject_with_avatar(issue) |
|
| 66 |
assert_include avater, str |
|
| 67 |
assert_not_include 'class="icon icon-issue"', str |
|
| 68 | ||
| 69 |
issue.update!(:assigned_to => nil) |
|
| 70 |
str = render_issue_subject_with_avatar(issue) |
|
| 71 |
assert_include 'class="icon icon-issue"', str |
|
| 72 |
assert_not_include avater, str |
|
| 73 |
end |
|
| 74 |
end |
|
| 56 | 75 |
end |