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
43131802
Commit
43131802
authored
Jul 13, 2016
by
Phil Hughes
Committed by
Douwe Maan
Jul 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VueJS resource
parent
4af0146f
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
28 deletions
+48
-28
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
+3
-5
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
...avascripts/line_comments/components/resolve_btn.js.coffee
+4
-7
app/assets/javascripts/line_comments/services/resolve.js.coffee
...sets/javascripts/line_comments/services/resolve.js.coffee
+31
-14
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-1
vendor/assets/javascripts/vue-resource.js
vendor/assets/javascripts/vue-resource.js
+7
-0
No files found.
app/assets/javascripts/line_comments/application.js.coffee
View file @
43131802
#= require vue
#= require vue-resource
#= require_directory ./stores
#= require_directory ./services
#= require_directory ./components
...
...
app/assets/javascripts/line_comments/components/resolve_all.js.coffee
View file @
43131802
...
...
@@ -3,7 +3,7 @@
comments
:
CommentsStore
.
state
loading
:
false
props
:
endpoint
:
String
namespace
:
String
computed
:
resolved
:
->
resolvedCount
=
0
...
...
@@ -22,8 +22,6 @@
this
.
loading
=
true
ResolveService
.
resolveAll
(
this
.
endpoint
,
ids
,
!
this
.
allResolved
)
.
done
=>
CommentsStore
.
updateAll
(
!
this
.
allResolved
)
.
always
=>
.
resolveAll
(
this
.
namespace
,
ids
,
!
this
.
allResolved
)
.
then
=>
this
.
loading
=
false
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
View file @
43131802
...
...
@@ -2,7 +2,7 @@
props
:
noteId
:
Number
resolved
:
Boolean
endpoint
:
String
namespace
:
String
data
:
->
comments
:
CommentsStore
.
state
loading
:
false
...
...
@@ -18,13 +18,10 @@
resolve
:
->
this
.
loading
=
true
ResolveService
.
resolve
(
this
.
endpoint
,
!
this
.
isResolved
)
.
done
=>
CommentsStore
.
update
(
this
.
noteId
,
!
this
.
isResolved
)
this
.
$nextTick
this
.
updateTooltip
.
always
=>
.
resolve
(
this
.
namespace
,
this
.
noteId
,
!
this
.
isResolved
)
.
then
=>
this
.
loading
=
false
this
.
$nextTick
this
.
updateTooltip
compiled
:
->
$
(
this
.
$els
.
button
).
tooltip
()
destroyed
:
->
...
...
app/assets/javascripts/line_comments/services/resolve.js.coffee
View file @
43131802
@
ResolveService
=
resolve
:
(
endpoint
,
resolve
)
->
$
.
ajax
data
:
resolved
:
resolve
type
:
'post'
url
:
endpoint
resolveAll
:
(
endpoint
,
ids
,
resolve
)
->
$
.
ajax
data
:
id
:
ids
resolve
:
resolve
type
:
'post'
url
:
endpoint
class
ResolveService
constructor
:
->
actions
=
{
resolve
:
method
:
'POST'
url
:
'notes{/id}/resolve'
all
:
method
:
'POST'
url
:
'notes/resolve_all'
}
Vue
.
http
.
headers
.
common
[
'X-CSRF-Token'
]
=
$
.
rails
.
csrfToken
()
@
resource
=
Vue
.
resource
(
'notes{/id}'
,
{},
actions
)
resolve
:
(
namespace
,
id
,
resolve
)
->
Vue
.
http
.
options
.
root
=
"/
#{
namespace
}
"
@
resource
.
resolve
({
id
:
id
},
{
resolved
:
resolve
})
.
then
(
response
)
->
if
response
.
status
is
200
CommentsStore
.
update
(
id
,
resolve
)
resolveAll
:
(
namespace
,
ids
,
resolve
)
->
Vue
.
http
.
options
.
root
=
"/
#{
namespace
}
"
@
resource
.
all
({},
{
ids
:
ids
,
resolve
:
resolve
})
.
then
(
response
)
->
CommentsStore
.
updateAll
(
resolve
)
$
->
@
ResolveService
=
new
ResolveService
()
app/views/projects/merge_requests/_show.html.haml
View file @
43131802
...
...
@@ -46,7 +46,7 @@
-
if
current_user
#resolve-all-app
{
"v-cloak"
=>
true
}
%resolve-all
{
":
endpoint"
=>
"'#{resolve_all_namespace_project_notes_path(@project.namespace, @project)
}'"
,
"inline-template"
=>
true
}
%resolve-all
{
":
namespace"
=>
"'#{@project.namespace.path}/#{@project.path
}'"
,
"inline-template"
=>
true
}
.line-resolve-all
{
"v-show"
=>
"commentsCount > 0"
}
%button
.btn.btn-gray
{
type:
"button"
,
"aria-label"
=>
"Resolve all"
,
"@click"
=>
"updateAll"
,
":disabled"
=>
"loading"
}
=
icon
(
"spinner spin"
,
"v-show"
=>
"loading"
)
...
...
app/views/projects/notes/_note.html.haml
View file @
43131802
...
...
@@ -21,7 +21,7 @@
-
if
access
and
not
note
.
system
%span
.note-role.hidden-xs
=
access
-
if
!
note
.
system
&&
current_user
%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
}
%resolve-btn
{
":
namespace"
=>
"'#{note.project.namespace.path}/#{note.project.path
}'"
,
":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
}
...
...
vendor/assets/javascripts/vue-resource.js
0 → 100644
View file @
43131802
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