Project

General

Profile

Feature #33641 » author-and-assignee-badge.patch

PoC Patch - Go MAEDA, 2020-06-21 07:13

View differences:

app/helpers/application_helper.rb
640 640
  end
641 641

  
642 642
  def authoring(created, author, options={})
643
    l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
643
    l(options[:label] || :label_added_time_by, :author => link_to_user(author), :badge => options[:badge], :age => time_tag(created)).html_safe
644 644
  end
645 645

  
646 646
  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
    issue = journal&.journalized
74
    return '' if issue.nil?
75

  
76
    # Show only "Author" badge if the user is both an author and an assignee
77
    case journal.user
78
    when issue.author
79
      content_tag('span', l(:label_author), class: 'badge badge-status-open')
80
    when issue.assigned_to
81
      content_tag('span', l(:field_assigned_to), class: 'badge badge-status-open')
82
    else
83
      ''
84
    end
85
  end
71 86
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-status-open')
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-status-open')
26
    else
27
      ''
28
    end
29
  end
21 30
end
app/helpers/wiki_helper.rb
66 66
  end
67 67

  
68 68
  def wiki_content_update_info(content)
69
    l(:label_updated_time_by, :author => link_to_user(content.author), :age => time_tag(content.updated_on)).html_safe
69
    l(:label_updated_time_by, :author => link_to_user(content.author), :age => time_tag(content.updated_on), :badge => '').html_safe
70 70
  end
71 71
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
895 895
  label_missing_feeds_access_key: Missing a Atom access key
896 896
  label_feeds_access_key_created_on: "Atom access key created %{value} ago"
897 897
  label_module_plural: Modules
898
  label_added_time_by: "Added by %{author} %{age} ago"
899
  label_updated_time_by: "Updated by %{author} %{age} ago"
898
  label_added_time_by: "Added by %{author} %{badge} %{age} ago"
899
  label_updated_time_by: "Updated by %{author} %{badge} %{age} ago"
900 900
  label_updated_time: "Updated %{value} ago"
901 901
  label_jump_to_a_project: Jump to a project...
902 902
  label_file_plural: Files
......
1089 1089
  label_display_type_board: Board
1090 1090
  label_my_bookmarks: My bookmarks
1091 1091
  label_assign_to_me: Assign to me
1092
  label_author: Author
1092 1093

  
1093 1094
  button_login: Login
1094 1095
  button_submit: Submit
(5-5/9)