mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
add 'cardCustomField-currency' template
This commit is contained in:
parent
3cf6ed916f
commit
54b9035eb2
2 changed files with 42 additions and 0 deletions
|
@ -53,6 +53,23 @@ template(name="cardCustomField-number")
|
|||
if value
|
||||
= value
|
||||
|
||||
template(name="cardCustomField-currency")
|
||||
if canModifyCard
|
||||
+inlinedForm(classNames="js-card-customfield-currency")
|
||||
input(type="text" value=data.value)
|
||||
.edit-controls.clearfix
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
a.fa.fa-times-thin.js-close-inlined-form
|
||||
else
|
||||
a.js-open-inlined-form
|
||||
if value
|
||||
= formattedValue
|
||||
else
|
||||
| {{_ 'edit'}}
|
||||
else
|
||||
if value
|
||||
= formattedValue
|
||||
|
||||
template(name="cardCustomField-date")
|
||||
if canModifyCard
|
||||
a.js-edit-date(title="{{showTitle}}" class="{{classes}}")
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue