debian-mirror-gitlab/app/helpers/system_note_helper.rb

63 lines
1.8 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module SystemNoteHelper
ICON_NAMES_BY_ACTION = {
2021-01-03 14:25:43 +05:30
'approved' => 'approval',
'unapproved' => 'unapproval',
2020-04-08 14:13:33 +05:30
'cherry_pick' => 'cherry-pick-commit',
2018-03-17 18:26:18 +05:30
'commit' => 'commit',
2018-10-15 14:42:47 +05:30
'description' => 'pencil-square',
2018-03-17 18:26:18 +05:30
'merge' => 'git-merge',
'merged' => 'git-merge',
2020-11-24 15:15:51 +05:30
'opened' => 'issues',
2018-03-17 18:26:18 +05:30
'closed' => 'issue-close',
'time_tracking' => 'timer',
'assignee' => 'user',
2021-01-03 14:25:43 +05:30
'reviewer' => 'user',
2018-10-15 14:42:47 +05:30
'title' => 'pencil-square',
2018-03-17 18:26:18 +05:30
'task' => 'task-done',
'label' => 'label',
'cross_reference' => 'comment-dots',
'branch' => 'fork',
'confidential' => 'eye-slash',
'visible' => 'eye',
'milestone' => 'clock',
'discussion' => 'comment',
'moved' => 'arrow-right',
2018-10-15 14:42:47 +05:30
'outdated' => 'pencil-square',
2019-10-12 21:52:04 +05:30
'pinned_embed' => 'thumbtack',
2020-04-08 14:13:33 +05:30
'duplicate' => 'duplicate',
2018-03-17 18:26:18 +05:30
'locked' => 'lock',
2018-11-20 20:47:30 +05:30
'unlocked' => 'lock-open',
2020-04-22 19:07:51 +05:30
'due_date' => 'calendar',
2020-05-24 23:13:21 +05:30
'health_status' => 'status-health',
'designs_added' => 'doc-image',
'designs_modified' => 'doc-image',
'designs_removed' => 'doc-image',
2020-07-28 23:09:34 +05:30
'designs_discussion_added' => 'doc-image',
'status' => 'status',
2020-11-24 15:15:51 +05:30
'alert_issue_added' => 'issues',
2021-01-03 14:25:43 +05:30
'new_alert_added' => 'warning',
2021-02-22 17:27:13 +05:30
'severity' => 'information-o',
2021-11-11 11:23:49 +05:30
'cloned' => 'documents',
'issue_type' => 'pencil-square'
2017-08-17 22:00:37 +05:30
}.freeze
2018-03-17 18:26:18 +05:30
def system_note_icon_name(note)
ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]
end
2017-08-17 22:00:37 +05:30
def icon_for_system_note(note)
2018-03-17 18:26:18 +05:30
icon_name = system_note_icon_name(note)
sprite_icon(icon_name) if icon_name
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
extend self
2017-08-17 22:00:37 +05:30
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
SystemNoteHelper.prepend_mod_with('SystemNoteHelper')
2019-12-04 20:38:33 +05:30
# The methods in `EE::SystemNoteHelper` should be available as both instance and
# class methods.
2021-06-08 01:23:25 +05:30
SystemNoteHelper.extend_mod_with('SystemNoteHelper')