From d64edd8cf90a8af3e831fefe94f057e4997e3186 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 28 Mar 2019 14:26:07 +0530 Subject: [PATCH] Add handlebar helper to convert json to string --- .../devicemgt/app/modules/business-controllers/policy.js | 1 + .../cdmf.unit.policy.create/public/js/policy-create.js | 6 ++++++ .../units/cdmf.unit.policy.edit/public/js/policy-edit.js | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js index e36069f8025..1c84db0261d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/policy.js @@ -223,6 +223,7 @@ policyModule = function () { appObjectToView = {}; appObjectToView["appName"] = appObjectFromRestEndpoint["name"]; appObjectToView["appId"] = appObjectFromRestEndpoint["id"]; + appObjectToView["webUrl"] = appObjectFromRestEndpoint["appmeta"]["weburl"]; if ("webapp" === appObjectFromRestEndpoint["platform"]) { appObjectToView["packageName"] = appObjectFromRestEndpoint["appmeta"]["weburl"]; appObjectToView["type"] = "Web Clip" diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js index ca52864f3f5..c7701e5cd99 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js @@ -504,6 +504,12 @@ function formatRepoSelection(user) { $(document).ready(function () { + + // Handlebar helper to convert JSON to String + Handlebars.registerHelper("json", function (jsonObject) { + return JSON.stringify(jsonObject); + }); + $("#users-input").select2({ multiple: true, tags: false, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index 5ae9a68539c..fd34ccc5a60 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -599,6 +599,12 @@ var formatRepoSelection = function (user) { $(document).ready(function () { + + // Handlebar helper to convert JSON to String + Handlebars.registerHelper("json", function (jsonObject) { + return JSON.stringify(jsonObject); + }); + // Adding initial state of wizard-steps. $("#users-input").select2({ multiple: true, @@ -755,5 +761,4 @@ $(document).ready(function () { $("." + nextStep).removeClass("hidden"); } }); - }); \ No newline at end of file