summaryrefslogtreecommitdiff
path: root/templates/project/widgets/comments/comments.coffee
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-08-15 14:14:32 +0200
committervarac <varacanero@zeromail.org>2016-08-15 14:14:32 +0200
commit21a91cbc9681a2f3f4615e7e467febf1c8f4f6e6 (patch)
treeef26732b75858c5fb17925bc861f1ee8b4c43bf2 /templates/project/widgets/comments/comments.coffee
parente56e58562bd1972df8e8d386b30175f6b12430ac (diff)
parented5463dce052852a5ace2d11a0265fff2244e60e (diff)
Merge tag 'v1.3.6' into dashing_io
Diffstat (limited to 'templates/project/widgets/comments/comments.coffee')
-rw-r--r--templates/project/widgets/comments/comments.coffee24
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/project/widgets/comments/comments.coffee b/templates/project/widgets/comments/comments.coffee
new file mode 100644
index 0000000..ff659ec
--- /dev/null
+++ b/templates/project/widgets/comments/comments.coffee
@@ -0,0 +1,24 @@
+class Dashing.Comments extends Dashing.Widget
+
+ @accessor 'quote', ->
+ "“#{@get('current_comment')?.body}”"
+
+ ready: ->
+ @currentIndex = 0
+ @commentElem = $(@node).find('.comment-container')
+ @nextComment()
+ @startCarousel()
+
+ onData: (data) ->
+ @currentIndex = 0
+
+ startCarousel: ->
+ setInterval(@nextComment, 8000)
+
+ nextComment: =>
+ comments = @get('comments')
+ if comments
+ @commentElem.fadeOut =>
+ @currentIndex = (@currentIndex + 1) % comments.length
+ @set 'current_comment', comments[@currentIndex]
+ @commentElem.fadeIn()