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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b550e6ee
Commit
b550e6ee
authored
8 years ago
by
Phil Hughes
Committed by
Douwe Maan
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Posts to rails to update note eventually
parent
662f5edd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
14 deletions
+69
-14
app/assets/javascripts/line_comments/application.js.coffee
app/assets/javascripts/line_comments/application.js.coffee
+1
-0
app/assets/javascripts/line_comments/components/resolve_all.js.coffee
...avascripts/line_comments/components/resolve_all.js.coffee
+15
-4
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
...avascripts/line_comments/components/resolve_btn.js.coffee
+15
-5
app/assets/javascripts/line_comments/services/resolve.js.coffee
...sets/javascripts/line_comments/services/resolve.js.coffee
+19
-0
app/assets/javascripts/line_comments/stores/comments.js.coffee
...ssets/javascripts/line_comments/stores/comments.js.coffee
+5
-0
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+1
-1
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+5
-0
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+2
-1
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+5
-3
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/assets/javascripts/line_comments/application.js.coffee
View file @
b550e6ee
#= require vue
#= require_directory ./stores
#= require_directory ./services
#= require_directory ./components
$
=>
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/line_comments/components/resolve_all.js.coffee
View file @
b550e6ee
@
ResolveAll
=
Vue
.
extend
data
:
->
{
comments
:
CommentsStore
.
state
}
comments
:
CommentsStore
.
state
loading
:
false
computed
:
resolved
:
->
resolvedCount
=
0
...
...
@@ -10,8 +11,18 @@
commentsCount
:
->
Object
.
keys
(
this
.
comments
).
length
buttonText
:
->
if
this
.
resolved
is
this
.
commentsCount
then
'Un-resolve all'
else
'Resolve all'
if
this
.
allResolved
then
'Un-resolve all'
else
'Resolve all'
allResolved
:
->
this
.
resolved
is
this
.
commentsCount
methods
:
updateAll
:
->
resolveAll
=
!
(
this
.
resolved
is
this
.
commentsCount
)
CommentsStore
.
updateAll
(
resolveAll
)
ids
=
CommentsStore
.
getAllForState
(
this
.
allResolved
)
this
.
$set
(
'loading'
,
true
)
promise
=
if
this
.
allResolved
then
ResolveService
.
resolveAll
(
ids
)
else
ResolveService
.
resolveAll
(
ids
)
promise
.
done
=>
CommentsStore
.
updateAll
(
!
this
.
allResolved
)
.
always
=>
this
.
$set
(
'loading'
,
false
)
This diff is collapsed.
Click to expand it.
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
View file @
b550e6ee
...
...
@@ -2,22 +2,32 @@
props
:
noteId
:
Number
resolved
:
Boolean
data
:
->
comments
:
CommentsStore
.
state
endpoint
:
String
data
:
->
comments
:
CommentsStore
.
state
loading
:
false
computed
:
buttonText
:
->
if
this
.
comments
[
this
.
noteId
]
then
"Mark as un-resolved"
else
"Mark as resolved"
isResolved
:
->
this
.
comments
[
this
.
noteId
]
methods
:
updateTooltip
:
->
$
(
this
.
$el
)
$
(
this
.
$el
s
.
button
)
.
tooltip
(
'hide'
)
.
tooltip
(
'fixTitle'
)
resolve
:
->
CommentsStore
.
update
(
this
.
noteId
,
!
this
.
comments
[
this
.
noteId
])
this
.
$set
(
'loading'
,
true
)
ResolveService
.
resolve
(
this
.
endpoint
,
!
this
.
isResolved
)
.
done
=>
this
.
$set
(
'loading'
,
false
)
CommentsStore
.
update
(
this
.
noteId
,
!
this
.
isResolved
)
this
.
$nextTick
this
.
updateTooltip
this
.
$nextTick
this
.
updateTooltip
.
always
=>
this
.
$set
(
'loading'
,
false
)
compiled
:
->
$
(
this
.
$el
).
tooltip
()
$
(
this
.
$el
s
.
button
).
tooltip
()
destroyed
:
->
CommentsStore
.
delete
(
this
.
noteId
)
created
:
->
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/line_comments/services/resolve.js.coffee
0 → 100644
View file @
b550e6ee
@
ResolveService
=
resolve
:
(
endpoint
,
resolve
)
->
$
.
ajax
data
:
resolved
:
resolve
type
:
'post'
url
:
endpoint
resolveAll
:
(
ids
)
->
$
.
ajax
data
:
id
:
ids
type
:
'get'
url
:
'/'
unResolveAll
:
(
ids
)
->
$
.
ajax
data
:
id
:
ids
type
:
'get'
url
:
'/'
This diff is collapsed.
Click to expand it.
app/assets/javascripts/line_comments/stores/comments.js.coffee
View file @
b550e6ee
...
...
@@ -9,3 +9,8 @@
updateAll
:
(
state
)
->
for
id
,
resolved
of
this
.
state
this
.
update
(
id
,
state
)
if
resolved
isnt
state
getAllForState
:
(
state
)
->
ids
=
[]
for
id
,
resolved
of
this
.
state
ids
.
push
(
id
)
if
resolved
is
state
ids
This diff is collapsed.
Click to expand it.
app/assets/stylesheets/pages/notes.scss
View file @
b550e6ee
...
...
@@ -387,7 +387,7 @@ ul.notes {
.line-resolve-all
{
padding
:
10px
;
border
:
1px
solid
$border-color
;
border-radius
:
2px
;
border-radius
:
$border-radius-default
;
.btn
{
margin-right
:
10px
;
...
...
This diff is collapsed.
Click to expand it.
app/controllers/projects/notes_controller.rb
View file @
b550e6ee
...
...
@@ -66,6 +66,11 @@ class Projects::NotesController < Projects::ApplicationController
end
end
def
resolve
sleep
2
render
nothing:
true
,
status:
200
end
private
def
note
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/merge_requests/_show.html.haml
View file @
b550e6ee
...
...
@@ -47,7 +47,8 @@
#resolve-all-app
{
"v-cloak"
=>
true
}
%resolve-all
{
"inline-template"
=>
true
}
.line-resolve-all
{
"v-show"
=>
"commentsCount > 0"
}
%button
.btn.btn-gray
{
type:
"button"
,
"aria-label"
=>
"Resolve all"
,
"@click"
=>
"updateAll"
}
%button
.btn.btn-gray
{
type:
"button"
,
"aria-label"
=>
"Resolve all"
,
"@click"
=>
"updateAll"
,
":disabled"
=>
"loading"
}
=
icon
(
"spinner spin"
,
"v-show"
=>
"loading"
)
{{ buttonText }}
%span
.line-resolve-text
{{ resolved }}/{{ commentsCount }} comments resolved
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/notes/_note.html.haml
View file @
b550e6ee
...
...
@@ -21,9 +21,11 @@
-
if
access
and
not
note
.
system
%span
.note-role.hidden-xs
=
access
-
unless
note
.
system
%resolve-btn
{
":note-id"
=>
note
.
id
,
":resolved"
=>
"false"
,
"inline-template"
=>
true
,
"v-ref:note_#{note.id}"
=>
true
}
%button
.note-action-button.line-resolve-btn
{
type:
"button"
,
":class"
=>
"{ 'is-active': isResolved }"
,
":aria-label"
=>
"buttonText"
,
"@click"
=>
"resolve"
,
":title"
=>
"buttonText"
}
=
icon
(
"check"
)
%resolve-btn
{
":endpoint"
=>
"'#{resolve_namespace_project_note_path(note.project.namespace, note.project, note)}'"
,
":note-id"
=>
note
.
id
,
":resolved"
=>
"false"
,
"inline-template"
=>
true
,
"v-ref:note_#{note.id}"
=>
true
}
.note-action-button
=
icon
(
"spin spinner"
,
"v-show"
=>
"loading"
)
%button
.line-resolve-btn
{
type:
"button"
,
":class"
=>
"{ 'is-active': isResolved }"
,
":aria-label"
=>
"buttonText"
,
"@click"
=>
"resolve"
,
":title"
=>
"buttonText"
,
"v-show"
=>
"!loading"
,
"v-el:button"
=>
true
}
=
icon
(
"check"
)
-
if
current_user
and
not
note
.
system
=
link_to
'#'
,
title:
'Award Emoji'
,
class:
'note-action-button note-emoji-button js-add-award js-note-emoji'
,
data:
{
position:
'right'
}
do
=
icon
(
'spinner spin'
)
...
...
This diff is collapsed.
Click to expand it.
config/routes.rb
View file @
b550e6ee
...
...
@@ -828,6 +828,7 @@ Rails.application.routes.draw do
member
do
post
:toggle_award_emoji
delete
:delete_attachment
post
:resolve
end
end
...
...
This diff is collapsed.
Click to expand it.
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