Skip to content

Commit

Permalink
Introduce tabbed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
schinken committed Nov 30, 2016
1 parent 74f52eb commit b244f50
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
4 changes: 4 additions & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ var settings = {
transaction: 'cash-register.ogg'
},

index: {
tabbed: false
},

/////////////////////////////////////////////////////////////////////////
// payments

Expand Down
24 changes: 19 additions & 5 deletions src/script/lib/controllers/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>
</div>
</div>

<div class="row">
<div class="col-xs-12">
<h3 translate>indexActiveUser</h3>
<ul class="nav nav-tabs" ng-if="mode.tabbed">
<li ng-class="{ 'active': mode.currentTab == 'active' }" ng-click="mode.currentTab = 'active'" >
<a translate>indexActiveUser</a>
</li>
<li ng-class="{ 'active': mode.currentTab == 'inactive' }" ng-click="mode.currentTab = 'inactive'">
<a translate>indexInactiveUser</a>
</li>
</ul>
</div>

<div class="col-xs-12" ng-if="mode.currentTab == 'active' || !mode.tabbed">
<h3 ng-hide="mode.tabbed" translate>indexActiveUser</h3>

<ul class="user-list clearfix">
<li ng-repeat="user in users | filter:isActiveUser | orderBy:'name' track by user.id"
ng-click="userClick(user.id)"
Expand All @@ -17,10 +30,10 @@ <h3 translate>indexActiveUser</h3>
<li class="col-xs-2 panel panel-default create-user" ng-click="createUserClick()">+</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h3 translate>indexInactiveUser</h3>

<div class="col-xs-12" ng-if="mode.currentTab == 'inactive' || !mode.tabbed">
<h3 ng-hide="mode.tabbed" translate>indexInactiveUser</h3>

<ul class="user-list clearfix">
<li ng-repeat="user in users | filter:isInactiveUser | orderBy:'name' track by user.id"
ng-click="userClick(user.id)"
Expand All @@ -32,4 +45,5 @@ <h3 translate>indexInactiveUser</h3>
<li class="col-xs-2 panel panel-default create-user" ng-click="createUserClick()">+</li>
</ul>
</div>

</div>
7 changes: 7 additions & 0 deletions src/script/lib/controllers/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ angular

.controller('IndexController', function ($scope, Location, User, Message) {

if (settings.index && settings.index.tabbed) {
$scope.mode = {
tabbed: true,
currentTab: 'active'
};
}

$scope.userClick = function (userId) {
Location.gotoUser(userId);
};
Expand Down

0 comments on commit b244f50

Please sign in to comment.