Rename functions
This commit is contained in:
parent
f53a40a307
commit
5e33b19b0e
4 changed files with 24 additions and 55 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
<ion-modal-view>
|
<ion-modal-view ng-controller="amazonCardDetailsController">
|
||||||
<ion-header-bar align-title="center" class="tab-bar">
|
<ion-header-bar align-title="center" class="tab-bar">
|
||||||
<button class="button button-clear button-positive"
|
<button class="button button-clear button-positive"
|
||||||
ng-click="closeModal()">
|
ng-click="cancel()">
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
<h1 class="title">Details</h1>
|
<h1 class="title">Details</h1>
|
||||||
</ion-header-bar>
|
</ion-header-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="amazonCardDetailsController">
|
<ion-content>
|
||||||
|
|
||||||
<div class="header-modal text-center">
|
<div class="header-modal text-center">
|
||||||
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()">
|
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('amazonController',
|
angular.module('copayApp.controllers').controller('amazonController',
|
||||||
function($scope, $timeout, $log, lodash, bwcError, amazonService, platformInfo, nodeWebkit, modalService) {
|
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, nodeWebkit) {
|
||||||
|
|
||||||
if (platformInfo.isCordova && StatusBar.isVisible) {
|
if (platformInfo.isCordova && StatusBar.isVisible) {
|
||||||
StatusBar.backgroundColorByHexString("#4B6178");
|
StatusBar.backgroundColorByHexString("#4B6178");
|
||||||
|
|
@ -82,11 +82,12 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
var self = this;
|
var self = this;
|
||||||
$scope.card = card;
|
$scope.card = card;
|
||||||
|
|
||||||
modalService
|
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
||||||
.popup('views/modals/amazon-card-details.html', $scope)
|
scope: $scope
|
||||||
.then(function(modal) {
|
}).then(function(modal) {
|
||||||
modal.show();
|
$scope.amazonCardDetailsModal = modal;
|
||||||
});
|
$scope.amazonCardDetailsModal.show();
|
||||||
|
});
|
||||||
|
|
||||||
$scope.$on('UpdateAmazonList', function(event) {
|
$scope.$on('UpdateAmazonList', function(event) {
|
||||||
self.init();
|
self.init();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
||||||
remove: true
|
remove: true
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
$scope.$emit('UpdateAmazonList');
|
$scope.$emit('UpdateAmazonList');
|
||||||
$scope.closeModal();
|
$scope.cancel();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -59,4 +59,8 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$scope.amazonCardDetailsModal.hide();
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,17 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').service('modalService', function($rootScope, $log, $ionicModal, $ionicPopup, platformInfo) {
|
angular.module('copayApp.services').service('popupService', function($log, $ionicPopup, platformInfo) {
|
||||||
|
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
var _modalIonic = function(tpl, scope) {
|
/*************** Ionic ****************/
|
||||||
var promise;
|
|
||||||
scope = scope || $rootScope.$new();
|
|
||||||
|
|
||||||
promise = $ionicModal.fromTemplateUrl(tpl, {
|
|
||||||
scope: scope
|
|
||||||
}).then(function(modal) {
|
|
||||||
scope.modal = modal;
|
|
||||||
return modal;
|
|
||||||
});
|
|
||||||
|
|
||||||
scope.openModal = function() {
|
|
||||||
scope.modal.show();
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.closeModal = function() {
|
|
||||||
scope.modal.hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.$on('$destroy', function() {
|
|
||||||
scope.modal.remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
var _ionicAlert = function(title, message, cb) {
|
var _ionicAlert = function(title, message, cb) {
|
||||||
if (!cb) cb = function() {};
|
if (!cb) cb = function() {};
|
||||||
var promise = $ionicPopup.alert({
|
$ionicPopup.alert({
|
||||||
title: title,
|
title: title,
|
||||||
template: message
|
template: message
|
||||||
}).then(cb);
|
}).then(cb);
|
||||||
|
|
||||||
return promise;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var _ionicConfirm = function(title, message, cb) {
|
var _ionicConfirm = function(title, message, cb) {
|
||||||
|
|
@ -60,6 +35,8 @@ angular.module('copayApp.services').service('modalService', function($rootScope,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*************** Cordova ****************/
|
||||||
|
|
||||||
var _cordovaAlert = function(title, message, cb) {
|
var _cordovaAlert = function(title, message, cb) {
|
||||||
if (!cb) cb = function() {};
|
if (!cb) cb = function() {};
|
||||||
navigator.notification.alert(message, cb, title);
|
navigator.notification.alert(message, cb, title);
|
||||||
|
|
@ -75,7 +52,7 @@ angular.module('copayApp.services').service('modalService', function($rootScope,
|
||||||
|
|
||||||
var _cordovaPrompt = function(title, message, cb) {
|
var _cordovaPrompt = function(title, message, cb) {
|
||||||
var onPrompt = function (results) {
|
var onPrompt = function (results) {
|
||||||
if (results.buttonIndex) return cb(results.input1);
|
if (results.buttonIndex == 1) return cb(results.input1);
|
||||||
else return cb();
|
else return cb();
|
||||||
}
|
}
|
||||||
navigator.notification.prompt(message, onPrompt, title);
|
navigator.notification.prompt(message, onPrompt, title);
|
||||||
|
|
@ -86,8 +63,7 @@ angular.module('copayApp.services').service('modalService', function($rootScope,
|
||||||
*
|
*
|
||||||
* @param {String} Title
|
* @param {String} Title
|
||||||
* @param {String} Message
|
* @param {String} Message
|
||||||
* @param {Callback} Function
|
* @param {Callback} Function (optional)
|
||||||
* @returns {Promise}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.showAlert = function(title, msg, cb) {
|
this.showAlert = function(title, msg, cb) {
|
||||||
|
|
@ -123,7 +99,7 @@ angular.module('copayApp.services').service('modalService', function($rootScope,
|
||||||
*
|
*
|
||||||
* @param {String} Title
|
* @param {String} Title
|
||||||
* @param {String} Message
|
* @param {String} Message
|
||||||
* @param {Object} Object{ inputType, inputPlaceholder }
|
* @param {Object} Object{ inputType, inputPlaceholder } (optional)
|
||||||
* @param {Callback} Function
|
* @param {Callback} Function
|
||||||
* @returns {Callback} Return the value of the input if user presses OK
|
* @returns {Callback} Return the value of the input if user presses OK
|
||||||
*/
|
*/
|
||||||
|
|
@ -137,17 +113,5 @@ angular.module('copayApp.services').service('modalService', function($rootScope,
|
||||||
_ionicPrompt(title, message, opts, cb);
|
_ionicPrompt(title, message, opts, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Show a modal popup
|
|
||||||
*
|
|
||||||
* @param {String} TemplateURL
|
|
||||||
* @param {Object} Scope
|
|
||||||
* @returns {Promise}
|
|
||||||
*/
|
|
||||||
|
|
||||||
this.showModal = function(tpl, scope) {
|
|
||||||
return _modalIonic(tpl, scope);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue