Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
[refactor] Simplifying code
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonfraga committed Nov 28, 2016
1 parent 63d5feb commit 4ec6493
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions interface/client/lib/helpers/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ Selects previous or next tab (offset +1 or -1)
@method selectTabWithOffset
*/
Helpers.selectTabWithOffset = function (offset) {
var tabList, selectedTab, currentTabIndex, newTabIndex;
var tabList;
var currentTabIndex;
var newTabIndex;

if (Math.abs(offset) !== 1) {
return;
}
selectedTab = LocalStore.get('selectedTab');
tabList = _.pluck(Tabs.find({}, { sort: { position: 1 }, fields: { _id: 1 } }).fetch(), '_id');
currentTabIndex = tabList.indexOf(selectedTab);
currentTabIndex = tabList.indexOf(LocalStore.get('selectedTab'));

newTabIndex = (currentTabIndex + offset) % tabList.length;
if (newTabIndex < 0) newTabIndex = tabList.length - 1;

LocalStore.set('selectedTab', tabList[newTabIndex]);
console.log(currentTabIndex, newTabIndex);
};

/**
Expand Down

0 comments on commit 4ec6493

Please sign in to comment.