From: Aleksander Ɓukasz Date: Thu, 13 Jun 2013 10:17:49 +0000 (+0200) Subject: history wip: little animation on adding new item X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/c66ddb7dbe763b261c7dd4a037239a667f60cd95?ds=inline history wip: little animation on adding new item --- 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}); } }