Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
8552d120
Commit
8552d120
authored
Apr 12, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move event icons into events_helper
parent
466ca12e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
21 deletions
+31
-21
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+28
-0
app/helpers/system_note_helper.rb
app/helpers/system_note_helper.rb
+2
-20
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-1
No files found.
app/helpers/events_helper.rb
View file @
8552d120
module
EventsHelper
ICON_NAMES_BY_EVENT_TYPE
=
{
'pushed to'
=>
'icon_commit'
,
'pushed new'
=>
'icon_commit'
,
'created'
=>
'icon_status_open'
,
'opened'
=>
'icon_status_open'
,
'closed'
=>
'icon_status_closed'
,
'accepted'
=>
'icon_code_fork'
,
'commented on'
=>
'icon_comment_o'
,
'deleted'
=>
'icon_trash_o'
}.
freeze
def
link_to_author
(
event
)
author
=
event
.
author
...
...
@@ -183,4 +194,21 @@ module EventsHelper
"event-inline"
end
end
def
icon_for_event
(
note
)
icon_name
=
ICON_NAMES_BY_EVENT_TYPE
[
note
]
custom_icon
(
icon_name
)
if
icon_name
end
def
icon_for_profile_event
(
event
)
if
current_path?
(
'users#show'
)
content_tag
:div
,
class:
"system-note-image
#{
event
.
action_name
.
parameterize
}
-icon"
do
icon_for_event
(
event
.
action_name
)
end
else
content_tag
:div
,
class:
'system-note-image user-avatar'
do
author_avatar
(
event
,
size:
32
)
end
end
end
end
app/helpers/system_note_helper.rb
View file @
8552d120
module
SystemNoteHelper
ICON_NAMES_BY_ACTION
=
{
'commit'
=>
'icon_commit'
,
'pushed to'
=>
'icon_commit'
,
'pushed new'
=>
'icon_commit'
,
'merge'
=>
'icon_merge'
,
'merged'
=>
'icon_merged'
,
'opened'
=>
'icon_status_open'
,
'created'
=>
'icon_status_open'
,
'closed'
=>
'icon_status_closed'
,
'time_tracking'
=>
'icon_stopwatch'
,
'assignee'
=>
'icon_user'
,
...
...
@@ -15,30 +12,15 @@ module SystemNoteHelper
'label'
=>
'icon_tags'
,
'cross_reference'
=>
'icon_random'
,
'branch'
=>
'icon_code_fork'
,
'accepted'
=>
'icon_code_fork'
,
'confidential'
=>
'icon_eye_slash'
,
'visible'
=>
'icon_eye'
,
'milestone'
=>
'icon_clock_o'
,
'discussion'
=>
'icon_comment_o'
,
'commented on'
=>
'icon_comment_o'
,
'moved'
=>
'icon_arrow_circle_o_right'
,
'deleted'
=>
'icon_trash_o'
'moved'
=>
'icon_arrow_circle_o_right'
}.
freeze
def
icon_for_system_note
(
note
)
icon_name
=
ICON_NAMES_BY_ACTION
[
note
]
icon_name
=
ICON_NAMES_BY_ACTION
[
note
.
system_note_metadata
&
.
action
]
custom_icon
(
icon_name
)
if
icon_name
end
def
icon_for_profile_event
(
event
)
if
current_path?
(
'users#show'
)
content_tag
:div
,
class:
"system-note-image
#{
event
.
action_name
}
-icon"
do
icon_for_system_note
(
event
.
action_name
)
end
else
content_tag
:div
,
class:
'system-note-image user-avatar'
do
author_avatar
(
event
,
size:
32
)
end
end
end
end
app/views/projects/notes/_note.html.haml
View file @
8552d120
...
...
@@ -6,7 +6,7 @@
.timeline-entry-inner
.timeline-icon
-
if
note
.
system
=
icon_for_system_note
(
note
.
system_note_metadata
&
.
action
)
=
icon_for_system_note
(
note
)
-
else
%a
{
href:
user_path
(
note
.
author
)
}
=
image_tag
avatar_icon
(
note
.
author
),
alt:
''
,
class:
'avatar s40'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment