summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-08-17 19:27:11 +0200
committerDouwe Maan <douwe@selenight.nl>2017-08-17 19:27:11 +0200
commit7c491d4fefbd0a079a497e5cae07056bfe467622 (patch)
tree5e41c07992069943d6b4eff30b9f6a70b82f317a
parent5f758aff57dc54df7d92d0fb63e706d58cf1093d (diff)
downloadgitlab-ce-7c491d4fefbd0a079a497e5cae07056bfe467622.tar.gz
Misc tweaks
-rw-r--r--app/helpers/notes_helper.rb8
-rw-r--r--app/serializers/note_entity.rb4
-rw-r--r--app/serializers/note_user_entity.rb3
-rw-r--r--app/serializers/user_note_entity.rb9
-rw-r--r--app/views/projects/issues/_discussion.html.haml8
-rw-r--r--app/views/projects/issues/show.html.haml5
-rw-r--r--app/views/shared/notes/_notes_with_form.html.haml2
7 files changed, 18 insertions, 21 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index ea20f4b8d87..8c5e258f519 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -93,13 +93,13 @@ module NotesHelper
end
end
- def notes_url(extra_params = {})
+ def notes_url(params = {})
if @snippet.is_a?(PersonalSnippet)
- snippet_notes_path(@snippet, extra_params)
+ snippet_notes_path(@snippet, params)
else
- params = { target_id: @noteable.id, target_type: @noteable.class.name.underscore }
+ params.merge!(target_id: @noteable.id, target_type: @noteable.class.name.underscore)
- project_noteable_notes_path(@project, params.merge(extra_params))
+ project_noteable_notes_path(@project, params)
end
end
diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb
index 416730470dc..663a9c06c40 100644
--- a/app/serializers/note_entity.rb
+++ b/app/serializers/note_entity.rb
@@ -3,7 +3,7 @@ class NoteEntity < API::Entities::Note
expose :type
- expose :author, using: UserNoteEntity
+ expose :author, using: NoteUserEntity
expose :human_access do |note|
note.project.team.human_max_access(note.author_id)
@@ -15,7 +15,7 @@ class NoteEntity < API::Entities::Note
expose :redacted_note_html, as: :note_html
expose :last_edited_at, if: -> (note, _) { note.is_edited? }
- expose :last_edited_by, using: UserNoteEntity, if: -> (note, _) { note.is_edited? }
+ expose :last_edited_by, using: NoteUserEntity, if: -> (note, _) { note.is_edited? }
expose :current_user do
expose :can_edit do |note|
diff --git a/app/serializers/note_user_entity.rb b/app/serializers/note_user_entity.rb
new file mode 100644
index 00000000000..7289f3a0222
--- /dev/null
+++ b/app/serializers/note_user_entity.rb
@@ -0,0 +1,3 @@
+class NoteUserEntity < UserEntity
+ unexpose :web_url
+end
diff --git a/app/serializers/user_note_entity.rb b/app/serializers/user_note_entity.rb
deleted file mode 100644
index fbd87470380..00000000000
--- a/app/serializers/user_note_entity.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class UserNoteEntity < API::Entities::UserBasic
- include RequestAwareEntity
-
- unexpose :web_url
-
- expose :path do |user|
- user_path(user)
- end
-end
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
index 3e63758a5e5..483f28c74f2 100644
--- a/app/views/projects/issues/_discussion.html.haml
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -1,12 +1,13 @@
- @gfm_form = true
+
- content_for :note_actions do
- if can?(current_user, :update_issue, @issue)
= link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
= link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, format: 'json'), data: {original_text: "Close issue", alternative_text: "Comment & close issue"}, class: "btn btn-nr btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
%section.js-vue-notes-event
- #js-vue-notes{ data: { discussions_path: discussions_namespace_project_issue_path(@project.namespace, @project, @issue, format: :json),
- register_path: "#{new_session_path(:user, redirect_to_referer: 'yes')}#register-pane",
+ #js-vue-notes{ data: { discussions_path: discussions_project_issue_path(@project, @issue, format: :json),
+ register_path: new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'),
new_session_path: new_session_path(:user, redirect_to_referer: 'yes'),
markdown_docs_path: help_page_path('user/markdown'),
quick_actions_docs_path: help_page_path('user/project/quick_actions'),
@@ -14,6 +15,3 @@
last_fetched_at: Time.now.to_i,
issue_data: serialize_issuable(@issue),
current_user_data: UserSerializer.new.represent(current_user).to_json } }
- - content_for :page_specific_javascripts do
- = webpack_bundle_tag 'common_vue'
- = webpack_bundle_tag 'notes'
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index f2141b84e6d..04b4ed95a2d 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -2,6 +2,11 @@
- page_title "#{@issue.title} (#{@issue.to_reference})", "Issues"
- page_description @issue.description
- page_card_attributes @issue.card_attributes
+
+- content_for :page_specific_javascripts do
+ = webpack_bundle_tag 'common_vue'
+ = webpack_bundle_tag 'notes'
+
- can_update_issue = can?(current_user, :update_issue, @issue)
- can_report_spam = @issue.submittable_as_spam_by?(current_user)
diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml
index 1264f07eac9..e3e86709b8f 100644
--- a/app/views/shared/notes/_notes_with_form.html.haml
+++ b/app/views/shared/notes/_notes_with_form.html.haml
@@ -17,7 +17,7 @@
- elsif !current_user
.disabled-comment.text-center.prepend-top-default
Please
- = link_to "register", new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-register-link'
+ = link_to "register", new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), class: 'js-register-link'
or
= link_to "sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link'
to comment