diff options
author | Haben Amare <haben.amare@outlook.com> | 2020-05-25 15:59:43 +0000 |
---|---|---|
committer | Haben Amare <haben.amare@outlook.com> | 2020-05-25 22:02:51 +0000 |
commit | 54b9035eb20753dbe22830262db3e6ba674e8958 (patch) | |
tree | 990bc997d9721ec350a6b218f8c749d85f920169 /client/components/cards/cardCustomFields.js | |
parent | 3cf6ed916f4fd4c8e6e826ed4af1c2dd4c965110 (diff) | |
download | wekan-54b9035eb20753dbe22830262db3e6ba674e8958.tar.gz wekan-54b9035eb20753dbe22830262db3e6ba674e8958.tar.bz2 wekan-54b9035eb20753dbe22830262db3e6ba674e8958.zip |
add 'cardCustomField-currency' template
Diffstat (limited to 'client/components/cards/cardCustomFields.js')
-rw-r--r-- | client/components/cards/cardCustomFields.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/client/components/cards/cardCustomFields.js b/client/components/cards/cardCustomFields.js index d0b9c72d..737c5454 100644 --- a/client/components/cards/cardCustomFields.js +++ b/client/components/cards/cardCustomFields.js @@ -80,6 +80,31 @@ CardCustomField.register('cardCustomField'); } }.register('cardCustomField-number')); +// cardCustomField-currency +(class extends CardCustomField { + onCreated() { + super.onCreated(); + + this.currencySymbol = this.data().definition.settings.currencySymbol; + } + + formattedValue() { + return `${this.currencySymbol}${this.data().value}`; + } + + events() { + return [ + { + 'submit .js-card-customfield-currency'(event) { + event.preventDefault(); + const value = Number(this.find('input').value, 10); + this.card.setCustomField(this.customFieldId, value); + }, + }, + ]; + } +}.register('cardCustomField-currency')); + // cardCustomField-date (class extends CardCustomField { onCreated() { |