Patch #28510 » 28510.patch
| app/helpers/versions_helper.rb | ||
|---|---|---|
|
def status_by_options_for_select(value)
|
||
|
options_for_select(STATUS_BY_CRITERIAS.collect {|criteria| [l("field_#{criteria}".to_sym), criteria]}, value)
|
||
|
end
|
||
|
def render_issue_subject_with_avatar(issue, project=nil)
|
||
|
s = link_to_issue(issue, :project => (project != issue.project))
|
||
|
if Setting.gravatar_enabled? && issue.assigned_to
|
||
|
content_tag(:span, avatar(issue.assigned_to,
|
||
|
:size => "16",
|
||
|
:class => "gravatar icon-gravatar",
|
||
|
:title => l(:field_assigned_to) + ": " + issue.assigned_to.name).html_safe + s)
|
||
|
else
|
||
|
content_tag(:span, s, :class => 'icon icon-issue')
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| app/views/versions/index.html.erb | ||
|---|---|---|
|
<% issues.each do |issue| -%>
|
||
|
<tr class="hascontextmenu">
|
||
|
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
|
||
|
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
||
|
<td class="subject"><%= render_issue_subject_with_avatar(issue, @project) %></td>
|
||
|
<td class="buttons"><%= link_to_context_menu %></td>
|
||
|
</tr>
|
||
|
<% end -%>
|
||
| 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="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
|
||
|
<td class="subject"><%= render_issue_subject_with_avatar(issue, @project) %></td>
|
||
|
<td class="buttons"><%= link_to_context_menu %></td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
| test/functional/versions_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_index_with_avaters
|
||
|
version = Version.create!(:project_id => 1, :name => "version")
|
||
|
assigned_issue = Issue.generate!(:project_id => 1, :fixed_version_id => version.id, :assigned_to => User.find_by_login('jsmith'))
|
||
|
not_assigned_issue = Issue.generate!(:project_id => 1, :fixed_version_id => version.id, :assigned_to => nil)
|
||
|
with_settings :gravatar_enabled => '1' do
|
||
|
get :index, :params => {:project_id => 1}
|
||
|
assert_response :success
|
||
|
# Issue with assignee should contain user's avatar
|
||
|
assert_select 'td.subject span img[class=?][title=?], a[href=?]', 'gravatar icon-gravatar', 'Assignee: John Smith', issue_path(assigned_issue)
|
||
|
assert_select 'td.subject span[class=?] a[href=?]', 'icon icon-issue', issue_path(not_assigned_issue)
|
||
|
end
|
||
|
end
|
||
|
def test_show
|
||
|
get :show, :params => {:id => 2}
|
||
|
assert_response :success
|
||
| test/helpers/version_helper_test.rb | ||
|---|---|---|
|
require File.expand_path('../../test_helper', __FILE__)
|
||
|
class VersionsHelperTest < Redmine::HelperTest
|
||
|
include ERB::Util
|
||
|
include Rails.application.routes.url_helpers
|
||
|
fixtures :projects, :versions
|
||
| ... | ... | |
|
version.project = Project.find(5)
|
||
|
assert_match /^\/issues\?/, version_filtered_issues_path(version)
|
||
|
end
|
||
|
def test_link_to_issue_with_avater
|
||
|
with_settings :gravatar_enabled => '1' do
|
||
|
issue = Issue.generate!(:subject => "Assigned Issue", :assigned_to => User.find_by_login('jsmith'))
|
||
|
avater = avatar(issue.assigned_to,
|
||
|
:size => "16",
|
||
|
:class => "gravatar icon-gravatar",
|
||
|
:title => l(:field_assigned_to) + ": " + issue.assigned_to.name)
|
||
|
str = render_issue_subject_with_avatar(issue)
|
||
|
assert_include avater, str
|
||
|
assert_not_include 'class="icon icon-issue"', str
|
||
|
issue.update!(:assigned_to => nil)
|
||
|
str = render_issue_subject_with_avatar(issue)
|
||
|
assert_include 'class="icon icon-issue"', str
|
||
|
assert_not_include avater, str
|
||
|
end
|
||
|
end
|
||
|
end
|
||