Skip to content
Snippets Groups Projects
Commit 897724e5 authored by dmonzonis's avatar dmonzonis Committed by Thibault Delavallée
Browse files

[IMP] web: Allow customization of text in button to apply kanban example

Before this commit, the only module that allows for selecting and
applying kanban column examples is the project module, for its tasks
kanban, so the message in the button to apply the example is hardcoded
as "Use This For My Project".

After this commit, the text in this button can be customized to make
this more generic, so a different module could use a different message
like "Use This For My Campaigns". If no text is specified, a generic
"Use This For My Kanban" is used instead.

Usage

```
kanbanExamplesRegistry.add('utm_campaign', {
    applyExamplesText: _lt("Use This For My Campaigns"),
```

Task ID: 2047369
PR #48299
parent f5fe11cf
Branches
Tags
No related merge requests found
......@@ -39,6 +39,7 @@ function escFormat() {
kanbanExamplesRegistry.add('project', {
ghostColumns: [_lt('New'), _lt('Assigned'), _lt('In Progress'), _lt('Done')],
applyExamplesText: _lt("Use This For My Project"),
examples:[{
name: _lt('Software Development'),
columns: [_lt('Backlog'), _lt('Specifications'), _lt('Development'), _lt('Tests'), _lt('Delivered')],
......
......@@ -32,6 +32,7 @@ var ColumnQuickCreate = Widget.extend({
*/
init: function (parent, options) {
this._super.apply(this, arguments);
this.applyExamplesText = options.applyExampleText || _t("Use This For My Kanban");
this.examples = options.examples;
this.folded = true;
this.isMobile = false;
......@@ -186,7 +187,7 @@ var ColumnQuickCreate = Widget.extend({
})),
buttons: [{
classes: 'btn-primary float-right',
text: _t('Use This For My Project'),
text: this.applyExamplesText,
close: true,
click: function () {
const activeExample = self.examples[this.$('.nav-link.active').data("exampleIndex")];
......
......@@ -373,6 +373,7 @@ var KanbanRenderer = BasicRenderer.extend({
if (this.createColumnEnabled) {
this.quickCreate = new ColumnQuickCreate(this, {
applyExamplesText: this.examples && this.examples.applyExamplesText,
examples: this.examples && this.examples.examples,
});
this.defs.push(this.quickCreate.appendTo(fragment).then(function () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment