paypro: implement short merchant names in address box and side box.

This commit is contained in:
Christopher Jeffrey 2014-09-08 16:51:37 -07:00
commit 953ff985d8
3 changed files with 35 additions and 5 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.directives')
.directive('validAddress', function() {
.directive('validAddress', ['$rootScope', function($rootScope) {
var bitcore = require('bitcore');
var Address = bitcore.Address;
var bignum = bitcore.Bignum;
@ -11,6 +11,14 @@ angular.module('copayApp.directives')
link: function(scope, elem, attrs, ctrl) {
var validator = function(value) {
// If we're setting the domain, ignore the change.
if ($rootScope.merchant
&& $rootScope.merchant.domain
&& value === $rootScope.merchant.domain) {
ctrl.$setValidity('validAddress', true);
return value;
}
// Regular url
if (/^https?:\/\//.test(value)) {
ctrl.$setValidity('validAddress', true);
@ -35,7 +43,7 @@ angular.module('copayApp.directives')
ctrl.$formatters.unshift(validator);
}
};
})
}])
.directive('enoughAmount', ['$rootScope',
function($rootScope) {
var bitcore = require('bitcore');