Clean directives. Fix mouse-wheel on input number
This commit is contained in:
parent
3bac497049
commit
ce833c6ef9
8 changed files with 22 additions and 218 deletions
|
|
@ -49,7 +49,7 @@
|
||||||
min="0.01"
|
min="0.01"
|
||||||
max="500"
|
max="500"
|
||||||
ng-model="fiat"
|
ng-model="fiat"
|
||||||
autocomplete="off" required>
|
autocomplete="off" ignore-mouse-wheel required>
|
||||||
|
|
||||||
<a class="postfix button black">USD</a>
|
<a class="postfix button black">USD</a>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<ion-nav-bar class="bar-stable">
|
<ion-nav-bar class="bar-stable">
|
||||||
<ion-nav-buttons side="primary">
|
<ion-nav-buttons side="primary">
|
||||||
<button class="button no-border" ui-sref="tabs.home">
|
<button class="button no-border" ui-sref="tabs.home">
|
||||||
Back
|
Close
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
<ion-nav-title translate>Buy and sell</ion-nav-title>
|
<ion-nav-title translate>Buy and sell</ion-nav-title>
|
||||||
|
|
@ -10,11 +10,11 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="glidera">
|
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="glidera">
|
||||||
<img src="img/glidera-logo.png" width="150">
|
<img src="img/glidera-logo.png" width="100">
|
||||||
<i class="icon ion-chevron-right icon-accessory"></i>
|
<i class="icon ion-chevron-right icon-accessory"></i>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="coinbase">
|
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="coinbase">
|
||||||
<img src="img/coinbase-logo.png" width="150">
|
<img src="img/coinbase-logo.png" width="100">
|
||||||
<i class="icon ion-chevron-right icon-accessory"></i>
|
<i class="icon ion-chevron-right icon-accessory"></i>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<div class="medium-2 small-2 columns text-center bottombar-item">
|
|
||||||
<a ng-click="showPlugins ? showPlugins = false : showPlugins = true" class="menu-toggle">
|
|
||||||
<i class="size-24 db" ng-class="{ 'icon-arrow-left': showPlugins, 'icon-arrow-right' : !showPlugins }"> </i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
@ -67,8 +67,7 @@
|
||||||
<input type="text"
|
<input type="text"
|
||||||
id="address"
|
id="address"
|
||||||
name="address"
|
name="address"
|
||||||
ng-model="addressbookEntry.address"
|
ng-model="addressbookEntry.address" required>
|
||||||
valid-address required>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
<li ng-show="wallets[0]"
|
<li ng-show="wallets[0]"
|
||||||
ng-repeat="item in wallets track by $index" class="item item-icon-left"
|
ng-repeat="item in wallets track by $index" class="item item-icon-left"
|
||||||
menu-toggle href ui-sref="wallet.details({'walletId': item.id})">
|
ui-sref="wallet.details({'walletId': item.id})">
|
||||||
<i class="icon ion-briefcase size-21" ng-style="{'color':item.color}"></i>
|
<i class="icon ion-briefcase size-21" ng-style="{'color':item.color}"></i>
|
||||||
{{item.name || item.id}}
|
{{item.name || item.id}}
|
||||||
<span ng-show="item.n > 1" class="text-gray">
|
<span ng-show="item.n > 1" class="text-gray">
|
||||||
|
|
@ -81,20 +81,17 @@
|
||||||
<h3>Next steps </h3>
|
<h3>Next steps </h3>
|
||||||
<div class="list card">
|
<div class="list card">
|
||||||
<ul class="pr">
|
<ul class="pr">
|
||||||
<li menu-toggle href ui-sref="bitpayCard" ng-show="bitpayCardEnabled" class="item item-icon-left">
|
<li ui-sref="bitpayCard" ng-show="bitpayCardEnabled" class="item item-icon-left">
|
||||||
<i class="icon ion-card"></i>
|
<i class="icon ion-card"></i>
|
||||||
BitPay Card
|
BitPay Card
|
||||||
</li>
|
</li>
|
||||||
<li ng-show="buyAndSellEnabled" menu-toggle href ui-sref="buyandsell" class="item item-icon-left">
|
<li ng-show="buyAndSellEnabled" ui-sref="buyandsell" class="item item-icon-left">
|
||||||
<i class="icon ion-cash"></i>
|
<i class="icon ion-cash"></i>
|
||||||
Buy and Sell
|
Buy and Sell
|
||||||
</li>
|
</li>
|
||||||
<li menu-toggle href ui-sref="amazon.main" class="item item-icon-left">
|
<li ui-sref="amazon.main" class="item item-icon-left">
|
||||||
<i class="icon ion-ios-cart"></i>
|
<i class="icon ion-ios-cart"></i>
|
||||||
Gift Cards
|
Gift Cards
|
||||||
<span class="item-note">
|
|
||||||
bla bla
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, configService, lodash, $state, walletService) {
|
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, $log, $timeout, addressbookService, profileService, lodash, $state, walletService) {
|
||||||
|
|
||||||
var originalList;
|
var originalList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function selectText(element) {
|
|
||||||
var doc = document;
|
|
||||||
if (doc.body.createTextRange) { // ms
|
|
||||||
var range = doc.body.createTextRange();
|
|
||||||
range.moveToElementText(element);
|
|
||||||
range.select();
|
|
||||||
} else if (window.getSelection) {
|
|
||||||
var selection = window.getSelection();
|
|
||||||
var range = doc.createRange();
|
|
||||||
range.selectNodeContents(element);
|
|
||||||
selection.removeAllRanges();
|
|
||||||
selection.addRange(range);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
angular.module('copayApp.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('validAddress', ['$rootScope', 'bitcore',
|
.directive('validAddress', ['$rootScope', 'bitcore',
|
||||||
function($rootScope, bitcore) {
|
function($rootScope, bitcore) {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
|
|
@ -26,7 +10,7 @@ angular.module('copayApp.directives')
|
||||||
var validator = function(value) {
|
var validator = function(value) {
|
||||||
var networkName = attrs.networkName;
|
var networkName = attrs.networkName;
|
||||||
|
|
||||||
if (!networkName)
|
if (!networkName)
|
||||||
throw 'validAddress should provide network name';
|
throw 'validAddress should provide network name';
|
||||||
|
|
||||||
// Regular url
|
// Regular url
|
||||||
|
|
@ -58,29 +42,6 @@ angular.module('copayApp.directives')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ctrl.$parsers.unshift(validator);
|
|
||||||
ctrl.$formatters.unshift(validator);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.directive('validUrl', [
|
|
||||||
|
|
||||||
function() {
|
|
||||||
return {
|
|
||||||
require: 'ngModel',
|
|
||||||
link: function(scope, elem, attrs, ctrl) {
|
|
||||||
var validator = function(value) {
|
|
||||||
// Regular url
|
|
||||||
if (/^https?:\/\//.test(value)) {
|
|
||||||
ctrl.$setValidity('validUrl', true);
|
|
||||||
return value;
|
|
||||||
} else {
|
|
||||||
ctrl.$setValidity('validUrl', false);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ctrl.$parsers.unshift(validator);
|
ctrl.$parsers.unshift(validator);
|
||||||
ctrl.$formatters.unshift(validator);
|
ctrl.$formatters.unshift(validator);
|
||||||
}
|
}
|
||||||
|
|
@ -143,23 +104,6 @@ angular.module('copayApp.directives')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.directive('loading', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'A',
|
|
||||||
link: function($scope, element, attr) {
|
|
||||||
var a = element.html();
|
|
||||||
var text = attr.loading;
|
|
||||||
element.on('click', function() {
|
|
||||||
element.html('<i class="size-21 fi-bitcoin-circle icon-rotate spinner"></i> ' + text + '...');
|
|
||||||
});
|
|
||||||
$scope.$watch('loading', function(val) {
|
|
||||||
if (!val) {
|
|
||||||
element.html(a);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.directive('ngFileSelect', function() {
|
.directive('ngFileSelect', function() {
|
||||||
return {
|
return {
|
||||||
link: function($scope, el) {
|
link: function($scope, el) {
|
||||||
|
|
@ -187,147 +131,6 @@ angular.module('copayApp.directives')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
.directive('highlightOnChange', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'A',
|
|
||||||
link: function(scope, element, attrs) {
|
|
||||||
scope.$watch(attrs.highlightOnChange, function(newValue, oldValue) {
|
|
||||||
element.addClass('highlight');
|
|
||||||
setTimeout(function() {
|
|
||||||
element.removeClass('highlight');
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.directive('checkStrength', function() {
|
|
||||||
return {
|
|
||||||
replace: false,
|
|
||||||
restrict: 'EACM',
|
|
||||||
require: 'ngModel',
|
|
||||||
link: function(scope, element, attrs) {
|
|
||||||
|
|
||||||
var MIN_LENGTH = 8;
|
|
||||||
var MESSAGES = ['Very Weak', 'Very Weak', 'Weak', 'Medium', 'Strong', 'Very Strong'];
|
|
||||||
var COLOR = ['#dd514c', '#dd514c', '#faa732', '#faa732', '#16A085', '#16A085'];
|
|
||||||
|
|
||||||
function evaluateMeter(password) {
|
|
||||||
var passwordStrength = 0;
|
|
||||||
var text;
|
|
||||||
if (password.length > 0) passwordStrength = 1;
|
|
||||||
if (password.length >= MIN_LENGTH) {
|
|
||||||
if ((password.match(/[a-z]/)) && (password.match(/[A-Z]/))) {
|
|
||||||
passwordStrength++;
|
|
||||||
} else {
|
|
||||||
text = ', add mixed case';
|
|
||||||
}
|
|
||||||
if (password.match(/\d+/)) {
|
|
||||||
passwordStrength++;
|
|
||||||
} else {
|
|
||||||
if (!text) text = ', add numerals';
|
|
||||||
}
|
|
||||||
if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) {
|
|
||||||
passwordStrength++;
|
|
||||||
} else {
|
|
||||||
if (!text) text = ', add punctuation';
|
|
||||||
}
|
|
||||||
if (password.length > 12) {
|
|
||||||
passwordStrength++;
|
|
||||||
} else {
|
|
||||||
if (!text) text = ', add characters';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
text = ', that\'s short';
|
|
||||||
}
|
|
||||||
if (!text) text = '';
|
|
||||||
|
|
||||||
return {
|
|
||||||
strength: passwordStrength,
|
|
||||||
message: MESSAGES[passwordStrength] + text,
|
|
||||||
color: COLOR[passwordStrength]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scope.$watch(attrs.ngModel, function(newValue, oldValue) {
|
|
||||||
if (newValue && newValue !== '') {
|
|
||||||
var info = evaluateMeter(newValue);
|
|
||||||
scope[attrs.checkStrength] = info;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.directive('showFocus', function($timeout) {
|
|
||||||
return function(scope, element, attrs) {
|
|
||||||
scope.$watch(attrs.showFocus,
|
|
||||||
function(newValue) {
|
|
||||||
$timeout(function() {
|
|
||||||
newValue && element[0].focus();
|
|
||||||
});
|
|
||||||
}, true);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.directive('match', function() {
|
|
||||||
return {
|
|
||||||
require: 'ngModel',
|
|
||||||
restrict: 'A',
|
|
||||||
scope: {
|
|
||||||
match: '='
|
|
||||||
},
|
|
||||||
link: function(scope, elem, attrs, ctrl) {
|
|
||||||
scope.$watch(function() {
|
|
||||||
return (ctrl.$pristine && angular.isUndefined(ctrl.$modelValue)) || scope.match === ctrl.$modelValue;
|
|
||||||
}, function(currentValue) {
|
|
||||||
ctrl.$setValidity('match', currentValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.directive('clipCopy', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'A',
|
|
||||||
scope: {
|
|
||||||
clipCopy: '=clipCopy'
|
|
||||||
},
|
|
||||||
link: function(scope, elm) {
|
|
||||||
// TODO this does not work (FIXME)
|
|
||||||
elm.attr('tooltip', 'Press Ctrl+C to Copy');
|
|
||||||
elm.attr('tooltip-placement', 'top');
|
|
||||||
|
|
||||||
elm.bind('click', function() {
|
|
||||||
selectText(elm[0]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.directive('menuToggle', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
replace: true,
|
|
||||||
templateUrl: 'views/includes/menu-toggle.html'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.directive('logo', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
scope: {
|
|
||||||
width: "@",
|
|
||||||
negative: "="
|
|
||||||
},
|
|
||||||
controller: function($scope) {
|
|
||||||
$scope.logo_url = $scope.negative ? 'img/logo-negative.svg' : 'img/logo.svg';
|
|
||||||
},
|
|
||||||
replace: true,
|
|
||||||
template: '<img ng-src="{{ logo_url }}" alt="Copay">'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.directive('availableBalance', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
replace: true,
|
|
||||||
templateUrl: 'views/includes/available-balance.html'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.directive('ignoreMouseWheel', function($rootScope, $timeout) {
|
.directive('ignoreMouseWheel', function($rootScope, $timeout) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
|
|
|
||||||
|
|
@ -1045,3 +1045,13 @@ input[type="number"] {
|
||||||
.calculator .button-calc .columns { padding: 20px; }
|
.calculator .button-calc .columns { padding: 20px; }
|
||||||
.calculator .header-calc { top: 18%; }
|
.calculator .header-calc { top: 18%; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Turn Off Number Input Spinners */
|
||||||
|
|
||||||
|
input[type=number] {
|
||||||
|
&::-webkit-inner-spin-button, &::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue