From 5714193eebe2369c6a6d6a34f82df37d9fbc4abf Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 25 Dec 2013 13:56:24 +0000 Subject: [PATCH] Move page style related JS code to separate files --- src/mibew/styles/pages/default/js/features.js | 48 +++++++++++++++++++ src/mibew/styles/pages/default/js/group.js | 24 ++++++++++ .../styles/pages/default/views/features.php | 41 +--------------- .../styles/pages/default/views/group.php | 18 +------ 4 files changed, 74 insertions(+), 57 deletions(-) create mode 100644 src/mibew/styles/pages/default/js/features.js create mode 100644 src/mibew/styles/pages/default/js/group.js diff --git a/src/mibew/styles/pages/default/js/features.js b/src/mibew/styles/pages/default/js/features.js new file mode 100644 index 00000000..c26de70e --- /dev/null +++ b/src/mibew/styles/pages/default/js/features.js @@ -0,0 +1,48 @@ +/** + * @preserve Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +(function($) { + function updateSurvey() { + if ($("#enablepresurvey").is(":checked")) { + $(".undersurvey").show(); + } else { + $(".undersurvey").hide(); + } + } + + function updateSSL() { + if ($("#enablessl").is(":checked")) { + $(".underssl").show(); + } else { + $(".underssl").hide(); + } + } + + function updateGroups() { + if ($("#enablegroups").is(":checked")) { + $(".undergroups").show(); + } else { + $(".undergroups").hide(); + } + } + + $(function() { + $("#enablepresurvey").change(function() { + updateSurvey(); + }); + $("#enablessl").change(function() { + updateSSL(); + }); + $("#enablegroups").change(function() { + updateGroups(); + }); + updateSurvey(); + updateSSL(); + updateGroups(); + }); +})(jQuery); \ No newline at end of file diff --git a/src/mibew/styles/pages/default/js/group.js b/src/mibew/styles/pages/default/js/group.js new file mode 100644 index 00000000..048a7d5e --- /dev/null +++ b/src/mibew/styles/pages/default/js/group.js @@ -0,0 +1,24 @@ +/** + * @preserve Copyright 2005-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +(function($) { + function updateParentGroup() { + if ($("#parentgroup").val() == '') { + $("#extrafields").show(); + } else { + $("#extrafields").hide(); + } + } + + $(function() { + $("#parentgroup").change(function() { + updateParentGroup(); + }); + updateParentGroup(); + }); +})(jQuery); diff --git a/src/mibew/styles/pages/default/views/features.php b/src/mibew/styles/pages/default/views/features.php index 665571e7..c7f76288 100644 --- a/src/mibew/styles/pages/default/views/features.php +++ b/src/mibew/styles/pages/default/views/features.php @@ -21,46 +21,7 @@ require_once(dirname(__FILE__).'/inc_tabbar.php'); function tpl_header() { global $page, $mibewroot; ?> - + - +