Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
handle clicks nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Jan 26, 2016
1 parent f2461de commit 66362de
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 21 deletions.
12 changes: 10 additions & 2 deletions lib/events/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@

/** Adding/Editing Events **/

$scope.addEvent = function() {
$scope.addEvent = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
EditEvent.open();
};

Expand Down Expand Up @@ -337,7 +341,11 @@
});
};

$scope.goToNow = function() {
$scope.goToNow = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
$timeout(function() {
var id, nextEvent = EventService.getNextEvent($scope.events);
$log.debug('next event=' + angular.toJson(nextEvent));
Expand Down
12 changes: 10 additions & 2 deletions lib/events/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@
}
};

$scope.saveEvent = function() {
$scope.saveEvent = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
$log.debug('CMEditEventCtrl.saveEvent: ' + angular.toJson($scope.eventData));

var username = UserService.getUsername();
Expand Down Expand Up @@ -189,7 +193,11 @@
$scope.modal.resolve(modal);
});

$scope.closeEditEvent = function() {
$scope.closeEditEvent = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
return $scope.modal.promise.then(function(modal) {
return $q.all([
$scope.closeKeyboard(),
Expand Down
2 changes: 1 addition & 1 deletion lib/events/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<h1 class="title">{{eventData.id? 'Edit':'Add an'}} Event</h1>
<div class="buttons">
<button class="button button-clear button-yellow" ng-click="saveEvent()" ng-disabled="form.$invalid || !eventData.isValid()">{{eventData.id? 'Save':'Add'}}</button>
<button class="button button-clear button-yellow" ng-click="saveEvent($event)" ng-disabled="form.$invalid || !eventData.isValid()">{{eventData.id? 'Save':'Add'}}</button>
</div>
</ion-header-bar>

Expand Down
4 changes: 2 additions & 2 deletions lib/events/list.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<ion-view class="event-list searchable">
<ion-nav-buttons side="primary">
<button class="button button-icon icon-yellow cm-icon-clock" ng-click="goToNow()"></button>
<button class="button button-icon icon-yellow cm-icon-clock" ng-click="goToNow($event)"></button>
</ion-nav-buttons>
<ion-nav-title ng-click="openEventTypePopover($event)" class="event-title">
<span>{{eventType.capitalize()}} Events <span style="font-size: x-small">&#9660;</span></span>
</ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button button-icon icon-yellow cm-icon-plus" ng-click="addEvent()" ng-if="u.loggedIn()"></button>
<button class="button button-icon icon-yellow cm-icon-plus" ng-click="addEvent($event)" ng-if="u.loggedIn()"></button>
<button class="button button-icon icon cm-icon-search" ng-click="showFilterBar()"></button>
</ion-nav-buttons>
<ion-content ion-sticky scroll="true" padding="false" id="event-content" delegate-handle="event-scroll" ng-click="closeKeyboard()">
Expand Down
6 changes: 5 additions & 1 deletion lib/images/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
});
};

$scope.closeModal = function() {
$scope.closeModal = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
$scope.modal.promise.then(function(modal) {
modal.hide().then(function() {
delete $scope.twitarrRoot;
Expand Down
2 changes: 1 addition & 1 deletion lib/images/viewer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-modal-view class="image-viewer">
<ion-header-bar class="bar-dark">
<div class="buttons">
<button class="button button-yellow button-clear" ng-click="closeModal()">Close</button>
<button class="button button-yellow button-clear" ng-click="closeModal($event)">Close</button>
</div>
<h1></h1>
</ion-header-bar>
Expand Down
16 changes: 14 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@
}

modal.scope.showEmoji = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
EmojiService.show(ev).then(function(selected) {
if (modal.scope.tweet.text.length === 0) {
modal.scope.tweet.text += ':' + selected + ':';
Expand Down Expand Up @@ -393,7 +397,11 @@
}, onError);
};

modal.scope.closeModal = function() {
modal.scope.closeModal = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
modal.hide();
};
modal.scope.addPhoto = function() {
Expand All @@ -402,7 +410,11 @@
modal.scope.takePhoto = function() {
doPhoto(Camera.PictureSourceType.CAMERA);
};
modal.scope.postTweet = function(tweet) {
modal.scope.postTweet = function(ev, tweet) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
var tweetCmd = Twitarr.addTweet;
if (tweet.id) {
tweetCmd = Twitarr.updateTweet;
Expand Down
12 changes: 10 additions & 2 deletions lib/seamail/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
scope.selectedIndex=-1;
//$log.debug('additional user: ' + angular.toJson(scope.additionalUser));

scope.removeTag=function(index){
scope.removeTag=function(ev, index){
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
scope.selectedUsers.splice(index,1);
};

Expand Down Expand Up @@ -252,7 +256,11 @@
});
};

$scope.newSeamail = function() {
$scope.newSeamail = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
NewSeamail.open();
};

Expand Down
12 changes: 10 additions & 2 deletions lib/seamail/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
.controller('NewSeamailCtrl', function($ionicPopup, $log, $rootScope, $scope, Twitarr) {
$log.debug('Initializing NewSeamailCtrl.');

$scope.postSeamail = function(message) {
$scope.postSeamail = function(ev, message) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
$log.debug('message=' + angular.toJson(message));
Twitarr.postSeamail(message).then(function() {
$scope.closeModal();
Expand Down Expand Up @@ -45,7 +49,11 @@
$scope.modal.resolve(modal);
});

$scope.closeModal = function() {
$scope.closeModal = function(ev) {
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
$scope.modal.promise.then(function(modal) {
modal.hide().then(function() {
delete $scope.sendTo;
Expand Down
2 changes: 1 addition & 1 deletion lib/seamail/autocomplete-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col col-10">To:</div>
<ion-scroll direction="x" class="col col-90">
<div ng-if="additionalUser" class="tag navy" style="display:inline; padding: 4px 6px;">{{additionalUser}}</div>
<div ng-repeat="selectedUser in selectedUsers" class="tag navy" style="display:inline; padding: 4px 6px;" ng-click="removeTag($index)">{{selectedUser}} <i class="icon ion-close-circled"></i></div>
<div ng-repeat="selectedUser in selectedUsers" class="tag navy" style="display:inline; padding: 4px 6px;" ng-click="removeTag($event, $index)">{{selectedUser}} <i class="icon ion-close-circled"></i></div>
</ion-scroll>
</div>
<div class="row">
Expand Down
4 changes: 2 additions & 2 deletions lib/seamail/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<form name="seamailForm">
<ion-header-bar class="bar-dark">
<div class="buttons">
<button class="button button-clear button-yellow" ng-click="closeModal()">Close</button>
<button class="button button-clear button-yellow" ng-click="closeModal($event)">Close</button>
</div>
<h1 class="title">New Seamail</h1>
<div class="buttons">
<button class="button button-clear button-yellow" ng-click="postSeamail(message)" ng-disabled="form.$invalid">Send</button>
<button class="button button-clear button-yellow" ng-click="postSeamail($event, message)" ng-disabled="form.$invalid">Send</button>
</div>
</ion-header-bar>
<ion-content>
Expand Down
2 changes: 1 addition & 1 deletion lib/seamail/seamails.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ion-view class="seamail" title="Seamails">
<ion-nav-buttons side="secondary">
<button class="button button-icon icon cm-icon-compose" ng-click="newSeamail()" ng-if="user.loggedIn"></button>
<button class="button button-icon icon cm-icon-compose" ng-click="newSeamail($event)" ng-if="user.loggedIn"></button>
</ion-nav-buttons>
<ion-nav-title>
<span ng-click="scrollTop()">Seamails</span>
Expand Down
4 changes: 2 additions & 2 deletions lib/twitarr/edit.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<ion-modal-view ng-class="'fit twitarr'">
<ion-header-bar class="bar-dark">
<div class="buttons">
<button class="button button-clear button-yellow" ng-click="closeModal()">Close</button>
<button class="button button-clear button-yellow" ng-click="closeModal($event)">Close</button>
</div>
<h1 class="title">New Tweet</h1>
<div class="buttons">
<button class="button button-clear button-icon icon cm-icon-send button-yellow" ng-click="postTweet(tweet)" ng-disabled="photoUploading || !tweet.text"></button>
<button class="button button-clear button-icon icon cm-icon-send button-yellow" ng-click="postTweet($event, tweet)" ng-disabled="photoUploading || !tweet.text"></button>
</div>
</ion-header-bar>
<ion-content>
Expand Down

0 comments on commit 66362de

Please sign in to comment.