You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2019/05/15 20:51:29 UTC

[sling-org-apache-sling-app-cms] 02/07: Fixing an issue where the job form was not reloading due to the changes to the page template JS

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit f1d77e4145a8715ac53d6127c536b2ec97996c59
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu May 9 00:17:17 2019 -0400

    Fixing an issue where the job form was not reloading due to the changes
    to the page template JS
---
 ui/src/main/frontend/src/js/cms.job.js             | 42 ++++++++++++++++++++++
 .../jobs/configuration/configuration.jsp           |  2 +-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/ui/src/main/frontend/src/js/cms.job.js b/ui/src/main/frontend/src/js/cms.job.js
new file mode 100644
index 0000000..0988e9d
--- /dev/null
+++ b/ui/src/main/frontend/src/js/cms.job.js
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-env browser, es6 */
+(function (rava) {
+    'use strict';
+    
+    rava.bind('.job-properties-container', {
+        callbacks : {
+            created :  function () {
+                var container = this;
+                document.querySelector(container.dataset.source).addEventListener('change', function () {
+                    var sourceSelect = this,
+                        config = this.value;
+                    sourceSelect.disabled = true;
+                    container.innerHTML = '';
+                    fetch(container.dataset.path + config).then(function (response) {
+                        return response.text();
+                    }).then(function (formHtml) {
+                        container.innerHTML = formHtml;
+                        sourceSelect.disabled = false;
+                    });
+                });
+            }
+        }
+    });
+}(window.rava = window.rava || {}));
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/jobs/configuration/configuration.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/jobs/configuration/configuration.jsp
index 56c4c4e..bc773c8 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/jobs/configuration/configuration.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/jobs/configuration/configuration.jsp
@@ -17,5 +17,5 @@
  * under the License.
  */ --%>
 <%@include file="/libs/sling-cms/global.jsp"%>
-<div class="page-properties-container field" data-path="${resource.path}.include.html" data-source="select[name=_job]">
+<div class="job-properties-container field" data-path="${resource.path}.include.html" data-source="select[name=_job]">
 </div>
\ No newline at end of file