diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-04-06 15:59:47 -0500 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-04-06 19:22:33 -0400 |
commit | 25faa060604e4cab261f1d9845fa1072110e75fd (patch) | |
tree | 7f2ffb21f2ab184cea9e5fc109443333d4b2489c /app/helpers/system_note_helper.rb | |
parent | 2c9239fb66b9859f29e23b6de6b0523f23212ae8 (diff) | |
download | gitlab-ce-25faa060604e4cab261f1d9845fa1072110e75fd.tar.gz |
Rewrite system note helper
Diffstat (limited to 'app/helpers/system_note_helper.rb')
-rw-r--r-- | app/helpers/system_note_helper.rb | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb index 51ebac88d91..b8d7c953d79 100644 --- a/app/helpers/system_note_helper.rb +++ b/app/helpers/system_note_helper.rb @@ -1,44 +1,26 @@ module SystemNoteHelper - def icon_for_system_note(note) - - icon_name = - case note.system_note_metadata.action - when 'commit' - 'icon_commit' - when 'merge' - 'icon_merge' - when 'merged' - 'icon_merged' - when 'opened' - 'icon_status_open' - when 'closed' - 'icon_status_closed' - when 'time_tracking' - 'icon_stopwatch' - when 'assignee' - 'icon_user' - when 'title' - 'icon_edit' - when 'task' - 'icon_check_square_o' - when 'label' - 'icon_tags' - when 'cross_reference' - 'icon_random' - when 'branch' - 'icon_code_fork' - when 'confidential' - 'icon_eye_slash' - when 'visible' - 'icon_eye' - when 'milestone' - 'icon_clock_o' - when 'discussion' - 'icon_comment_o' - when 'moved' - 'icon_arrow-circle-o-right' - end + ICON_NAMES_BY_ACTION = { + 'commit' => 'icon_commit', + 'merge' => 'icon_merge', + 'merged' => 'icon_merged', + 'opened' => 'icon_status_open', + 'closed' => 'icon_status_closed', + 'time_tracking' => 'icon_stopwatch', + 'assignee' => 'icon_user', + 'title' => 'icon_pencil', + 'task' => 'icon_check_square_o', + 'label' => 'icon_tags', + 'cross_reference' => 'icon_random', + 'branch' => 'icon_code_fork', + 'confidential' => 'icon_eye_slash', + 'visible' => 'icon_eye', + 'milestone' => 'icon_clock_o', + 'discussion' => 'icon_comment_o', + 'moved' => 'icon_arrow-circle-o-right' + }.freeze + def icon_for_system_note(note) + icon_name = ICON_NAMES_BY_ACTION[note.system_note_metadata&.action] custom_icon(icon_name) if icon_name end end |