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
Léo-Paul Géneau
gitlab-ce
Commits
b550e6ee
Commit
b550e6ee
authored
Jul 04, 2016
by
Phil Hughes
Committed by
Douwe Maan
Jul 24, 2016
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 vue
#= require_directory ./stores
#= require_directory ./stores
#= require_directory ./services
#= require_directory ./components
#= require_directory ./components
$
=>
$
=>
...
...
app/assets/javascripts/line_comments/components/resolve_all.js.coffee
View file @
b550e6ee
@
ResolveAll
=
Vue
.
extend
@
ResolveAll
=
Vue
.
extend
data
:
->
data
:
->
{
comments
:
CommentsStore
.
state
}
comments
:
CommentsStore
.
state
loading
:
false
computed
:
computed
:
resolved
:
->
resolved
:
->
resolvedCount
=
0
resolvedCount
=
0
...
@@ -10,8 +11,18 @@
...
@@ -10,8 +11,18 @@
commentsCount
:
->
commentsCount
:
->
Object
.
keys
(
this
.
comments
).
length
Object
.
keys
(
this
.
comments
).
length
buttonText
:
->
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
:
methods
:
updateAll
:
->
updateAll
:
->
resolveAll
=
!
(
this
.
resolved
is
this
.
commentsCount
)
ids
=
CommentsStore
.
getAllForState
(
this
.
allResolved
)
CommentsStore
.
updateAll
(
resolveAll
)
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
)
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
View file @
b550e6ee
...
@@ -2,22 +2,32 @@
...
@@ -2,22 +2,32 @@
props
:
props
:
noteId
:
Number
noteId
:
Number
resolved
:
Boolean
resolved
:
Boolean
data
:
->
comments
:
CommentsStore
.
state
endpoint
:
String
data
:
->
comments
:
CommentsStore
.
state
loading
:
false
computed
:
computed
:
buttonText
:
->
buttonText
:
->
if
this
.
comments
[
this
.
noteId
]
then
"Mark as un-resolved"
else
"Mark as resolved"
if
this
.
comments
[
this
.
noteId
]
then
"Mark as un-resolved"
else
"Mark as resolved"
isResolved
:
->
this
.
comments
[
this
.
noteId
]
isResolved
:
->
this
.
comments
[
this
.
noteId
]
methods
:
methods
:
updateTooltip
:
->
updateTooltip
:
->
$
(
this
.
$el
)
$
(
this
.
$el
s
.
button
)
.
tooltip
(
'hide'
)
.
tooltip
(
'hide'
)
.
tooltip
(
'fixTitle'
)
.
tooltip
(
'fixTitle'
)
resolve
:
->
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
:
->
compiled
:
->
$
(
this
.
$el
).
tooltip
()
$
(
this
.
$el
s
.
button
).
tooltip
()
destroyed
:
->
destroyed
:
->
CommentsStore
.
delete
(
this
.
noteId
)
CommentsStore
.
delete
(
this
.
noteId
)
created
:
->
created
:
->
...
...
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
:
'/'
app/assets/javascripts/line_comments/stores/comments.js.coffee
View file @
b550e6ee
...
@@ -9,3 +9,8 @@
...
@@ -9,3 +9,8 @@
updateAll
:
(
state
)
->
updateAll
:
(
state
)
->
for
id
,
resolved
of
this
.
state
for
id
,
resolved
of
this
.
state
this
.
update
(
id
,
state
)
if
resolved
isnt
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
app/assets/stylesheets/pages/notes.scss
View file @
b550e6ee
...
@@ -387,7 +387,7 @@ ul.notes {
...
@@ -387,7 +387,7 @@ ul.notes {
.line-resolve-all
{
.line-resolve-all
{
padding
:
10px
;
padding
:
10px
;
border
:
1px
solid
$border-color
;
border
:
1px
solid
$border-color
;
border-radius
:
2px
;
border-radius
:
$border-radius-default
;
.btn
{
.btn
{
margin-right
:
10px
;
margin-right
:
10px
;
...
...
app/controllers/projects/notes_controller.rb
View file @
b550e6ee
...
@@ -66,6 +66,11 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -66,6 +66,11 @@ class Projects::NotesController < Projects::ApplicationController
end
end
end
end
def
resolve
sleep
2
render
nothing:
true
,
status:
200
end
private
private
def
note
def
note
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
b550e6ee
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
#resolve-all-app
{
"v-cloak"
=>
true
}
#resolve-all-app
{
"v-cloak"
=>
true
}
%resolve-all
{
"inline-template"
=>
true
}
%resolve-all
{
"inline-template"
=>
true
}
.line-resolve-all
{
"v-show"
=>
"commentsCount > 0"
}
.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 }}
{{ buttonText }}
%span
.line-resolve-text
%span
.line-resolve-text
{{ resolved }}/{{ commentsCount }} comments resolved
{{ resolved }}/{{ commentsCount }} comments resolved
...
...
app/views/projects/notes/_note.html.haml
View file @
b550e6ee
...
@@ -21,9 +21,11 @@
...
@@ -21,9 +21,11 @@
-
if
access
and
not
note
.
system
-
if
access
and
not
note
.
system
%span
.note-role.hidden-xs
=
access
%span
.note-role.hidden-xs
=
access
-
unless
note
.
system
-
unless
note
.
system
%resolve-btn
{
":note-id"
=>
note
.
id
,
":resolved"
=>
"false"
,
"inline-template"
=>
true
,
"v-ref:note_#{note.id}"
=>
true
}
%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
}
%button
.note-action-button.line-resolve-btn
{
type:
"button"
,
":class"
=>
"{ 'is-active': isResolved }"
,
":aria-label"
=>
"buttonText"
,
"@click"
=>
"resolve"
,
":title"
=>
"buttonText"
}
.note-action-button
=
icon
(
"check"
)
=
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
-
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
=
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'
)
=
icon
(
'spinner spin'
)
...
...
config/routes.rb
View file @
b550e6ee
...
@@ -828,6 +828,7 @@ Rails.application.routes.draw do
...
@@ -828,6 +828,7 @@ Rails.application.routes.draw do
member
do
member
do
post
:toggle_award_emoji
post
:toggle_award_emoji
delete
:delete_attachment
delete
:delete_attachment
post
:resolve
end
end
end
end
...
...
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