From 897724e5c78101b68091e0386285598a249edca9 Mon Sep 17 00:00:00 2001 From: dmonzonis Date: Thu, 2 Apr 2020 07:22:37 +0000 Subject: [PATCH 1/3] [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 --- addons/project/static/src/js/project_task_kanban_examples.js | 1 + .../static/src/js/views/kanban/kanban_column_quick_create.js | 3 ++- addons/web/static/src/js/views/kanban/kanban_renderer.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/project/static/src/js/project_task_kanban_examples.js b/addons/project/static/src/js/project_task_kanban_examples.js index 72f09478df6..1717ae49778 100644 --- a/addons/project/static/src/js/project_task_kanban_examples.js +++ b/addons/project/static/src/js/project_task_kanban_examples.js @@ -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')], diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js index 21824c22100..bd8b5c7f231 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js @@ -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")]; diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer.js b/addons/web/static/src/js/views/kanban/kanban_renderer.js index acf3fc7d7cd..1b1cfc5c147 100644 --- a/addons/web/static/src/js/views/kanban/kanban_renderer.js +++ b/addons/web/static/src/js/views/kanban/kanban_renderer.js @@ -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 () { From 59a0b92995cea5d7091a12e9eb1aa94825659c80 Mon Sep 17 00:00:00 2001 From: dmonzonis Date: Thu, 2 Apr 2020 07:34:09 +0000 Subject: [PATCH 2/3] [IMP] utm: Add kanban examples for UTM campaigns Inspired by what is done in the task kanban of the project module, add examples of kanban stage setups for UTM campaigns, and allow users to load them. There have also been some minor changes to the campaigns view: - The helper message when there are no UTM campaigns has been changed to a more descriptive message. - All stages that existed by default (hardcoded in the data XML) have been removed except default New one. An user with a fresh database will have no stages in their kanban. The old hardcoded stages have been moved to the demo data instead, so they will still be added by default if the user installs demo data. - The ghost columns that appear in the kanban when no stages exist have been renamed to match the old stages that were hardcoded. - When the user opens the view to create a column, the 'See examples' link will appear below the 'Column title', just like in the project addon, and clicking it will open some examples specifically made for UTM campaigns. Clicking on the 'Use This For My Kanban' button will load the stages of the selected example. - A min-height property has been given to the example modal view so that the view does not change size depending on the number of rows in the ghost columns. Task ID: 2047369 PR #48299 --- addons/utm/data/utm_data.xml | 14 +---- addons/utm/data/utm_demo.xml | 62 ++++++++++++------- .../src/js/utm_campaign_kanban_examples.js | 34 ++++++++++ addons/utm/views/assets.xml | 3 + addons/utm/views/utm_campaign_views.xml | 2 +- addons/utm/views/utm_views.xml | 5 +- .../src/scss/kanban_examples_dialog.scss | 1 + 7 files changed, 83 insertions(+), 38 deletions(-) create mode 100644 addons/utm/static/src/js/utm_campaign_kanban_examples.js diff --git a/addons/utm/data/utm_data.xml b/addons/utm/data/utm_data.xml index 0b9a5fb62d7..cf7bafd7134 100644 --- a/addons/utm/data/utm_data.xml +++ b/addons/utm/data/utm_data.xml @@ -1,22 +1,12 @@ + New 10 - - Schedule - 10 - - - Design - 20 - - - Sent - 30 - diff --git a/addons/utm/data/utm_demo.xml b/addons/utm/data/utm_demo.xml index e4e44578fe0..1acae0f425c 100644 --- a/addons/utm/data/utm_demo.xml +++ b/addons/utm/data/utm_demo.xml @@ -1,26 +1,40 @@ - + - - - - Sale - - - - - Christmas Special - - - - - Email Campaign - Services - - - - - Email Campaign - Products - - - - + + + + Schedule + 10 + + + Design + 20 + + + Sent + 30 + + + + + Sale + + + + + Christmas Special + + + + + Email Campaign - Services + + + + + Email Campaign - Products + + + + diff --git a/addons/utm/static/src/js/utm_campaign_kanban_examples.js b/addons/utm/static/src/js/utm_campaign_kanban_examples.js new file mode 100644 index 00000000000..a1b7ec622d1 --- /dev/null +++ b/addons/utm/static/src/js/utm_campaign_kanban_examples.js @@ -0,0 +1,34 @@ +odoo.define('utm.campaing_kanban_examples', function (require) { +'use strict'; + +var core = require('web.core'); +var kanbanExamplesRegistry = require('web.kanban_examples_registry'); + +var _lt = core._lt; + +kanbanExamplesRegistry.add('utm_campaign', { + ghostColumns: [_lt('Ideas'), _lt('Design'), _lt('Review'), _lt('Send'), _lt('Done')], + applyExamplesText: _lt("Use This For My Campaigns"), + examples: [{ + name: _lt('Creative Flow'), + columns: [_lt('Ideas'), _lt('Design'), _lt('Review'), _lt('Send'), _lt('Done')], + description: _lt("Collect ideas, design creative content and publish it once reviewed."), + }, { + name: _lt('Event-driven Flow'), + columns: [_lt('Later'), _lt('This Month'), _lt('This Week'), _lt('Running'), _lt('Sent')], + description: _lt("Track incoming events (e.g. : Christmas, Black Friday, ...) and publish timely content."), + }, { + name: _lt('Soft-Launch Flow'), + columns: [_lt('Pre-Launch'), _lt('Soft-Launch'), _lt('Deploy'), _lt('Report'), _lt('Done')], + description: _lt("Prepare your Campaign, test it with part of your audience and deploy it fully afterwards."), + }, { + name: _lt('Audience-driven Flow'), + columns: [_lt('New'), _lt('Gather Data'), _lt('List-Building'), _lt('Copywriting'), _lt('Sent')], + description: _lt("Gather data, build a recipient list and write content based on your Marketing target."), + }, { + name: _lt('Approval-based Flow'), + columns: [_lt('New'), _lt('To be Approved'), _lt('Approved'), _lt('Deployed')], + description: _lt("Prepare Campaigns and get them approved before making them go live."), + }], +}); +}); diff --git a/addons/utm/views/assets.xml b/addons/utm/views/assets.xml index 53ab3d95603..0195faae527 100644 --- a/addons/utm/views/assets.xml +++ b/addons/utm/views/assets.xml @@ -1,6 +1,9 @@