summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-03-31 10:51:49 -0500
committerJacob Schatz <jschatz1@gmail.com>2017-04-06 19:22:33 -0400
commit32e4a0f3513c846da376f70706d8d0ea60ba8b6e (patch)
treed047969b952f456e7f49b7776075d71137ae5e80
parentd2aea4cde0574b1dfbfc3d8d85ab80195fc29e3f (diff)
downloadgitlab-ce-32e4a0f3513c846da376f70706d8d0ea60ba8b6e.tar.gz
Add system notes icon helper; add icons
-rw-r--r--app/assets/stylesheets/pages/notes.scss12
-rw-r--r--app/helpers/system_note_helper.rb28
-rw-r--r--app/views/projects/notes/_note.html.haml9
-rw-r--r--app/views/shared/icons/_icon_closed.svg1
-rw-r--r--app/views/shared/icons/_icon_merge.svg1
-rw-r--r--app/views/shared/icons/_icon_merged.svg1
-rw-r--r--app/views/shared/icons/_icon_opened.svg1
-rw-r--r--app/views/shared/icons/_icon_pencil.svg1
-rw-r--r--app/views/shared/icons/_icon_user.svg1
9 files changed, 41 insertions, 14 deletions
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 603ef461ffe..e12dba7f4d9 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -130,18 +130,6 @@ ul.notes {
}
}
}
-
- .timeline-icon {
- display: none;
-
- .avatar {
- visibility: hidden;
-
- .discussion-body & {
- visibility: visible;
- }
- }
- }
}
.discussion-body {
diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb
new file mode 100644
index 00000000000..e4dcf5343bc
--- /dev/null
+++ b/app/helpers/system_note_helper.rb
@@ -0,0 +1,28 @@
+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_opened'
+ when 'closed'
+ 'icon_closed'
+ when 'time_tracking'
+ 'icon_timer'
+ when 'assignee'
+ 'icon_user'
+ when 'title'
+ 'icon_pencil'
+ else
+ 'icon_status_canceled'
+ end
+
+ custom_icon(icon_name)
+ end
+end
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 18afa811bad..7d7a6a7387b 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -5,8 +5,13 @@
%li.timeline-entry{ id: dom_id(note), class: ["note", "note-row-#{note.id}", ('system-note' if note.system)], data: {author_id: note.author.id, editable: note_editable, note_id: note.id} }
.timeline-entry-inner
.timeline-icon
- %a{ href: user_path(note.author) }
- = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
+ - if note.system
+ -# = render "#{note.system_note_metadata.action}.svg"
+ = icon_for_system_note(note)
+ %h1= note.system_note_metadata.action.inspect
+ - else
+ %a{ href: user_path(note.author) }
+ = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
.timeline-content
.note-header
%a.visible-xs{ href: user_path(note.author) }
diff --git a/app/views/shared/icons/_icon_closed.svg b/app/views/shared/icons/_icon_closed.svg
new file mode 100644
index 00000000000..de448ee1194
--- /dev/null
+++ b/app/views/shared/icons/_icon_closed.svg
@@ -0,0 +1 @@
+<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M0 7c0-3.866 3.142-7 7-7 3.866 0 7 3.142 7 7 0 3.866-3.142 7-7 7-3.866 0-7-3.142-7-7z"/><path d="M1 7c0 3.309 2.69 6 6 6 3.309 0 6-2.69 6-6 0-3.309-2.69-6-6-6-3.309 0-6 2.69-6 6z" fill="#FFF"/><rect x="3.36" y="6.16" width="7.28" height="1.68" rx=".84"/></svg>
diff --git a/app/views/shared/icons/_icon_merge.svg b/app/views/shared/icons/_icon_merge.svg
new file mode 100644
index 00000000000..d53a7470243
--- /dev/null
+++ b/app/views/shared/icons/_icon_merge.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m5 5.563v4.875c1.024.4 1.75 1.397 1.75 2.563 0 1.519-1.231 2.75-2.75 2.75-1.519 0-2.75-1.231-2.75-2.75 0-1.166.726-2.162 1.75-2.563v-4.875c-1.024-.4-1.75-1.397-1.75-2.563 0-1.519 1.231-2.75 2.75-2.75 1.519 0 2.75 1.231 2.75 2.75 0 1.166-.726 2.162-1.75 2.563m-1 8.687c.69 0 1.25-.56 1.25-1.25 0-.69-.56-1.25-1.25-1.25-.69 0-1.25.56-1.25 1.25 0 .69.56 1.25 1.25 1.25m0-10c.69 0 1.25-.56 1.25-1.25 0-.69-.56-1.25-1.25-1.25-.69 0-1.25.56-1.25 1.25 0 .69.56 1.25 1.25 1.25"/><path d="m10.501 2c1.381.001 2.499 1.125 2.499 2.506v5.931c1.024.4 1.75 1.397 1.75 2.563 0 1.519-1.231 2.75-2.75 2.75-1.519 0-2.75-1.231-2.75-2.75 0-1.166.726-2.162 1.75-2.563v-5.931c0-.279-.225-.506-.499-.506v.926c0 .346-.244.474-.569.271l-2.952-1.844c-.314-.196-.325-.507 0-.71l2.952-1.844c.314-.196.569-.081.569.271v.93m1.499 12.25c.69 0 1.25-.56 1.25-1.25 0-.69-.56-1.25-1.25-1.25-.69 0-1.25.56-1.25 1.25 0 .69.56 1.25 1.25 1.25"/></svg> \ No newline at end of file
diff --git a/app/views/shared/icons/_icon_merged.svg b/app/views/shared/icons/_icon_merged.svg
new file mode 100644
index 00000000000..d8f96558bea
--- /dev/null
+++ b/app/views/shared/icons/_icon_merged.svg
@@ -0,0 +1 @@
+<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M0 7c0-3.866 3.142-7 7-7 3.866 0 7 3.142 7 7 0 3.866-3.142 7-7 7-3.866 0-7-3.142-7-7z"/><path d="M1 7c0 3.309 2.69 6 6 6 3.309 0 6-2.69 6-6 0-3.309-2.69-6-6-6-3.309 0-6 2.69-6 6z" fill="#FFF"/><path d="M9.427 6.523a.932.932 0 0 0-.808.489v-.01c-.49-.01-1.059-.172-1.46-.489-.35-.278-.7-.772-.882-1.17a.964.964 0 0 0 .35-.744.943.943 0 0 0-.934-.959c-.518 0-.933.432-.933.964 0 .35.191.662.467.825v3.147a.97.97 0 0 0-.467.825c0 .532.415.959.933.959a.943.943 0 0 0 .934-.96.965.965 0 0 0-.467-.824V6.844c.313.336.672.61 1.073.81.402.202.948.303 1.386.308v-.01c.168.293.467.49.808.49a.943.943 0 0 0 .933-.96.943.943 0 0 0-.933-.96z"/></svg>
diff --git a/app/views/shared/icons/_icon_opened.svg b/app/views/shared/icons/_icon_opened.svg
new file mode 100644
index 00000000000..ed58d23c626
--- /dev/null
+++ b/app/views/shared/icons/_icon_opened.svg
@@ -0,0 +1 @@
+<svg width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M0 7c0-3.866 3.142-7 7-7 3.866 0 7 3.142 7 7 0 3.866-3.142 7-7 7-3.866 0-7-3.142-7-7z"/><path d="M1 7c0 3.309 2.69 6 6 6 3.309 0 6-2.69 6-6 0-3.309-2.69-6-6-6-3.309 0-6 2.69-6 6z" fill="#FFF"/><path d="M7 9.219a2.218 2.218 0 1 0 0-4.436A2.218 2.218 0 0 0 7 9.22zm0 1.12a3.338 3.338 0 1 1 0-6.676 3.338 3.338 0 0 1 0 6.676z"/></svg>
diff --git a/app/views/shared/icons/_icon_pencil.svg b/app/views/shared/icons/_icon_pencil.svg
new file mode 100644
index 00000000000..5d78ebd07c5
--- /dev/null
+++ b/app/views/shared/icons/_icon_pencil.svg
@@ -0,0 +1 @@
+<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z"/></svg> \ No newline at end of file
diff --git a/app/views/shared/icons/_icon_user.svg b/app/views/shared/icons/_icon_user.svg
new file mode 100644
index 00000000000..5d34471482e
--- /dev/null
+++ b/app/views/shared/icons/_icon_user.svg
@@ -0,0 +1 @@
+<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1600 1405q0 120-73 189.5t-194 69.5h-874q-121 0-194-69.5t-73-189.5q0-53 3.5-103.5t14-109 26.5-108.5 43-97.5 62-81 85.5-53.5 111.5-20q9 0 42 21.5t74.5 48 108 48 133.5 21.5 133.5-21.5 108-48 74.5-48 42-21.5q61 0 111.5 20t85.5 53.5 62 81 43 97.5 26.5 108.5 14 109 3.5 103.5zm-320-893q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5z"/></svg> \ No newline at end of file