提交 e28fb834 编写于 作者: P Phil Hughes 提交者: Douwe Maan

Fixed loading icon not working on resovle all buttons

上级 e7626eb0
...@@ -4,16 +4,17 @@ ...@@ -4,16 +4,17 @@
namespace: String namespace: String
data: -> data: ->
comments: CommentsStore.state comments: CommentsStore.state
loadingObject: CommentsStore.loading
computed: computed:
allResolved: -> allResolved: ->
isResolved = true isResolved = true
for noteId, resolved of this.comments[this.discussionId] for noteId, resolved of this.comments[this.discussionId]
unless noteId is "loading" isResolved = false unless resolved
isResolved = false unless resolved
isResolved isResolved
buttonText: -> buttonText: ->
if this.allResolved then "Un-resolve all" else "Resolve all" if this.allResolved then "Un-resolve all" else "Resolve all"
loading: -> this.comments[this.discussionId].loading loading: ->
this.loadingObject[this.discussionId]
methods: methods:
resolve: -> resolve: ->
ResolveService ResolveService
......
...@@ -32,7 +32,7 @@ class ResolveService ...@@ -32,7 +32,7 @@ class ResolveService
for noteId, resolved of CommentsStore.state[discussionId] for noteId, resolved of CommentsStore.state[discussionId]
ids.push(noteId) if resolved is allResolve ids.push(noteId) if resolved is allResolve
CommentsStore.state[discussionId].loading = true CommentsStore.loading[discussionId] = true
@resource @resource
.all({}, { ids: ids, discussion: discussionId, resolved: !allResolve }) .all({}, { ids: ids, discussion: discussionId, resolved: !allResolve })
.then (response) -> .then (response) ->
...@@ -40,6 +40,6 @@ class ResolveService ...@@ -40,6 +40,6 @@ class ResolveService
for noteId in ids for noteId in ids
CommentsStore.update(discussionId, noteId, !allResolve) CommentsStore.update(discussionId, noteId, !allResolve)
CommentsStore.state[discussionId].loading = false CommentsStore.loading[discussionId] = false
@ResolveService = new ResolveService() @ResolveService = new ResolveService()
@CommentsStore = @CommentsStore =
state: {} state: {}
loading: {}
get: (discussionId, noteId) -> get: (discussionId, noteId) ->
this.state[discussionId][noteId] this.state[discussionId][noteId]
create: (discussionId, noteId, resolved) -> create: (discussionId, noteId, resolved) ->
unless this.state[discussionId]? unless this.state[discussionId]?
Vue.set(this.state, discussionId, { loading: false }) Vue.set(this.state, discussionId, {})
Vue.set(this.loading, discussionId, false)
Vue.set(this.state[discussionId], noteId, resolved) Vue.set(this.state[discussionId], noteId, resolved)
update: (discussionId, noteId, resolved) -> update: (discussionId, noteId, resolved) ->
...@@ -14,3 +16,4 @@ ...@@ -14,3 +16,4 @@
if Object.keys(this.state[discussionId]).length is 0 if Object.keys(this.state[discussionId]).length is 0
Vue.delete(this.state, discussionId) Vue.delete(this.state, discussionId)
Vue.delete(this.loading, discussionId)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册