From 23d46a6a06f55720857b0046c4ac424a746ebf14 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 22 Jun 2021 18:54:09 -0700 Subject: [PATCH] msgtplui - Workflow screen - Split implementation of translated/untranslated tables The label of "Current" is quirky in a system that doesn't support drafting workflows. --- ext/msgtplui/ang/msgtplui/ListCtrl.js | 4 -- ext/msgtplui/ang/msgtplui/Workflow.html | 26 +--------- ext/msgtplui/ang/msgtplui/Workflow.js | 5 +- .../ang/msgtplui/WorkflowTranslated.html | 50 +++++++++++++++++++ 4 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 ext/msgtplui/ang/msgtplui/WorkflowTranslated.html diff --git a/ext/msgtplui/ang/msgtplui/ListCtrl.js b/ext/msgtplui/ang/msgtplui/ListCtrl.js index d45c026943..8dc55c3f5a 100644 --- a/ext/msgtplui/ang/msgtplui/ListCtrl.js +++ b/ext/msgtplui/ang/msgtplui/ListCtrl.js @@ -40,10 +40,6 @@ } ); - $ctrl.supportsTranslation = function() { - return CRM.msgtplui.uiLanguages && _.size(CRM.msgtplui.uiLanguages) > 1; - }; - function findTranslations(record) { return _.reduce($ctrl.records, function(existing, rec){ if (rec._is_translation && record.id === rec.id) { diff --git a/ext/msgtplui/ang/msgtplui/Workflow.html b/ext/msgtplui/ang/msgtplui/Workflow.html index d8a1d2a13c..42490be24e 100644 --- a/ext/msgtplui/ang/msgtplui/Workflow.html +++ b/ext/msgtplui/ang/msgtplui/Workflow.html @@ -12,36 +12,14 @@ {{ts('Title')}} - {{ts('Locale')}} - - {{record.msg_title}} - {{record.tx_language_label || ts('Standard')}} - - - {{ts('Current')}} - - - {{ts('Current')}} - - - - - {{ts('Draft')}} - - - {{ts('Draft')}} - - - - - {{ts('Translate')}} - + + {{ts('Edit')}} diff --git a/ext/msgtplui/ang/msgtplui/Workflow.js b/ext/msgtplui/ang/msgtplui/Workflow.js index 4bd173b922..127e1d046d 100644 --- a/ext/msgtplui/ang/msgtplui/Workflow.js +++ b/ext/msgtplui/ang/msgtplui/Workflow.js @@ -6,7 +6,10 @@ reloadOnSearch: false, controller: 'MsgtpluiListCtrl', controllerAs: '$ctrl', - templateUrl: '~/msgtplui/Workflow.html', + templateUrl: function() { + var supportsTranslation = CRM.msgtplui.uiLanguages && _.size(CRM.msgtplui.uiLanguages) > 1; + return supportsTranslation ? '~/msgtplui/WorkflowTranslated.html' : '~/msgtplui/Workflow.html'; + }, resolve: { prefetch: function(crmApi4, crmStatus) { var q = crmApi4({ diff --git a/ext/msgtplui/ang/msgtplui/WorkflowTranslated.html b/ext/msgtplui/ang/msgtplui/WorkflowTranslated.html new file mode 100644 index 0000000000..0e9b9d2dec --- /dev/null +++ b/ext/msgtplui/ang/msgtplui/WorkflowTranslated.html @@ -0,0 +1,50 @@ +
+
+ +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
{{ts('Title')}}{{ts('Locale')}}
{{record.msg_title}}{{record.tx_language_label || ts('Standard')}} + + {{ts('Current')}} + + + {{ts('Current')}} + + + + {{ts('Draft')}} + + + {{ts('Draft')}} + + + + {{ts('Translate')}} + +
+ +
-- 2.25.1