NIHVIVO-2232: Nick fixed the issue I had for showing and hiding the custom template field, and another issue selecting/deselecting classes in a class group.

This commit is contained in:
manolobevia 2011-07-14 16:41:38 +00:00
parent d37b526ad8
commit 4fca7d702e
3 changed files with 98 additions and 125 deletions

View file

@ -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');
});
});

View file

@ -4,8 +4,12 @@ var menuManagementEdit = {
onLoad: function() {
this.initObjects();
this.bindEventListeners();
this.toggleClassSelection();
},
initObjects: function() {
this.defaultTemplateRadio = $('input.default-template');
this.customTemplateRadio = $('input.custom-template');
this.customTemplate = $('#custom-template');
this.changeContentType = $('#changeContentType');
this.selectContentType = $('#selectContentType');
this.existingContentType = $('#existingContentType');
@ -25,8 +29,17 @@ var menuManagementEdit = {
this.selectClassGroupDropdown.change(function() {
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() {
@ -57,9 +70,24 @@ var menuManagementEdit = {
} 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);
@ -93,8 +121,7 @@ var menuManagementEdit = {
});
appendHtml += "</ul>";
menuManagementEdit.classesForClassGroup.append(appendHtml);
menuManagementEdit.toggleClassSelection();
}
});

View file

@ -25,23 +25,17 @@
<input type="text" name="prettyUrl" value="${prettyUrl}" role="input" />
<p class="note">(Format: /<prettyURL> - ie. /people)</p>
<#--Commented out for now -->
<p>Template<span class="requiredHint"> *</span></p>
<input type="radio" class="default-template" name="selectedTemplate" value="default" <#if selectedTemplateType = "default">checked</#if> role="radio" />
<label class="inline" for="default"> Default</label>
<br />
<input type="radio" name="selectedTemplate" class="custom-template" value="custom" <#if selectedTemplateType = "custom">checked</#if> role="input" />
<label class="inline" for="custom"> Custom template</label>
<#if selectedTemplateType = "custom">
<section id="custom-template" role="region">
<input type="text" name="customTemplate" value="${customTemplate}" size="30" role="input" /><span class="requiredHint"> *</span>
<section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region">
<input type="text" name="customTemplate" value="${customTemplate!}" size="30" role="input" /><span class="requiredHint"> *</span>
</section>
</#if>
<section id="existingContentType" name="existingContentType" ${existingClassGroupStyle} role="region">
<p>Selected content type for the associated page</p>
@ -116,4 +110,3 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/cust
<#-- Add necessary javascript files associated with this page -->
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/menumanagement_edit.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/menuManagementUtils.js"></script>')}