Project

General

Profile

Feature #33641 » 33641-v5.patch

Go MAEDA, 2023-01-25 08:12

View differences:

app/helpers/application_helper.rb
690 690
  end
691 691

  
692 692
  def authoring(created, author, options={})
693
    l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
693
    l(options[:label] || :label_added_time_by, :author => link_to_user(author), :badge => options[:badge], :age => time_tag(created)).html_safe
694 694
  end
695 695

  
696 696
  def time_tag(time)
app/helpers/journals_helper.rb
84 84

  
85 85
    content_tag('span', "· #{l(:label_edited)}", :title => l(:label_time_by_author, :time => format_time(journal.updated_on), :author => journal.updated_by), :class => 'update-info')
86 86
  end
87

  
88
  def journal_user_badge(journal)
89
    return '' if journal.nil?
90

  
91
    issue = journal&.journalized
92
    if journal.user == issue&.author
93
      content_tag('span', l(:field_author), class: 'badge badge-user-author')
94
    else
95
      ''
96
    end
97
  end
87 98
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(:field_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(:field_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
      <%= render_journal_update_info(journal) %>
19 19
    </h4>
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
922 922
  label_missing_feeds_access_key: Missing a Atom access key
923 923
  label_feeds_access_key_created_on: "Atom access key created %{value} ago"
924 924
  label_module_plural: Modules
925
  label_added_time_by: "Added by %{author} %{age} ago"
926
  label_updated_time_by: "Updated by %{author} %{age} ago"
925
  label_added_time_by: "Added by %{author} %{badge} %{age} ago"
926
  label_updated_time_by: "Updated by %{author} %{badge} %{age} ago"
927 927
  label_updated_time: "Updated %{value} ago"
928 928
  label_jump_to_a_project: Jump to a project...
929 929
  label_file_plural: Files
public/stylesheets/application.css
1519 1519
.badge-issues-count {
1520 1520
  background: #EEEEEE;
1521 1521
}
1522
.badge-user-author {
1523
  color: #205D86;
1524
  border: 1px solid #205D86;
1525
}
1522 1526

  
1523 1527
/***** Tooltips *****/
1524 1528
.ui-tooltip {
test/helpers/journals_helper_test.rb
87 87
    assert_equal 2, journal.details.count
88 88
    assert_equal journal.details.map(&:value), thumbnails.map(&:filename)
89 89
  end
90

  
91
  def test_journal_user_badge
92
    issue = Issue.generate!(:author_id => 1, :assigned_to_id => 2)
93

  
94
    journal = issue.init_journal(User.find(1), "Updated by an author")
95
    assert_equal '<span class="badge badge-user-author">Author</span>', journal_user_badge(journal)
96
  end
90 97
end
(9-9/9)