This repository has been archived by the owner on Oct 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(DeCoffee): convert label-origin directive to es6
- Loading branch information
Showing
3 changed files
with
39 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
angular | ||
.module('walletApp') | ||
.directive('labelOrigin', labelOrigin); | ||
|
||
function labelOrigin(Wallet, currency) { | ||
const directive = { | ||
restrict: 'E', | ||
replace: true, | ||
templateUrl: 'templates/label-origin.jade', | ||
scope: { | ||
origin: '=', | ||
fee: '=', | ||
highlight: '=' | ||
}, | ||
link: link | ||
}; | ||
return directive; | ||
|
||
function link(scope, elem, attrs) { | ||
scope.settings = Wallet.settings; | ||
scope.isBitCurrency = currency.isBitCurrency; | ||
|
||
scope.determineAvailableBalance = (balance) => { | ||
if (balance == null) return; | ||
|
||
finalBalance = parseInt(balance); | ||
if (scope.fee) finalBalance -= parseInt(scope.fee); | ||
|
||
return finalBalance < 0 ? 0 : finalBalance; | ||
}; | ||
|
||
scope.determineLabel = (origin) => { | ||
if (origin == null) return; | ||
return origin.label || origin.address; | ||
}; | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.