Merge pull request #10381 from totten/master-purify
[civicrm-core.git] / ang / crmMailing / EditMailingCtrl.js
index 262049755088bdeb3b66b96fd1e1414e60d8f3d9..91f6db3f3aa747fc18e1b36ec30f1620bc5654ca 100644 (file)
     var block = $scope.block = crmBlocker();
     var myAutosave = null;
 
+    var templateTypes = _.where(CRM.crmMailing.templateTypes, {name: selectedMail.template_type});
+    if (!templateTypes[0]) throw 'Unrecognized template type: ' + selectedMail.template_type;
+    $scope.mailingEditorUrl = templateTypes[0].editorUrl;
+
     $scope.isSubmitted = function isSubmitted() {
       return _.size($scope.mailing.jobs) > 0;
     };
@@ -43,7 +47,7 @@
     // @return Promise
     $scope.submit = function submit(options) {
       options = options || {};
-      if (block.check() || $scope.crmMailing.$invalid) {
+      if (block.check()) {
         return;
       }