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