From 0514c86aaaad2ec17d9aef933ca2dd62d50b7d76 Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Thu, 23 Oct 2014 15:26:50 +0530 Subject: [PATCH] review moved js code to seletate file --- CRM/Wci/Form/CreateWidget.php | 24 +----------------------- createwidget.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 createwidget.js diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index 5e935c8..cdb62d8 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -3,30 +3,7 @@ require_once 'CRM/Core/Form.php'; require_once 'wci-helper-functions.php'; require_once 'CRM/Wci/BAO/ProgressBar.php'; -?> - - -addScriptFile('org.civicrm.wci', 'createwidget.js'); parent::preProcess(); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST' ); diff --git a/createwidget.js b/createwidget.js new file mode 100644 index 0000000..9519b1f --- /dev/null +++ b/createwidget.js @@ -0,0 +1,20 @@ +// +cj(function ( $ ) { + function setState() { + if ($('#override').is(':checked') == true) { + $('#custom_template').attr("disabled",false); + } + else { + $('#custom_template').attr("disabled",true); + } + if( $('#title').val() != "") { + $('#embd_code').parents('.crm-section').show(); + } else { + $('#embd_code').parents('.crm-section').hide(); + } + } + $(document).ready(setState) + $('#override').click(setState); + +}); + -- 2.25.1