From a4a4564f760bb1bcd541366186cd46488d5a569b Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Tue, 30 Oct 2012 05:16:35 -0400 Subject: Added new widgets, and made them more flexible. Ready for 0.1.3! --- templates/project/widgets/comments/comments.coffee | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 templates/project/widgets/comments/comments.coffee (limited to 'templates/project/widgets/comments/comments.coffee') 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 -- cgit v1.2.3 From 5934a2729d93d24e67016dc4dd101c689378ae33 Mon Sep 17 00:00:00 2001 From: Ayrton De Craene Date: Fri, 16 Nov 2012 11:18:06 +0100 Subject: Removes whitespace :scissors: --- templates/project/widgets/comments/comments.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/project/widgets/comments/comments.coffee') diff --git a/templates/project/widgets/comments/comments.coffee b/templates/project/widgets/comments/comments.coffee index 1e81b56..ff659ec 100644 --- a/templates/project/widgets/comments/comments.coffee +++ b/templates/project/widgets/comments/comments.coffee @@ -21,4 +21,4 @@ class Dashing.Comments extends Dashing.Widget @commentElem.fadeOut => @currentIndex = (@currentIndex + 1) % comments.length @set 'current_comment', comments[@currentIndex] - @commentElem.fadeIn() \ No newline at end of file + @commentElem.fadeIn() -- cgit v1.2.3