diff --git a/webapp/web/js/menupage/menuManagementUtils.js b/webapp/web/js/menupage/menuManagementUtils.js deleted file mode 100644 index 65f975e50..000000000 --- a/webapp/web/js/menupage/menuManagementUtils.js +++ /dev/null @@ -1,47 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -// menu management util tools - -$(document).ready(function(){ - - // reveal/unveil custom template field - $('input.default-template').click(function(){ - if ( this.checked ) { - // If checked, hide this input element - $('#custom-template').addClass('hidden'); - } - else { - // if not checked, display them - $('#custom-template').removeClass('hidden'); - } - }); - - $('input.custom-template').click(function(){ - if ( this.checked ) { - // If checked, hide this input element - $('#custom-template').removeClass('hidden'); - // And clear any values entered in the password fields - //$('input[name=confirmPassword]').val(""); - } - //else { - // if not checked, display them - // $('#custom-template').removeClass('hidden'); - //} - }); - - // Check/unckeck all account for deletion - $('input:checkbox[name=allSelected]').click(function(){ - if ( this.checked ) { - // if checked, select all the checkboxes - $('input:checkbox[name=classInClassGroup]').attr('checked','checked'); - - } else { - // if not checked, deselect all the checkboxes - $('input:checkbox[name=classInClassGroup]').removeAttr('checked'); - } - }); - - $('input:checkbox[name=classInClassGroup]').click(function(){ - $('input:checkbox[name=allSelected]').removeAttr('checked'); - }); -}); \ No newline at end of file diff --git a/webapp/web/js/menupage/menumanagement_edit.js b/webapp/web/js/menupage/menumanagement_edit.js index 037113b9b..0a09c91d2 100644 --- a/webapp/web/js/menupage/menumanagement_edit.js +++ b/webapp/web/js/menupage/menumanagement_edit.js @@ -2,19 +2,23 @@ var menuManagementEdit = { onLoad: function() { - this.initObjects(); - this.bindEventListeners(); + this.initObjects(); + this.bindEventListeners(); + this.toggleClassSelection(); }, initObjects: function() { - this.changeContentType = $('#changeContentType'); - this.selectContentType = $('#selectContentType'); - this.existingContentType = $('#existingContentType'); - this.selectClassGroupDropdown = $('#selectClassGroup'); - this.classesForClassGroup = $('#classesInSelectedGroup'); - this.selectedGroupForPage = $('#selectedContentTypeValue'); - this.selectClassesMessage = $('#selectClassesMessage'); - this.allClassesSelectedCheckbox = $('#allSelected'); - + this.defaultTemplateRadio = $('input.default-template'); + this.customTemplateRadio = $('input.custom-template'); + this.customTemplate = $('#custom-template'); + this.changeContentType = $('#changeContentType'); + this.selectContentType = $('#selectContentType'); + this.existingContentType = $('#existingContentType'); + this.selectClassGroupDropdown = $('#selectClassGroup'); + this.classesForClassGroup = $('#classesInSelectedGroup'); + this.selectedGroupForPage = $('#selectedContentTypeValue'); + this.selectClassesMessage = $('#selectClassesMessage'); + this.allClassesSelectedCheckbox = $('#allSelected'); + }, bindEventListeners: function() { // Listeners for vClass switching @@ -23,84 +27,107 @@ var menuManagementEdit = { return false; }); this.selectClassGroupDropdown.change(function() { - menuManagementEdit.chooseClassGroup(); + menuManagementEdit.chooseClassGroup(); }); - this.allClassesSelectedCheckbox.change(function() { - menuManagementEdit.toggleClassSelection(); + // this.allClassesSelectedCheckbox.change(function() { + // menuManagementEdit.toggleClassSelection(); + // }); + + // Listeners for template field + this.defaultTemplateRadio.click(function(){ + menuManagementEdit.customTemplate.addClass('hidden'); + }); + this.customTemplateRadio.click(function(){ + // If checked, hide this input element + menuManagementEdit.customTemplate.removeClass('hidden'); }); }, showClassGroups: function() { - if(!this.existingContentType.hasClass("hidden")) { - this.existingContentType.addClass("hidden"); - this.selectClassesMessage.addClass("hidden"); - this.classesForClassGroup.addClass("hidden"); - } - this.selectContentType.removeClass("hidden"); + if(!this.existingContentType.hasClass("hidden")) { + this.existingContentType.addClass("hidden"); + this.selectClassesMessage.addClass("hidden"); + this.classesForClassGroup.addClass("hidden"); + } + this.selectContentType.removeClass("hidden"); }, hideClassGroups: function() { - if(!this.selectContentType.hasClass("hidden")) { - - this.selectContentType.addClass("hidden"); - } - this.existingContentType.removeClass("hidden"); - this.selectClassesMessage.removeClass("hidden"); - this.classesForClassGroup.removeClass("hidden"); + if(!this.selectContentType.hasClass("hidden")) { + + this.selectContentType.addClass("hidden"); + } + this.existingContentType.removeClass("hidden"); + this.selectClassesMessage.removeClass("hidden"); + this.classesForClassGroup.removeClass("hidden"); }, - toggleClassSelection:function() { - /*To do: please fix so selecting all selects all classes and deselecting - * any class will deselect all - */ - /* - if(this.allClassesSelectedCheckbox.is(':checked')) { - $('#classInClassGroup').attr('checked', 'checked'); - } else { - $('#classInClassGroup').removeAttr('checked'); - }*/ + toggleClassSelection: function() { + /*To do: please fix so selecting all selects all classes and deselecting + * any class will deselect all + */ + /* + if(this.allClassesSelectedCheckbox.is(':checked')) { + $('#classInClassGroup').attr('checked', 'checked'); + } else { + $('#classInClassGroup').removeAttr('checked'); + }*/ + // Check/unckeck all classes for selection + $('input:checkbox[name=allSelected]').click(function(){ + // alert($('input:checkbox[name=classInClassGroup]')); + if ( this.checked ) { + // if checked, select all the checkboxes + $('input:checkbox[name=classInClassGroup]').attr('checked','checked'); + + } else { + // if not checked, deselect all the checkboxes + $('input:checkbox[name=classInClassGroup]').removeAttr('checked'); + } + }); + + $('input:checkbox[name=classInClassGroup]').click(function(){ + $('input:checkbox[name=allSelected]').removeAttr('checked'); + }); }, - chooseClassGroup: function() { - - var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri="; - var vclassUri = this.selectClassGroupDropdown.val(); - url += encodeURIComponent(vclassUri); - //Make ajax call to retrieve vclasses - $.getJSON(url, function(results) { - - if ( results.classes.length == 0 ) { - + chooseClassGroup: function() { + var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri="; + var vclassUri = this.selectClassGroupDropdown.val(); + url += encodeURIComponent(vclassUri); + //Make ajax call to retrieve vclasses + $.getJSON(url, function(results) { + + if ( results.classes.length == 0 ) { + } else { - //update existing content type with correct class group name and hide class group select again - var _this = menuManagementEdit; - menuManagementEdit.hideClassGroups(); - - menuManagementEdit.selectedGroupForPage.html(results.classGroupName); - //retrieve classes for class group and display with all selected - menuManagementEdit.classesForClassGroup.empty(); - var appendHtml = '