diff options
author | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-10-30 05:16:35 -0400 |
---|---|---|
committer | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-10-30 05:16:35 -0400 |
commit | a4a4564f760bb1bcd541366186cd46488d5a569b (patch) | |
tree | 3737ae6d233464482482880bd858665866686f10 /templates/project/widgets/comments/comments.coffee | |
parent | 3a77d19282f2055559c63468c574b824138464ac (diff) |
Added new widgets, and made them more flexible. Ready for 0.1.3!
Diffstat (limited to 'templates/project/widgets/comments/comments.coffee')
-rw-r--r-- | templates/project/widgets/comments/comments.coffee | 24 |
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..1e81b56 --- /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()
\ No newline at end of file |