Skip to content

Commit

Permalink
button indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
mgasner committed Nov 10, 2017
1 parent 3d9f620 commit 1f22450
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 96 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"angular": "^1.6.6",
"angular-local-storage": "~0.7.1",
"angular-promise-buttons": "^0.1.21",
"angular-resource": "~1.6.6",
"angular-spinner": "^1.0.1",
"express": "~4.4.3"
Expand Down
1 change: 1 addition & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<script src="lib/ionic/js/angular/angular-resource.js"></script>
<script src="js/angular-local-storage.js"></script>
<script src="lib/angular-spinner.js"></script>
<script src="lib/angular-promise-buttons.js"></script>

<script src="lib/lodash.js"></script>

Expand Down
1 change: 1 addition & 0 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module(
'treephone.controllers',
'treephone.services',
'LocalStorageModule',
'angularPromiseButtons',
'angularSpinner'])

.run(function($ionicPlatform) {
Expand Down
31 changes: 20 additions & 11 deletions www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ angular.module('treephone.controllers', [])
$scope.rpc = Rpc;
$scope.submitLogin = function(login) {
Auth.setPhoneNumber(login.tel);
$http.post(
return $http.post(
api_root + '/tfa',
{'phone_number': login.tel})
.then(
Expand All @@ -25,7 +25,7 @@ angular.module('treephone.controllers', [])
function($scope, $location, $http, Rpc, Auth, Friends, api_root) {
$scope.rpc = Rpc;
$scope.submitTfa = function (tfa) {
$http.post(
return $http.post(
api_root + '/sessions',
{'tfa': tfa.code})
.then(
Expand All @@ -42,7 +42,16 @@ angular.module('treephone.controllers', [])
});
};
$scope.resendTfa = function () {
$location.path('/login');
return $http.post(
api_root + '/tfa',
{'phone_number': Auth.getPhoneNumber()})
.then(
function (response) {
$location.path('/tfa')
},
function (response) {
$location.path('/tfa')
});
};
})

Expand All @@ -64,7 +73,7 @@ angular.module('treephone.controllers', [])

$scope.addContact = function (contact) {
console.log(next);
Friends.add(contact, Auth.getUserId()).then(
return Friends.add(contact, Auth.getUserId()).then(
function (contact) {
Friends.editing = contact.uid;
console.log(next);
Expand All @@ -78,7 +87,7 @@ angular.module('treephone.controllers', [])
console.log('editing...');
contact.uid = Friends.editing;
console.log(contact)
Friends.edit(contact).then(
return Friends.edit(contact).then(
function () { $location.path(next); },
// TODO should pop a modal
function () { return; }
Expand All @@ -95,7 +104,7 @@ angular.module('treephone.controllers', [])
$scope.rpc = Rpc;

console.log('getting user...');
Friends.get(Auth.getUserId()).then(
return Friends.get(Auth.getUserId()).then(
function (user) {
console.log(user);
$scope.user = user;},
Expand All @@ -105,14 +114,14 @@ angular.module('treephone.controllers', [])
})

.controller('FriendsCtrl', function($scope, Auth, Friends) {
Friends.children(Auth.getUserId()).then(
return Friends.children(Auth.getUserId()).then(
function (friends){ $scope.friends = friends; },
function () { $scope.friends = []; });
})

.controller('FriendDetailCtrl', function($scope, $stateParams, Friends) {
$scope.invite = function () {
Friends.invite($stateParams.friendId);
return Friends.invite($stateParams.friendId);
// TODO: pop up a modal
}
Friends.get($stateParams.friendId).then(
Expand Down Expand Up @@ -151,7 +160,7 @@ angular.module('treephone.controllers', [])

.controller('AccountDetailCtrl', function ($scope, $location, Auth, Friends) {
$scope.editContact = function (contact) {
Friends.edit(contact).then(
return Friends.edit(contact).then(
function () { $location.path('/tab/account'); },
function () { $location.path('/tab/account'); }
)
Expand All @@ -169,7 +178,7 @@ angular.module('treephone.controllers', [])

.controller('DeleteCtrl', function ($scope, $location, Auth, Friends) {
$scope.delete = function () {
Friends.delete(Auth.getUserId()).then(
return Friends.delete(Auth.getUserId()).then(
function () { $location.path('/login'); },
function () { $location.path('/login'); }
)
Expand All @@ -180,7 +189,7 @@ angular.module('treephone.controllers', [])

.controller('CsvCtrl', function ($scope, $location, Auth, Friends) {
$scope.requestCsv = function (contact) {
Friends.edit(contact).then(
return Friends.edit(contact).then(
function () { Friends.csv(contact.uid).then(
function () { $location.path('/tab/account'); },
function () { $location.path('/tab/account'); }
Expand Down
5 changes: 3 additions & 2 deletions www/templates/account-detail.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ion-view title="Edit Profile" cache-view="false">
<ion-content class="padding">
<form ng-submit="editContact(contact)">
<form ng-submit="editContact(contact)"
promise-btn>
<small><strong>Name</strong></small>
<label class="item item-input">
<input type="text" placeholder="First"
Expand Down Expand Up @@ -28,7 +29,7 @@
<input type="tel" placeholder="Zip" ng-model="contact.zip_code">
</label><br/>
<input type="hidden" ng-model="contact.uid">
<button ion-button round>Save</button>
<button type="submit" ion-button round>Save</button>
</form>
</ion-content>
</ion-view>
4 changes: 2 additions & 2 deletions www/templates/delete-confirm.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<ion-view title="Confirm Delete">
<ion-content class="padding">
<form ng-submit="delete()">
<form ng-submit="delete()" promise-btn>
<strong>Confirm you want to delete your account</strong><br />
<button ion-button round>Delete</button> <br />
<button ion-button round type="submit">Delete</button> <br />
<button type="button" ion-button round ng-click="cancel();">Never mind</button>
</form>
</ion-content>
Expand Down
6 changes: 3 additions & 3 deletions www/templates/friend-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ion-item>
<small><strong>Address</strong></small><br />
{{friend.address_1}}<br />
{{friend.address_2 || ""}}<br />
{{friend.address_2 === "None" ? '' : friend.address_2}}<br />
{{friend.city}}, {{friend.state}} {{friend.zip_code}}
</ion-item>
<ion-item>
Expand All @@ -26,8 +26,8 @@
</ion-list>
<h4>{{friend.first_name}} has {{friend.outdegree}} direct contacts
and {{friend.network_size}} people in their network.</h4>
<form ng-submit="invite()">
<button ion-button round>Resend invite</button> <br />
<form ng-submit="invite()" promise-btn>
<button ion-button round type="submit">Resend invite</button> <br />
</form>
</ion-content>
</ion-view>
5 changes: 3 additions & 2 deletions www/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<ion-content class="padding">
<h3>Please enter your phone number</h3>
<p>We'll text you a code you can use to log in.</p>
<form ng-submit="submitLogin(login)">
<form ng-submit="submitLogin(login)"
promise-btn>
<label class="item item-input">
<input type="tel" placeholder="XXX-XXX-XXXX" ng-model="login.tel">
</label><br/>
<button ion-button round>{{rpc.pending ? '...' : 'Get Code'}}</button>
<button type="submit" ion-button round>{{rpc.pending ? '...' : 'Get Code'}}</button>
</form>
</ion-content>
</ion-view>
4 changes: 2 additions & 2 deletions www/templates/send-csv.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view title="Export Contacts">
<ion-content class="padding">
<form ng-submit="requestCsv(contact)">
<form ng-submit="requestCsv(contact)" promise-btn>
<strong>Confirm you'd like us to send your contacts as a .csv to the
following email address.</strong> If this doesn't look right, you
can change your email address on file below.<br />
Expand All @@ -9,7 +9,7 @@
ng-model="contact.email_address">
</label><br/>
<input type="hidden" ng-model="contact.uid">
<button ion-button round>Confirm</button><br />
<button ion-button round type="submit">Confirm</button><br />
<button type="button" ion-button round ng-click="cancel();">Cancel</button>
</form>
</ion-content>
Expand Down
4 changes: 2 additions & 2 deletions www/templates/tab-add-1.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view title="Add Contact" cache-view="false">
<ion-content class="padding">
<form ng-submit="addContact(contact)">
<form ng-submit="addContact(contact)" promise-btn>
<small><strong>Name</strong></small>
<label class="item item-input">
<input type="text" placeholder="First"
Expand All @@ -24,7 +24,7 @@
ng-model="contact.email_address"
id="phone_number">
</label><br />
<button ion-button round>{{ rpc.pending ? '...' : 'Next' }}</button>
<button ion-button round type="submit">Next</button>
</form>
</ion-content>
</ion-view>
4 changes: 2 additions & 2 deletions www/templates/tab-add-2.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view title="Add Contact" cache-view="false">
<ion-content class="padding">
<form ng-submit="editContact(contact)">
<form ng-submit="editContact(contact)" promise-btn>
<small><strong>Address</strong></small>
<label class="item item-input">
<input type="text" placeholder="Address Line 1"
Expand Down Expand Up @@ -28,7 +28,7 @@
ng-maxlength="5"
size="5">
</label><br/>
<button ion-button round>{{ rpc.pending ? '...' : 'Next' }}</button>
<button ion-button round type="submit">Next</button>
</form>
</ion-content>
</ion-view>
4 changes: 2 additions & 2 deletions www/templates/tab-add-3.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<ion-view title="Add Contact" cache-view="false">
<ion-content class="padding">
<small><strong>Notes</strong></small><br />
<form ng-submit="editContact(contact)" id="notes">
<form ng-submit="editContact(contact)" id="notes" promise-btn>
<textarea style="background-color: #eeeeee; width: 100%;" form ="notes" rows="10" wrap="soft" ng-model="contact.freeform_notes"></textarea>
<button ion-button round>{{ rpc.pending ? '...' : 'Save' }}</button>
<button ion-button round type="submit">{{ rpc.pending ? '...' : 'Save' }}</button>
</form>
</ion-content>
</ion-view>
64 changes: 0 additions & 64 deletions www/templates/tab-add.html

This file was deleted.

8 changes: 4 additions & 4 deletions www/templates/tfa.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<ion-view title="YIMBY!">
<ion-content class="padding">
<h3>Please enter the six-digit code we texted you</h3>
<form ng-submit="submitTfa(tfa)">
<form ng-submit="submitTfa(tfa)" promise-btn>
<label class="item item-input">
<input type="tel" placeholder="XXXXXXX" ng-model="tfa.code">
</label><br />
<button ion-button round>{{rpc.pending ? '...' : 'Verify' }}</button>
<button type="submit" ion-button round>Verify</button>
</form><br />
<form ng-submit="resendTfa()">
<form ng-submit="resendTfa()" promise-btn>
<label class="item item-button">
<small>Didn't get a code?</small>
<button ion-button round small>Resend</button>
<button type="submit" ion-button round small>Resend</button>
</label>
</form>
</ion-content>
Expand Down

0 comments on commit 1f22450

Please sign in to comment.