Feature #33641 » 33641-v4.patch
app/helpers/application_helper.rb | ||
---|---|---|
671 | 671 |
end |
672 | 672 | |
673 | 673 |
def authoring(created, author, options={}) |
674 |
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe |
|
674 |
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :badge => options[:badge], :age => time_tag(created)).html_safe
|
|
675 | 675 |
end |
676 | 676 | |
677 | 677 |
def time_tag(time) |
app/helpers/journals_helper.rb | ||
---|---|---|
68 | 68 |
css_classes = journal.private_notes? ? 'badge badge-private private' : '' |
69 | 69 |
content_tag('span', content.html_safe, :id => "journal-#{journal.id}-private_notes", :class => css_classes) |
70 | 70 |
end |
71 | ||
72 |
def journal_user_badge(journal) |
|
73 |
return '' if journal.nil? |
|
74 | ||
75 |
issue = journal&.journalized |
|
76 |
if journal.user == issue&.author |
|
77 |
content_tag('span', l(:label_author), class: 'badge badge-user-author') |
|
78 |
else |
|
79 |
'' |
|
80 |
end |
|
81 |
end |
|
71 | 82 |
end |
app/helpers/messages_helper.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
module MessagesHelper |
21 |
def message_user_badge(message) |
|
22 |
return '' if message&.parent.nil? |
|
23 | ||
24 |
if message.parent.author == message.author |
|
25 |
content_tag('span', l(:label_author), class: 'badge badge-user-author') |
|
26 |
else |
|
27 |
'' |
|
28 |
end |
|
29 |
end |
|
21 | 30 |
end |
app/helpers/news_helper.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
module NewsHelper |
21 |
def news_comment_user_badge(comment) |
|
22 |
return '' if comment&.commented.nil? |
|
23 | ||
24 |
if comment.commented.author == comment.author |
|
25 |
content_tag('span', l(:label_author), class: 'badge badge-user-author') |
|
26 |
else |
|
27 |
'' |
|
28 |
end |
|
29 |
end |
|
21 | 30 |
end |
app/helpers/wiki_helper.rb | ||
---|---|---|
73 | 73 |
end |
74 | 74 | |
75 | 75 |
def wiki_content_update_info(content) |
76 |
l(:label_updated_time_by, :author => link_to_user(content.author), :age => time_tag(content.updated_on)).html_safe |
|
76 |
l(:label_updated_time_by, :author => link_to_user(content.author), :age => time_tag(content.updated_on), :badge => '').html_safe
|
|
77 | 77 |
end |
78 | 78 |
end |
app/views/issues/tabs/_history.html.erb | ||
---|---|---|
13 | 13 |
</div> |
14 | 14 |
<h4 class='note-header'> |
15 | 15 |
<%= avatar(journal.user) %> |
16 |
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %> |
|
16 |
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by, :badge => journal_user_badge(journal) %>
|
|
17 | 17 |
<%= render_private_notes_indicator(journal) %> |
18 | 18 |
</h4> |
19 | 19 |
app/views/messages/show.html.erb | ||
---|---|---|
69 | 69 |
<%= avatar(message.author) %> |
70 | 70 |
<%= link_to message.subject, { :controller => 'messages', :action => 'show', :board_id => @board, :id => @topic, :r => message, :anchor => "message-#{message.id}" } %> |
71 | 71 |
- |
72 |
<%= authoring message.created_on, message.author %> |
|
72 |
<%= authoring message.created_on, message.author, :badge => message_user_badge(message) %>
|
|
73 | 73 |
</h4> |
74 | 74 |
<div class="wiki"><%= textilizable message, :content, :attachments => message.attachments %></div> |
75 | 75 |
<%= link_to_attachments message, :author => false, :thumbnails => true %> |
app/views/news/show.html.erb | ||
---|---|---|
42 | 42 |
:title => l(:button_delete), |
43 | 43 |
:class => 'icon-only icon-del' %> |
44 | 44 |
</div> |
45 |
<h4><%= avatar(comment.author) %><%= authoring comment.created_on, comment.author %></h4> |
|
45 |
<h4><%= avatar(comment.author) %><%= authoring comment.created_on, comment.author, :badge => news_comment_user_badge(comment) %></h4>
|
|
46 | 46 |
<div class="wiki"> |
47 | 47 |
<%= textilizable(comment.comments) %> |
48 | 48 |
</div> |
config/locales/en.yml | ||
---|---|---|
907 | 907 |
label_missing_feeds_access_key: Missing a Atom access key |
908 | 908 |
label_feeds_access_key_created_on: "Atom access key created %{value} ago" |
909 | 909 |
label_module_plural: Modules |
910 |
label_added_time_by: "Added by %{author} %{age} ago" |
|
911 |
label_updated_time_by: "Updated by %{author} %{age} ago" |
|
910 |
label_added_time_by: "Added by %{author} %{badge} %{age} ago"
|
|
911 |
label_updated_time_by: "Updated by %{author} %{badge} %{age} ago"
|
|
912 | 912 |
label_updated_time: "Updated %{value} ago" |
913 | 913 |
label_jump_to_a_project: Jump to a project... |
914 | 914 |
label_file_plural: Files |
... | ... | |
1102 | 1102 |
label_display_type_board: Board |
1103 | 1103 |
label_my_bookmarks: My bookmarks |
1104 | 1104 |
label_assign_to_me: Assign to me |
1105 |
label_author: Author |
|
1105 | 1106 | |
1106 | 1107 |
button_login: Login |
1107 | 1108 |
button_submit: Submit |
public/stylesheets/application.css | ||
---|---|---|
1469 | 1469 |
color: #1D781D; |
1470 | 1470 |
border: 1px solid #1D781D; |
1471 | 1471 |
} |
1472 |
.badge-user-author { |
|
1473 |
color: #205D86; |
|
1474 |
border: 1px solid #205D86; |
|
1475 |
} |
|
1476 | ||
1472 | 1477 |
/***** Tooltips *****/ |
1473 | 1478 |
.ui-tooltip { |
1474 | 1479 |
background: #000; |
test/helpers/journals_helper_test.rb | ||
---|---|---|
49 | 49 |
assert_kind_of Attachment, thumbnails.first |
50 | 50 |
assert_equal 'image.png', thumbnails.first.filename |
51 | 51 |
end |
52 | ||
53 |
def test_journal_user_badge |
|
54 |
issue = Issue.generate!(:author_id => 1, :assigned_to_id => 2) |
|
55 | ||
56 |
journal = issue.init_journal(User.find(1), "Updated by an author") |
|
57 |
assert_equal '<span class="badge badge-user-author">Author</span>', journal_user_badge(journal) |
|
58 |
end |
|
52 | 59 |
end |