summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-04-14 13:02:14 +0100
committerPhil Hughes <me@iamphill.com>2016-04-14 13:02:14 +0100
commit23d5e11f21a167851836aa212f9e101b28105cd9 (patch)
tree0b230f2ce1737c59c35b53ac7d9493369b82887d
parent6d0e6b750d0e325d408ba27061fa8877ddbac9a2 (diff)
downloadgitlab-ce-system-note-design.tar.gz
Updated some system notessystem-note-design
-rw-r--r--app/assets/stylesheets/pages/notes.scss47
-rw-r--r--app/helpers/notes_helper.rb19
-rw-r--r--app/views/projects/notes/_note.html.haml21
-rw-r--r--app/views/projects/notes/discussions/_active.html.haml7
-rw-r--r--app/views/projects/notes/discussions/_commit.html.haml7
-rw-r--r--app/views/projects/notes/discussions/_outdated.html.haml5
6 files changed, 56 insertions, 50 deletions
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index f09a774bdb5..9199dfd5502 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -182,6 +182,8 @@ ul.notes {
.discussion-header,
.note-header {
+ color: $notes-light-color;
+
a {
color: inherit;
@@ -191,11 +193,16 @@ ul.notes {
}
}
-}
+ .note-author {
+ color: $gl-gray;
+ font-weight: 600;
-.note-headline-light,
-.discussion-headline-light {
- color: $notes-light-color;
+ &:hover,
+ &:focus {
+ color: $gl-link-color;
+ text-decoration: none;
+ }
+ }
}
/**
@@ -331,35 +338,25 @@ ul.notes {
}
}
-.note-author {
- color: inherit;
- font-weight: 600;
-
- &:hover,
- &:focus {
- color: $gl-link-color;
- text-decoration: none;
- }
-}
-
.note-system {
line-height: 40px;
- .author_link,
- p,
- .note-created-ago {
+ p {
display: inline-block;
margin: 0;
}
- p {
- > strong {
- color: $gl-gray;
- }
+ strong {
+ color: $gl-gray;
+ }
+
+ .note-header {
+ display: inline-block;
+ line-height: 20px;
}
}
-.note-system-text {
- display: inline-block;
- line-height: 20px;
+.note-system-icon {
+ margin-right: 5px;
+ color: $notes-light-color;
}
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 58021c4c259..72d3e3af5c7 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -74,9 +74,14 @@ module NotesHelper
end
CHANGED_REGEX = /^(title|status|milestone) changed/i.freeze
+ DOWNCASE_FIRST_REGEX = /^(removed|reassigned|added|mentioned)/i.freeze
def system_note_text(note_text)
if note_text =~ CHANGED_REGEX
note_text.gsub!(CHANGED_REGEX) { "changed #{Regexp.last_match[1].downcase}" }
+ elsif note_text =~ DOWNCASE_FIRST_REGEX
+ note_text.sub!(/^[A-Z]/, &:downcase)
+ elsif note_text == "Assignee removed"
+ note_text = "removed assignee"
end
note_text
@@ -85,8 +90,10 @@ module NotesHelper
LABEL_REGEX = /^(added|removed) (.*) label/i.freeze
TITLE_REGEX = /^title changed/i.freeze
MILESTONE_REGEX = /^milestone changed/i.freeze
- STATUS_CLOSED = /^status changed to closed/i.freeze
- STATUS_OPEN = /^status changed to (open|reopened)/i.freeze
+ STATUS_CLOSED_REGEX = /^status changed to closed/i.freeze
+ STATUS_OPEN_REGEX = /^status changed to (open|reopened)/i.freeze
+ ASSIGNEE_REGEX = /^(reassigned|assignee)/i.freeze
+ MENTIONED_REGEX = /^(mentioned)/i.freeze
def system_note_icon(note_text)
if note_text =~ LABEL_REGEX
'tags'
@@ -94,10 +101,14 @@ module NotesHelper
'pencil'
elsif note_text =~ MILESTONE_REGEX
'clock-o'
- elsif note_text =~ STATUS_CLOSED
+ elsif note_text =~ STATUS_CLOSED_REGEX
'check'
- elsif note_text =~ STATUS_OPEN
+ elsif note_text =~ STATUS_OPEN_REGEX
'circle-o'
+ elsif note_text =~ ASSIGNEE_REGEX
+ 'user'
+ elsif note_text =~ MENTIONED_REGEX
+ 'bookmark'
end
end
end
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 50e19657abf..fb16988c7b1 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -5,21 +5,22 @@
= image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
.timeline-content
- if note.system
+ - system_icon = system_note_icon(note.note)
.note-system
- .note-system-text
- = icon(system_note_icon(note.note))
+ .note-header
+ - if !system_icon.nil?
+ = icon(system_icon, class: 'note-system-icon')
= link_to_member(note.project, note.author, { avatar: false, link_class: 'note-author' })
- .inline.note-headline-light
- = note.author.to_reference
- = markdown(system_note_text(note.note), pipeline: :note)
- = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
+ = note.author.to_reference
+ -# = markdown(system_note_text(note.note), pipeline: :note, cache_key: [note, "note"])
+ = markdown(system_note_text(note.note), pipeline: :note)
+ = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
- else
.note-header
= link_to_member(note.project, note.author, { avatar: false, link_class: 'note-author' })
- .inline.note-headline-light
- = "#{note.author.to_reference} commented"
- %a{ href: "##{dom_id(note)}" }
- = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
+ = "#{note.author.to_reference} commented"
+ %a{ href: "##{dom_id(note)}" }
+ = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
.note-actions
- access = note.project.team.human_max_access(note.author.id)
- if access
diff --git a/app/views/projects/notes/discussions/_active.html.haml b/app/views/projects/notes/discussions/_active.html.haml
index cd8a5f0bd02..5736818cece 100644
--- a/app/views/projects/notes/discussions/_active.html.haml
+++ b/app/views/projects/notes/discussions/_active.html.haml
@@ -2,10 +2,9 @@
.discussion.js-toggle-container{ class: note.discussion_id }
.discussion-header
= link_to_member(@project, note.author, avatar: false)
- .inline.discussion-headline-light
- = "#{note.author.to_reference} started a discussion"
- = link_to diffs_namespace_project_merge_request_path(note.project.namespace, note.project, note.noteable, anchor: note.line_code) do
- on the diff
+ = "#{note.author.to_reference} started a discussion"
+ = link_to diffs_namespace_project_merge_request_path(note.project.namespace, note.project, note.noteable, anchor: note.line_code) do
+ on the diff
.discussion-actions
= link_to "#", class: "discussion-action-button discussion-toggle-button js-toggle-button" do
%i.fa.fa-chevron-up
diff --git a/app/views/projects/notes/discussions/_commit.html.haml b/app/views/projects/notes/discussions/_commit.html.haml
index 46f2ba4bbcf..8e4db20910c 100644
--- a/app/views/projects/notes/discussions/_commit.html.haml
+++ b/app/views/projects/notes/discussions/_commit.html.haml
@@ -4,10 +4,9 @@
.discussion.js-toggle-container{ class: note.discussion_id }
.discussion-header
= link_to_member(@project, note.author, avatar: false)
- .inline.discussion-headline-light
- = "#{note.author.to_reference} started a discussion on #{commit_description}"
- - if commit
- = link_to(commit.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable), class: 'monospace')
+ = "#{note.author.to_reference} started a discussion on #{commit_description}"
+ - if commit
+ = link_to(commit.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable), class: 'monospace')
.discussion-actions
= link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do
%i.fa.fa-chevron-up
diff --git a/app/views/projects/notes/discussions/_outdated.html.haml b/app/views/projects/notes/discussions/_outdated.html.haml
index f8e000b424f..90a9abae614 100644
--- a/app/views/projects/notes/discussions/_outdated.html.haml
+++ b/app/views/projects/notes/discussions/_outdated.html.haml
@@ -2,9 +2,8 @@
.discussion.js-toggle-container{ class: note.discussion_id }
.discussion-header
= link_to_member(@project, note.author, avatar: false)
- .inline.discussion-headline-light
- = "#{note.author.to_reference} started a discussion"
- on the outdated diff
+ = "#{note.author.to_reference} started a discussion"
+ on the outdated diff
.discussion-actions
= link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do
%i.fa.fa-chevron-down