Skip to content

Commit

Permalink
Finish #13
Browse files Browse the repository at this point in the history
  • Loading branch information
orweinberger committed Mar 12, 2015
2 parents c0d263e + da3ee7b commit 5f1111b
Show file tree
Hide file tree
Showing 12 changed files with 768 additions and 65 deletions.
7 changes: 7 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions www/css/font-awesome.min.css

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,49 @@

.btn {
border-radius: 0;
}

.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}

.btn-circle.btn-lg {
width: 50px;
height: 50px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 25px;
}

.btn-addpocket {
background-color: #dd4b39;
border-color: #d43f3a;

}

.btn-addpocket:hover, .btn-addpocket:focus, .btn-addpocket:active {
background-color: #dd4b39;
border-color: #ac2925;
}

.btn-spend {
background-color: #245269;
border-color: #23527c;

}

.btn-spend:hover, .btn-spend:focus, .btn-spend:active {
background-color: #245269;
border-color: #23527c;
}

.children {
display: inline-block;
}
Binary file added www/fonts/FontAwesome.otf
Binary file not shown.
Binary file added www/fonts/fontawesome-webfont.eot
Binary file not shown.
565 changes: 565 additions & 0 deletions www/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added www/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file added www/fonts/fontawesome-webfont.woff2
Binary file not shown.
1 change: 1 addition & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
Expand Down
203 changes: 139 additions & 64 deletions www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ angular.module('starter.controllers', [])
savings: {
parent: 'root',
name: 'Savings',
hard_ratio: 0.8,
hard_ratio: 0.33,
color: '#8e44ad',
pockets: {
house: {
Expand All @@ -34,7 +34,7 @@ angular.module('starter.controllers', [])
spending: {
parent: 'root',
name: 'Spending',
hard_ratio: 0.2,
hard_ratio: 0.333,
color: '#2c3e50',
pockets: {
'shopping': {
Expand All @@ -53,91 +53,167 @@ angular.module('starter.controllers', [])
hard_ratio: 0.3
}
}
},
testing: {
parent: 'root',
color: '#cccccc',
name: 'testing',
hard_ratio: 0.333
}
}
};
$scope.choosePersona = function (persona) {
if (persona === 'student') {
engine.pockets.create(student, function (err) {
if (err)
throw err;

engine.pockets.create(student).then(function () {
$state.go('tab.pockets');
}).error(function (err) {
if (err) console.log(err);
});

$state.go('tab.pockets');
}
};
})

.controller('pocketsCtrl', function ($scope, $state, $stateParams) {
.controller('settingsCtrl', function ($scope) {
$scope.fee = 0.0001;
$scope.save = function () {
engine.config.set({fee: $scope.fee});
};
})
.controller('pocketsCtrl', function ($scope, $state, $stateParams, $ionicPopup) {
$scope.pocketName = $stateParams.pocketName;
if ($stateParams.pocketName === '')
$scope.pocketName = 'root';
engine.pockets.get({name: $scope.pocketName}, function (err, result) {

engine.pockets.get({name: $scope.pocketName}).then(function (err, result) {
if (err)
throw err;
$scope.pockets = result;
}).error(function (err) {
if (err)
throw err;
});

/*
$scope.pockets = {
parent: null,
name: 'root',
pockets: {
savings: {
parent: 'root',
name: 'Savings',
hard_ratio: 0.33,
color: '#8e44ad',
pockets: {
house: {
name: 'House',
parent: 'savings',
hard_ratio: 0.7
},
tv: {
name: 'TV',
parent: 'savings',
hard_ratio: 0.3
}
}
},
spending: {
parent: 'root',
name: 'Spending',
hard_ratio: 0.333,
color: '#2c3e50',
pockets: {
'shopping': {
parent: 'spending',
name: 'shopping',
hard_ratio: 0.4
},
'cigarettes': {
parent: 'spending',
name: 'cigarettes',
hard_ratio: 0.3
},
rent: {
parent: 'spending',
name: 'Rent',
hard_ratio: 0.3
}
}
},
testing: {
parent: 'root',
color: '#cccccc',
name: 'testing',
hard_ratio: 0.333
}
}
};
*/
$scope.pockets = {
parent: null,
name: 'root',
pockets: {
savings: {
parent: 'root',
name: 'Savings',
hard_ratio: 0.33,
color: '#8e44ad',
pockets: {
house: {
name: 'House',
parent: 'savings',
hard_ratio: 0.7
},
tv: {
name: 'TV',
parent: 'savings',
hard_ratio: 0.3
}
}
},
spending: {
parent: 'root',
name: 'Spending',
hard_ratio: 0.333,
color: '#2c3e50',
pockets: {
'shopping': {
parent: 'spending',
name: 'shopping',
hard_ratio: 0.4
},
'cigarettes': {
parent: 'spending',
name: 'cigarettes',
hard_ratio: 0.3
},
rent: {
parent: 'spending',
name: 'Rent',
hard_ratio: 0.3
}
}
},
testing: {
parent: 'root',
color: '#cccccc',
name: 'testing',
hard_ratio: 0.333
}
}
};
*/

$scope.selectPocket = function (pocketName, hasChildren) {
if (hasChildren)
$state.go('tab.pockets', {pocketName: pocketName});
else
$state.go('tab.pocket-details', {pocketName: pocketName});
};

$scope.addPocket = function () {
$scope.newpocket = {};
var myPopup = $ionicPopup.show({
template: '<div class="list">' +
'<label class="item item-input item-select">' +
'<span class="input-label">Parent</span>' +
'<select ng-model="newpocket.parent">' +
'<option ng-repeat="(key, pocket) in pockets.pockets" value="{{pocket.name}}">{{pocket.name}}</option>' +
'</select>' +
'</label>' +
'<label class="item item-input">' +
'<span class="input-label">Pocket name</span>' +
'<input ng-model="newpocket.name" type="text" placeholder="My new pocket">' +
'</label>' +
'<label class="item item-input">' +
'<span class="input-label">Ratio</span>' +
'<input ng-model="newpocket.ratio" type="number" placeholder="20">' +
'</label>' +
'<label class="item item-input item-select">' +
'<span class="input-label">Importance</span>' +
'<select>' +
'<option value="low">Low</option>' +
'<option value="high">High</option>' +
'</select>' +
'</label>' +
'<label class="item item-input">' +
'<span class="input-label">Limit</span>' +
'<input ng-model="newpocket.limit" type="number" placeholder="1">' +
'</label>' +
'</div>',
title: 'Add a new pocket',
scope: $scope,
buttons: [
{text: 'Cancel'},
{
text: '<b>Add</b>',
type: 'button-positive',
onTap: function (e) {
if (!$scope.newpocket) {
//don't allow the user to close unless he enters wifi password
e.preventDefault();
} else {
return $scope.newpocket;
}
}
}
]
});
myPopup.then(function (res) {
engine.pockets.create($scope.newpocket).then(function () {
//$state.go('')
}).error(function (err) {
if (err)
throw err;
});
});
}
})
.controller('pocketDetailsCtrl', function ($scope, $state, $stateParams) {
$
Expand All @@ -152,7 +228,6 @@ angular.module('starter.controllers', [])
Chats.remove(chat);
}
})

.controller('ChatDetailCtrl', function ($scope, $stateParams, Chats) {
$scope.chat = Chats.get($stateParams.chatId);
})
Expand Down
8 changes: 7 additions & 1 deletion www/templates/tab-pockets.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
{{value.name}}
</div>
<div ng-if="value.pockets" style="height:100%">
<div ng-repeat="(subkey, subpocket) in value.pockets" style="height:100%;width:{{subpocket.hard_ratio*100}}%;border-right:1px solid #000"></div>
<div class="children" ng-repeat="(subkey, subpocket) in value.pockets" style="height:100%;width:{{subpocket.hard_ratio*100}}%;border-right:1px solid #000"></div>
</div>
</div>
</div>
</ion-content>
<div style="position:absolute;bottom:8px; right: 8px;">
<button type="button" ng-click="addPocket()" class="btn btn-primary btn-addpocket btn-circle btn-lg"><i class="fa fa-plus"></i></button>
</div>
<div style="position:absolute;bottom:8px; left: 8px;">
<button type="button" class="btn btn-primary btn-spend btn-circle btn-lg"><i class="fa fa-bitcoin"></i></button>
</div>
</ion-view>

0 comments on commit 5f1111b

Please sign in to comment.