Adds size-equal and capitalizes currency text

This commit is contained in:
Sam Cheng Hung 2018-07-30 17:33:38 +08:00
commit f4b0b46067
4 changed files with 22 additions and 3 deletions

View file

@ -2,7 +2,13 @@
/**
* @desc amount directive that can be used to display formatted financial values
* @example <amount value="12.49382901" currency="BCH"></amount>
* size-equal attribute is optional, defaults to false.
* @example fee = {
* value: 12.49382901,
* currency: 'BCH'
* }
* @example <amount value="fee.value" currency="fee.currency"></amount>
* @example <amount value="fee.value" currency="fee.currency" size-equal="true"></amount>
*/
angular.module('bitcoincom.directives')
.directive('amount', [
@ -12,10 +18,13 @@ angular.module('bitcoincom.directives')
restrict: 'E',
scope: {
value: '=',
currency: '='
currency: '=',
sizeEqual: '='
},
templateUrl: 'views/includes/amount.html',
controller: ['$scope', function($scope) {
if (typeof $scope.sizeEqual != 'undefined') $scope.sizeEqual = false;
var decimalPlaces = {
'0': ['BIF', 'CLP', 'DJF', 'GNF', 'ILS', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'],
'3': ['BHD', 'IQD', 'JOD', 'KWD', 'OMR', 'TND'],

View file

@ -30,5 +30,6 @@
.currency {
font-size: 1em;
margin-left: 5px;
text-transform: uppercase;
}
}

View file

@ -15083,9 +15083,14 @@ log-options #check-bar .checkbox-icon {
font-size: 0.7857em;
margin-left: 5px; }
.amount.size-equal .middle,
.amount.size-equal .end {
font-size: 1em; }
.amount .currency {
font-size: 1em;
margin-left: 5px; }
margin-left: 5px;
text-transform: uppercase; }
/* This is for rules that don't yet have a home.
* Our goal is to delete this file. Search the regex: /class=".*CLASS.*?"/

View file

@ -0,0 +1,4 @@
<div class="amount"
ng-class="{ 'size-equal': sizeEqual }">
<span ng-if="start.length > 0" class="start">{{start}}</span><span ng-if="middle.length > 0" class="middle">{{middle}}</span><span ng-if="end.length > 0" class="end">{{end}}</span><span ng-if="currency.length > 0" class="currency">{{currency}}</span>
</div>