refactor(plugin): rebrand as MT3SMarketingProgram, release 0.17.0
Rename the plugin's vendor/namespace from experiential/Program to mt3s/MT3SMarketingProgram (composer: mt3s/mautic-marketing-program-bundle): - ProgramBundle -> MT3SMarketingProgramBundle; extension, integration, config support, permissions, events and twig extension renamed likewise - Initiative* -> Program*: controller (InitiativeController -> ProgramController), model, entities, repositories, form types and views (new _tabs/_task_table/_tab_table_filter partials, details page) - Settings config form theme -> _config_mt3smarketingprogramconfig_widget; routes and translations re-prefixed (mt3s_marketing_program_*) - Assets: icon.svg -> mt3s-mp-icon.svg; program.js -> mt3s-mp-program.js (OnLoad hooks renamed mt3sMpProgram*) - Add Command/RefreshStatsCommand; Migrations/Version_0_17_0.php renames the tables to mt3s_mp_program_*
This commit is contained in:
1 parent
687d33d30c
commit
ea88b7a772
131 files changed
+3238
-2836
No files matched your search
File renamed without changes.
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
@@ -2,26 +2,26 @@
|
||||
* Plan plugin scripts.
|
||||
*
|
||||
* - Plan form: editable, sortable rows (objectives, description items, allocation items), the selected
|
||||
* item type's description, and tab error markers. Started by Mautic.programOnLoad(), which Mautic calls after
|
||||
* it loads any page whose mauticContent is "initiative", including pages loaded through Ajax.
|
||||
* - Task form (mauticContent "programTask", started by Mautic.programTaskOnLoad()): the dependencies and
|
||||
* the RACI rows work like the initiative form's collections; the selected kind enslaves a milestone's
|
||||
* item type's description, and tab error markers. Started by Mautic.mt3sMpProgramOnLoad(), which Mautic calls after
|
||||
* it loads any page whose mauticContent is "program", including pages loaded through Ajax.
|
||||
* - Task form (mauticContent "mt3sMpProgramTask", started by Mautic.mt3sMpProgramTaskOnLoad()): the dependencies and
|
||||
* the RACI rows work like the program form's collections; the selected kind enslaves a milestone's
|
||||
* end date; the selected type's description and pictogram sit next to the type dropdown.
|
||||
* - Audience form (mauticContent "programAudience", started by Mautic.programAudienceOnLoad()): the selected
|
||||
* - Audience form (mauticContent "mt3sMpProgramAudience", started by Mautic.mt3sMpProgramAudienceOnLoad()): the selected
|
||||
* type's pictogram next to the type dropdown (fixed per type, not admin-configured).
|
||||
* - Settings > Configuration > Plan: adding and removing item types (delegated handlers,
|
||||
* because that page isn't a "initiative" page).
|
||||
* because that page isn't a "program" page).
|
||||
*/
|
||||
Mautic.programAudienceOnLoad = function (container) {
|
||||
Mautic.mt3sMpProgramAudienceOnLoad = function (container) {
|
||||
// The type dropdown's pictogram is fixed per type (AudienceType), not admin-configured: it is
|
||||
// rendered from the value server-side (the program_audience_type_icon filter), and updated here.
|
||||
// rendered from the value server-side (the mt3s_marketing_program_audience_type_icon filter), and updated here.
|
||||
mQuery(container).find('select[name$="[audienceType]"]').each(function () {
|
||||
var $select = mQuery(this);
|
||||
|
||||
if ($select.data('programAudienceInitialized')) {
|
||||
if ($select.data('mt3sMpProgramAudienceInitialized')) {
|
||||
return;
|
||||
}
|
||||
$select.data('programAudienceInitialized', true);
|
||||
$select.data('mt3sMpProgramAudienceInitialized', true);
|
||||
|
||||
// The same icons as AudienceType::getIcon().
|
||||
var icons = {
|
||||
@@ -34,30 +34,30 @@ Mautic.programAudienceOnLoad = function (container) {
|
||||
|
||||
$select.on('change', function () {
|
||||
var icon = icons[mQuery(this).val()] || 'ri-user-heart-line';
|
||||
mQuery(this).closest('form').find('.initiative-item-type-icon').first()
|
||||
.attr('class', 'initiative-item-type-icon ' + icon);
|
||||
mQuery(this).closest('form').find('.program-item-type-icon').first()
|
||||
.attr('class', 'program-item-type-icon ' + icon);
|
||||
});
|
||||
});
|
||||
};
|
||||
Mautic.programTaskOnLoad = function (container) {
|
||||
// The dependencies and RACI rows work like the initiative form's collections.
|
||||
mQuery(container).find('.initiative-collection').each(function () {
|
||||
Mautic.programInitCollection(mQuery(this));
|
||||
Mautic.mt3sMpProgramTaskOnLoad = function (container) {
|
||||
// The dependencies and RACI rows work like the program form's collections.
|
||||
mQuery(container).find('.program-collection').each(function () {
|
||||
Mautic.mt3sMpProgramInitCollection(mQuery(this));
|
||||
});
|
||||
// The type dropdown works the same way as in the initiative form.
|
||||
mQuery(container).find('select.initiative-item-type').each(function () {
|
||||
// The type dropdown works the same way as in the program form.
|
||||
mQuery(container).find('select.program-item-type').each(function () {
|
||||
var $select = mQuery(this);
|
||||
|
||||
if ($select.data('programTaskInitialized')) {
|
||||
if ($select.data('mt3sMpProgramTaskInitialized')) {
|
||||
return;
|
||||
}
|
||||
$select.data('programTaskInitialized', true);
|
||||
$select.data('mt3sMpProgramTaskInitialized', true);
|
||||
|
||||
$select.on('change', function () {
|
||||
var $option = $select.find('option:selected');
|
||||
var $scope = $select.closest('form');
|
||||
$scope.find('.initiative-item-type-help').first().text($option.attr('data-description') || '');
|
||||
$scope.find('.initiative-item-type-icon').first().attr('class', 'initiative-item-type-icon ' + ($option.attr('data-icon') || ''));
|
||||
$scope.find('.program-item-type-help').first().text($option.attr('data-description') || '');
|
||||
$scope.find('.program-item-type-icon').first().attr('class', 'program-item-type-icon ' + ($option.attr('data-icon') || ''));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -93,20 +93,20 @@ Mautic.programTaskOnLoad = function (container) {
|
||||
enslave.call($kind.get(0));
|
||||
});
|
||||
};
|
||||
Mautic.programOnLoad = function (container) {
|
||||
mQuery(container).find('.initiative-collection').each(function () {
|
||||
Mautic.programInitCollection(mQuery(this));
|
||||
Mautic.mt3sMpProgramOnLoad = function (container) {
|
||||
mQuery(container).find('.program-collection').each(function () {
|
||||
Mautic.mt3sMpProgramInitCollection(mQuery(this));
|
||||
});
|
||||
mQuery(container).find('.initiative-tabs').each(function () {
|
||||
Mautic.programInitTabs(mQuery(this), mQuery(container));
|
||||
mQuery(container).find('.program-tabs').each(function () {
|
||||
Mautic.mt3sMpProgramInitTabs(mQuery(this), mQuery(container));
|
||||
});
|
||||
// Detail page: the four tab tables (description items, objectives, allocation items, tasks).
|
||||
mQuery(container).find('table[data-initiative-tab-table]').each(function () {
|
||||
Mautic.programInitTabTable(mQuery(this));
|
||||
mQuery(container).find('table[data-program-tab-table]').each(function () {
|
||||
Mautic.mt3sMpProgramInitTabTable(mQuery(this));
|
||||
});
|
||||
// Detail page: long description item texts, clamped to 10 lines with a read-more toggle.
|
||||
mQuery(container).find('.initiative-read-more').each(function () {
|
||||
Mautic.programInitReadMore(mQuery(this));
|
||||
mQuery(container).find('.program-read-more').each(function () {
|
||||
Mautic.mt3sMpProgramInitReadMore(mQuery(this));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -119,14 +119,14 @@ Mautic.programOnLoad = function (container) {
|
||||
* (Mautic reopens the tab last used) has no layout, so its scrollHeight is 0. The wrapper is rechecked
|
||||
* on every tab activation until the measurement could run.
|
||||
*/
|
||||
Mautic.programInitReadMore = function ($wrapper) {
|
||||
Mautic.mt3sMpProgramInitReadMore = function ($wrapper) {
|
||||
if ($wrapper.data('planReadMoreInitialized')) {
|
||||
return;
|
||||
}
|
||||
$wrapper.data('planReadMoreInitialized', true);
|
||||
|
||||
var $text = $wrapper.find('.initiative-read-more-text').first();
|
||||
var $toggle = $wrapper.find('.initiative-read-more-toggle').first();
|
||||
var $text = $wrapper.find('.program-read-more-text').first();
|
||||
var $toggle = $wrapper.find('.program-read-more-toggle').first();
|
||||
var clampLines = 10;
|
||||
|
||||
var measure = function () {
|
||||
@@ -158,16 +158,16 @@ Mautic.programInitReadMore = function ($wrapper) {
|
||||
|
||||
if (!measure()) {
|
||||
// The pane holding this text is hidden: recheck each time a tab of this page is shown.
|
||||
mQuery(document).on('shown.bs.tab.initiative-read-more', function () {
|
||||
mQuery(document).on('shown.bs.tab.program-read-more', function () {
|
||||
if (measure()) {
|
||||
mQuery(document).off('shown.bs.tab.initiative-read-more');
|
||||
mQuery(document).off('shown.bs.tab.program-read-more');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A initiative detail page tab table: one filter box filtering every column (case-insensitive substring),
|
||||
* A program detail page tab table: one filter box filtering every column (case-insensitive substring),
|
||||
* and every column header sorting the rows asc/desc on click. Filtering and sorting are done on the
|
||||
* client, instantly: these tables hold one plan's items, never many.
|
||||
*
|
||||
@@ -175,16 +175,16 @@ Mautic.programInitReadMore = function ($wrapper) {
|
||||
* Sorting the tree by another column can interleave a sub-task before its parent; the depth marker
|
||||
* stays attached to its own row, so it just indents wherever it lands.
|
||||
*/
|
||||
Mautic.programInitTabTable = function ($table) {
|
||||
Mautic.mt3sMpProgramInitTabTable = function ($table) {
|
||||
if ($table.data('planTabTableInitialized')) {
|
||||
return;
|
||||
}
|
||||
$table.data('planTabTableInitialized', true);
|
||||
|
||||
var $panes = $table.closest('.tab-pane');
|
||||
var $filterBox = $panes.find('.initiative-tab-table-filter').first();
|
||||
var $input = $filterBox.find('.initiative-tab-table-filter-input');
|
||||
var $noMatch = $panes.find('.initiative-tab-table-nomatch').first();
|
||||
var $filterBox = $panes.find('.program-tab-table-filter').first();
|
||||
var $input = $filterBox.find('.program-tab-table-filter-input');
|
||||
var $noMatch = $panes.find('.program-tab-table-nomatch').first();
|
||||
var $rows = $table.find('tbody tr');
|
||||
|
||||
var apply = function () {
|
||||
@@ -212,7 +212,7 @@ Mautic.programInitTabTable = function ($table) {
|
||||
|
||||
$th.css('cursor', 'pointer').attr('title', $table.attr('data-sort-hint') || '');
|
||||
$th.on('click', function () {
|
||||
var direction = $th.hasClass('initiative-sorted-asc') ? -1 : 1;
|
||||
var direction = $th.hasClass('program-sorted-asc') ? -1 : 1;
|
||||
var cells = [];
|
||||
|
||||
$rows.each(function () {
|
||||
@@ -243,8 +243,8 @@ Mautic.programInitTabTable = function ($table) {
|
||||
this.$row.appendTo($table.find('tbody'));
|
||||
});
|
||||
|
||||
$table.find('thead th').removeClass('initiative-sorted-asc initiative-sorted-desc');
|
||||
$th.addClass(direction > 0 ? 'initiative-sorted-asc' : 'initiative-sorted-desc');
|
||||
$table.find('thead th').removeClass('program-sorted-asc program-sorted-desc');
|
||||
$th.addClass(direction > 0 ? 'program-sorted-asc' : 'program-sorted-desc');
|
||||
$rows = $table.find('tbody tr');
|
||||
});
|
||||
});
|
||||
@@ -268,7 +268,7 @@ Mautic.planParseNumber = function (text) {
|
||||
|
||||
/**
|
||||
* Plan tabs (detail page and form):
|
||||
* - the tab last used for a plan is remembered for the browser session, and reopened when the initiative's
|
||||
* - the tab last used for a plan is remembered for the browser session, and reopened when the program's
|
||||
* detail page or form loads, so that Edit, Save and Cancel keep the same tab;
|
||||
* - after a failed save, the tabs whose pane has an error get an icon, and the first of them is
|
||||
* opened instead.
|
||||
@@ -280,18 +280,18 @@ Mautic.planParseNumber = function (text) {
|
||||
* the tab under the user. The plan's tab panes have no "fade" class: with fade, two tab('show') calls
|
||||
* within the 150 ms transition left two panes visible.
|
||||
*/
|
||||
Mautic.programInitTabs = function ($tabs, $container) {
|
||||
var initiativeId = $tabs.attr('data-initiative-id');
|
||||
var storageKey = initiativeId ? 'mautic.program.tab.' + initiativeId : null;
|
||||
Mautic.mt3sMpProgramInitTabs = function ($tabs, $container) {
|
||||
var programId = $tabs.attr('data-program-id');
|
||||
var storageKey = programId ? 'mt3s.marketing_program.tab.' + programId : null;
|
||||
var $target = null;
|
||||
|
||||
$tabs.find('a[data-toggle="tab"]').each(function () {
|
||||
var $link = mQuery(this);
|
||||
var hasError = Mautic.planPaneHasError($container.find($link.attr('href')));
|
||||
$link.toggleClass('text-danger', hasError);
|
||||
$link.find('.initiative-tab-error').remove();
|
||||
$link.find('.program-tab-error').remove();
|
||||
if (hasError) {
|
||||
$link.append(' <i class="ri-error-warning-line text-danger initiative-tab-error"></i>');
|
||||
$link.append(' <i class="ri-error-warning-line text-danger program-tab-error"></i>');
|
||||
if ($target === null) {
|
||||
$target = $link;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ Mautic.planApplyPendingTab = function () {
|
||||
}
|
||||
};
|
||||
|
||||
// Run after core's tab restore, so that the initiative's choice wins (see Mautic.programInitTabs).
|
||||
// Run after core's tab restore, so that the program's choice wins (see Mautic.mt3sMpProgramInitTabs).
|
||||
if (typeof Mautic.rememberActiveTabs === 'function' && !Mautic.rememberActiveTabs.planWrapped) {
|
||||
(function (coreRememberActiveTabs) {
|
||||
Mautic.rememberActiveTabs = function () {
|
||||
@@ -368,34 +368,34 @@ Mautic.planPaneHasError = function ($pane) {
|
||||
|
||||
/**
|
||||
* An editable list of rows built from a Symfony collection:
|
||||
* .initiative-collection[data-prototype][data-prototype-name]
|
||||
* .initiative-collection-empty, .initiative-collection-list > .initiative-collection-row, .initiative-collection-add
|
||||
* in each row: .initiative-collection-handle (drag), .initiative-collection-remove, input.initiative-row-position
|
||||
* .program-collection[data-prototype][data-prototype-name]
|
||||
* .program-collection-empty, .program-collection-list > .program-collection-row, .program-collection-add
|
||||
* in each row: .program-collection-handle (drag), .program-collection-remove, input.program-row-position
|
||||
*
|
||||
* The hidden position of every row is rewritten to its display index after each change, so the saved
|
||||
* order is the displayed order.
|
||||
*/
|
||||
Mautic.programInitCollection = function ($editor) {
|
||||
if ($editor.data('programInitialized')) {
|
||||
Mautic.mt3sMpProgramInitCollection = function ($editor) {
|
||||
if ($editor.data('mt3sMpProgramInitialized')) {
|
||||
return;
|
||||
}
|
||||
$editor.data('programInitialized', true);
|
||||
$editor.data('mt3sMpProgramInitialized', true);
|
||||
|
||||
var $list = $editor.find('.initiative-collection-list').first();
|
||||
var $list = $editor.find('.program-collection-list').first();
|
||||
var prototypeName = new RegExp($editor.attr('data-prototype-name'), 'g');
|
||||
|
||||
// New rows get indexes that were never used on this page, so they can't collide with existing ones.
|
||||
var nextIndex = $list.children('.initiative-collection-row').length;
|
||||
var nextIndex = $list.children('.program-collection-row').length;
|
||||
|
||||
var refresh = function () {
|
||||
var $rows = $list.children('.initiative-collection-row');
|
||||
var $rows = $list.children('.program-collection-row');
|
||||
$rows.each(function (index) {
|
||||
mQuery(this).find('input.initiative-row-position').val(index);
|
||||
mQuery(this).find('input.program-row-position').val(index);
|
||||
});
|
||||
$editor.find('.initiative-collection-empty').first().toggleClass('hide', $rows.length > 0);
|
||||
$editor.find('.program-collection-empty').first().toggleClass('hide', $rows.length > 0);
|
||||
};
|
||||
|
||||
$editor.on('click', '.initiative-collection-add', function (event) {
|
||||
$editor.on('click', '.program-collection-add', function (event) {
|
||||
event.preventDefault();
|
||||
var $row = mQuery($editor.attr('data-prototype').replace(prototypeName, nextIndex++));
|
||||
$list.append($row);
|
||||
@@ -403,25 +403,25 @@ Mautic.programInitCollection = function ($editor) {
|
||||
$row.find('select, input[type="text"], textarea').first().trigger('focus');
|
||||
});
|
||||
|
||||
$editor.on('click', '.initiative-collection-remove', function (event) {
|
||||
$editor.on('click', '.program-collection-remove', function (event) {
|
||||
event.preventDefault();
|
||||
mQuery(this).closest('.initiative-collection-row').remove();
|
||||
mQuery(this).closest('.program-collection-row').remove();
|
||||
refresh();
|
||||
});
|
||||
|
||||
// Typed items (description, allocation): show the selected type's description under the dropdown, and
|
||||
// its pictogram next to it. Works within a initiative-collection row.
|
||||
$editor.on('change', 'select.initiative-item-type', function () {
|
||||
// its pictogram next to it. Works within a program-collection row.
|
||||
$editor.on('change', 'select.program-item-type', function () {
|
||||
var $option = mQuery(this).find('option:selected');
|
||||
var $row = mQuery(this).closest('.initiative-collection-row');
|
||||
$row.find('.initiative-item-type-help').first().text($option.attr('data-description') || '');
|
||||
$row.find('.initiative-item-type-icon').first().attr('class', 'initiative-item-type-icon ' + ($option.attr('data-icon') || ''));
|
||||
var $row = mQuery(this).closest('.program-collection-row');
|
||||
$row.find('.program-item-type-help').first().text($option.attr('data-description') || '');
|
||||
$row.find('.program-item-type-icon').first().attr('class', 'program-item-type-icon ' + ($option.attr('data-icon') || ''));
|
||||
});
|
||||
|
||||
if (typeof $list.sortable === 'function') {
|
||||
$list.sortable({
|
||||
items: '> .initiative-collection-row',
|
||||
handle: '.initiative-collection-handle',
|
||||
items: '> .program-collection-row',
|
||||
handle: '.program-collection-handle',
|
||||
axis: 'y',
|
||||
update: refresh
|
||||
});
|
||||
@@ -452,9 +452,9 @@ Mautic.programInitCollection = function ($editor) {
|
||||
});
|
||||
|
||||
// Pictogram of an item type (description, allocation): preview the chosen icon.
|
||||
mQuery(document).on('change', '.program-config-types select.initiative-type-icon-select', function () {
|
||||
mQuery(document).on('change', '.program-config-types select.program-type-icon-select', function () {
|
||||
var icon = mQuery(this).find('option:selected').attr('data-icon') || '';
|
||||
mQuery(this).closest('.program-config-type').find('.initiative-type-icon-preview').first().attr('class', 'initiative-type-icon-preview ' + icon);
|
||||
mQuery(this).closest('.program-config-type').find('.program-type-icon-preview').first().attr('class', 'program-type-icon-preview ' + icon);
|
||||
});
|
||||
|
||||
mQuery(document).on('click', '.program-config-types .program-config-type-remove', function (event) {
|
||||
Reference in new issue
Block a user