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
Tatuya Kamada
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
#= require vue-resource
#= require_directory ./stores
#= require_directory ./stores
#= require_directory ./services
#= require_directory ./services
#= require_directory ./components
#= require_directory ./components
...
...
app/assets/javascripts/line_comments/components/resolve_all.js.coffee
View file @
43131802
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
comments
:
CommentsStore
.
state
comments
:
CommentsStore
.
state
loading
:
false
loading
:
false
props
:
props
:
endpoint
:
String
namespace
:
String
computed
:
computed
:
resolved
:
->
resolved
:
->
resolvedCount
=
0
resolvedCount
=
0
...
@@ -22,8 +22,6 @@
...
@@ -22,8 +22,6 @@
this
.
loading
=
true
this
.
loading
=
true
ResolveService
ResolveService
.
resolveAll
(
this
.
endpoint
,
ids
,
!
this
.
allResolved
)
.
resolveAll
(
this
.
namespace
,
ids
,
!
this
.
allResolved
)
.
done
=>
.
then
=>
CommentsStore
.
updateAll
(
!
this
.
allResolved
)
.
always
=>
this
.
loading
=
false
this
.
loading
=
false
app/assets/javascripts/line_comments/components/resolve_btn.js.coffee
View file @
43131802
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
props
:
props
:
noteId
:
Number
noteId
:
Number
resolved
:
Boolean
resolved
:
Boolean
endpoint
:
String
namespace
:
String
data
:
->
data
:
->
comments
:
CommentsStore
.
state
comments
:
CommentsStore
.
state
loading
:
false
loading
:
false
...
@@ -18,13 +18,10 @@
...
@@ -18,13 +18,10 @@
resolve
:
->
resolve
:
->
this
.
loading
=
true
this
.
loading
=
true
ResolveService
ResolveService
.
resolve
(
this
.
endpoint
,
!
this
.
isResolved
)
.
resolve
(
this
.
namespace
,
this
.
noteId
,
!
this
.
isResolved
)
.
done
=>
.
then
=>
CommentsStore
.
update
(
this
.
noteId
,
!
this
.
isResolved
)
this
.
$nextTick
this
.
updateTooltip
.
always
=>
this
.
loading
=
false
this
.
loading
=
false
this
.
$nextTick
this
.
updateTooltip
compiled
:
->
compiled
:
->
$
(
this
.
$els
.
button
).
tooltip
()
$
(
this
.
$els
.
button
).
tooltip
()
destroyed
:
->
destroyed
:
->
...
...
app/assets/javascripts/line_comments/services/resolve.js.coffee
View file @
43131802
@
ResolveService
=
class
ResolveService
resolve
:
(
endpoint
,
resolve
)
->
constructor
:
->
$
.
ajax
actions
=
{
data
:
resolve
:
resolved
:
resolve
method
:
'POST'
type
:
'post'
url
:
'notes{/id}/resolve'
url
:
endpoint
all
:
resolveAll
:
(
endpoint
,
ids
,
resolve
)
->
method
:
'POST'
$
.
ajax
url
:
'notes/resolve_all'
data
:
}
id
:
ids
resolve
:
resolve
Vue
.
http
.
headers
.
common
[
'X-CSRF-Token'
]
=
$
.
rails
.
csrfToken
()
type
:
'post'
@
resource
=
Vue
.
resource
(
'notes{/id}'
,
{},
actions
)
url
:
endpoint
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 @@
...
@@ -46,7 +46,7 @@
-
if
current_user
-
if
current_user
#resolve-all-app
{
"v-cloak"
=>
true
}
#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"
}
.line-resolve-all
{
"v-show"
=>
"commentsCount > 0"
}
%button
.btn.btn-gray
{
type:
"button"
,
"aria-label"
=>
"Resolve all"
,
"@click"
=>
"updateAll"
,
":disabled"
=>
"loading"
}
%button
.btn.btn-gray
{
type:
"button"
,
"aria-label"
=>
"Resolve all"
,
"@click"
=>
"updateAll"
,
":disabled"
=>
"loading"
}
=
icon
(
"spinner spin"
,
"v-show"
=>
"loading"
)
=
icon
(
"spinner spin"
,
"v-show"
=>
"loading"
)
...
...
app/views/projects/notes/_note.html.haml
View file @
43131802
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
-
if
access
and
not
note
.
system
-
if
access
and
not
note
.
system
%span
.note-role.hidden-xs
=
access
%span
.note-role.hidden-xs
=
access
-
if
!
note
.
system
&&
current_user
-
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
.note-action-button
=
icon
(
"spin spinner"
,
"v-show"
=>
"loading"
)
=
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
}
%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