mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
add configuration field for separator
This commit is contained in:
parent
880d94e220
commit
3778a9ebcf
6 changed files with 31 additions and 5 deletions
|
@ -241,6 +241,7 @@ CardCustomField.register('cardCustomField');
|
|||
super.onCreated();
|
||||
|
||||
this.stringtemplateFormat = this.data().definition.settings.stringtemplateFormat;
|
||||
this.stringtemplateSeparator = this.data().definition.settings.stringtemplateSeparator;
|
||||
}
|
||||
|
||||
formattedValue() {
|
||||
|
@ -249,7 +250,7 @@ CardCustomField.register('cardCustomField');
|
|||
.split('\n')
|
||||
.filter(value => value.trim() !== '')
|
||||
.map(value => this.stringtemplateFormat.replace(/%\{value\}/gi, value))
|
||||
.join(' ');
|
||||
.join(this.stringtemplateSeparator ?? '');
|
||||
}
|
||||
|
||||
events() {
|
||||
|
|
|
@ -34,7 +34,7 @@ BlazeComponent.extendComponent({
|
|||
.split('\n')
|
||||
.filter(value => value.trim() !== '')
|
||||
.map(value => definition.settings.stringtemplateFormat.replace(/%\{value\}/gi, value))
|
||||
.join(' ');
|
||||
.join(definition.settings.stringtemplateSeparator ?? '');
|
||||
},
|
||||
|
||||
events() {
|
||||
|
|
|
@ -54,7 +54,10 @@ template(name="createCustomFieldPopup")
|
|||
div.js-field-settings.js-field-settings-stringtemplate(class="{{#if isTypeNotSelected 'stringtemplate'}}hide{{/if}}")
|
||||
label
|
||||
| {{_ 'custom-field-stringtemplate-format'}}
|
||||
input.js-field-stringtemplate(type="text" value=getStringtemplateFormat)
|
||||
input.js-field-stringtemplate-format(type="text" value=getStringtemplateFormat)
|
||||
label
|
||||
| {{_ 'custom-field-stringtemplate-separator'}}
|
||||
input.js-field-stringtemplate-separator(type="text" value=getStringtemplateSeparator)
|
||||
|
||||
a.flex.js-field-show-on-card(class="{{#if showOnCard}}is-checked{{/if}}")
|
||||
.materialCheckBox(class="{{#if showOnCard}}is-checked{{/if}}")
|
||||
|
|
|
@ -91,6 +91,12 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
|
|||
? this.data().settings.stringtemplateFormat
|
||||
: '',
|
||||
);
|
||||
|
||||
this.stringtemplateSeparator = new ReactiveVar(
|
||||
this.data().settings && this.data().settings.stringtemplateSeparator
|
||||
? this.data().settings.stringtemplateSeparator
|
||||
: '',
|
||||
);
|
||||
},
|
||||
|
||||
types() {
|
||||
|
@ -139,6 +145,10 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
|
|||
return this.stringtemplateFormat.get();
|
||||
},
|
||||
|
||||
getStringtemplateSeparator() {
|
||||
return this.stringtemplateSeparator.get();
|
||||
},
|
||||
|
||||
getSettings() {
|
||||
const settings = {};
|
||||
switch (this.type.get()) {
|
||||
|
@ -157,6 +167,9 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
|
|||
case 'stringtemplate': {
|
||||
const stringtemplateFormat = this.stringtemplateFormat.get();
|
||||
settings.stringtemplateFormat = stringtemplateFormat;
|
||||
|
||||
const stringtemplateSeparator = this.stringtemplateSeparator.get();
|
||||
settings.stringtemplateSeparator = stringtemplateSeparator;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -181,10 +194,14 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
|
|||
evt.target.value = '';
|
||||
}
|
||||
},
|
||||
'input .js-field-stringtemplate'(evt) {
|
||||
'input .js-field-stringtemplate-format'(evt) {
|
||||
const value = evt.target.value;
|
||||
this.stringtemplateFormat.set(value);
|
||||
},
|
||||
'input .js-field-stringtemplate-separator'(evt) {
|
||||
const value = evt.target.value;
|
||||
this.stringtemplateSeparator.set(value);
|
||||
},
|
||||
'click .js-field-show-on-card'(evt) {
|
||||
let $target = $(evt.target);
|
||||
if (!$target.hasClass('js-field-show-on-card')) {
|
||||
|
|
|
@ -990,5 +990,6 @@
|
|||
"move-swimlane": "Move Swimlane",
|
||||
"moveSwimlanePopup-title": "Move Swimlane",
|
||||
"custom-field-stringtemplate": "String Template",
|
||||
"custom-field-stringtemplate-format": "Format (use %{value} as placeholder)"
|
||||
"custom-field-stringtemplate-format": "Format (use %{value} as placeholder)",
|
||||
"custom-field-stringtemplate-separator": "Separator (use   or   for a space)"
|
||||
}
|
||||
|
|
|
@ -69,6 +69,10 @@ CustomFields.attachSchema(
|
|||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
'settings.stringtemplateSeparator': {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
showOnCard: {
|
||||
/**
|
||||
* should we show on the cards this custom field
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue