Small fixes and code refactoring

This commit is contained in:
RainLoop Team 2015-02-16 01:55:59 +04:00
parent e6c712862d
commit 1a85330770
67 changed files with 413 additions and 181 deletions

View file

@ -6,6 +6,7 @@
var
_ = require('_'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
kn = require('Knoin/Knoin'),
@ -37,6 +38,39 @@
return '#/' + sRoute;
};
MenuSettingsAdminView.prototype.onBuild = function (oDom)
{
key('up, down', _.throttle(function (event, handler) {
var
sH = '',
iIndex = -1,
bUp = handler && 'up' === handler.shortcut,
$items = $('.b-admin-menu .e-item', oDom)
;
if (event && $items.length)
{
iIndex = $items.index($items.filter('.selected'));
if (bUp && iIndex > 0)
{
iIndex--;
}
else if (!bUp && iIndex < $items.length - 1)
{
iIndex++;
}
sH = $items.eq(iIndex).attr('href');
if (sH)
{
kn.setHash(sH, false, true);
}
}
}, 200));
};
module.exports = MenuSettingsAdminView;
}());