Skip to content

Commit e6eebd8

Browse files
authored
Merge pull request #3803 from PopulateTools/1243-euro-field
Currency type
2 parents 9a3393a + da1f891 commit e6eebd8

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

app/javascript/gobierto_plans/webapp/components/ProjectCustomFields.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
<CustomFieldImage :attributes="attributes" />
3737
</template>
3838

39+
<template v-else-if="currencyType">
40+
<div
41+
v-for="value in values"
42+
:key="value"
43+
>
44+
{{ value | money }}
45+
</div>
46+
</template>
47+
3948
<template v-else>
4049
<div
4150
v-for="value in values"
@@ -51,7 +60,7 @@
5160
</template>
5261

5362
<script>
54-
import { translate } from "lib/vue/filters";
63+
import { translate, money } from "lib/vue/filters";
5564
import { FieldTypeMixin } from "../lib/mixins/field-type";
5665
import CustomFieldParagraph from "./CustomFieldParagraph.vue";
5766
import CustomFieldPluginRawIndicators from "./CustomFieldPluginRawIndicators.vue";
@@ -69,7 +78,8 @@ export default {
6978
CustomFieldImage
7079
},
7180
filters: {
72-
translate
81+
translate,
82+
money
7383
},
7484
mixins: [FieldTypeMixin],
7585
props: {

app/javascript/gobierto_plans/webapp/lib/mixins/field-type.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export const FieldTypeMixin = {
22
data() {
33
return {
44
fieldType: null,
5-
termDecorator: null
5+
termDecorator: null,
6+
unitType: null,
67
};
78
},
89
computed: {
@@ -28,18 +29,23 @@ export const FieldTypeMixin = {
2829
},
2930
rawIndicatorsType() {
3031
return this.termDecorator === "raw_indicators";
31-
}
32+
},
33+
currencyType() {
34+
return this.fieldType === "numeric" && this.unitType === "currency";
35+
},
3236
},
3337
created() {
3438
const {
3539
field_type,
3640
options: {
3741
configuration: {
38-
plugin_configuration: { category_term_decorator } = {}
42+
plugin_configuration: { category_term_decorator } = {},
43+
unit_type
3944
} = {}
4045
} = {}
4146
} = this.attributes;
4247
this.fieldType = field_type;
4348
this.termDecorator = category_term_decorator;
49+
this.unitType = unit_type;
4450
}
4551
};

0 commit comments

Comments
 (0)