From c66ddb7dbe763b261c7dd4a037239a667f60cd95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 13 Jun 2013 12:17:49 +0200 Subject: [PATCH] history wip: little animation on adding new item --- modules/documentHistory/documentHistory.js | 11 +++++++---- modules/rng/rng.js | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/documentHistory/documentHistory.js b/modules/documentHistory/documentHistory.js index c90c879..0db2a75 100644 --- a/modules/documentHistory/documentHistory.js +++ b/modules/documentHistory/documentHistory.js @@ -15,11 +15,14 @@ return function(sandbox) { } var itemViews = []; - var addHistoryItem = function(item) { + var addHistoryItem = function(item, options) { historyItems.add(item); var view = new itemView(item); itemViews.push(view); domNodes.itemList.prepend(view.dom); + if(options.animate) { + view.dom.hide().slideDown(); + } } var toggleItemViews = function(toggle) { @@ -80,10 +83,10 @@ return function(sandbox) { return { - start: function() { sandbox.publish('ready'); }, - addHistory: function(history) { + start: function() { sandbox.publish('ready'); }, + addHistory: function(history, options) { history.forEach(function(historyItem) { - addHistoryItem(historyItem); + addHistoryItem(historyItem, options || {}); }); }, getView: function() { diff --git a/modules/rng/rng.js b/modules/rng/rng.js index fe666e0..9abe00c 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -132,7 +132,7 @@ return function(sandbox) { sandbox.getModule('indicator').clearMessage(); }, historyItemAdded: function(item) { - sandbox.getModule('documentHistory').addHistory([item]); + sandbox.getModule('documentHistory').addHistory([item], {animate: true}); } } -- 2.20.1