updates for page management
This commit is contained in:
parent
7da7c3da87
commit
918451f294
7 changed files with 246 additions and 26 deletions
26
webapp/web/js/jquery.fix.clone.js
Normal file
26
webapp/web/js/jquery.fix.clone.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Textarea and select clone() bug workaround | Spencer Tipping
|
||||
// Licensed under the terms of the MIT source code license
|
||||
|
||||
// Motivation.
|
||||
// jQuery's clone() method works in most cases, but it fails to copy the value of textareas and select elements. This patch replaces jQuery's clone() method with a wrapper that fills in the
|
||||
// values after the fact.
|
||||
|
||||
// An interesting error case submitted by Piotr Przybył: If two <select> options had the same value, the clone() method would select the wrong one in the cloned box. The fix, suggested by Piotr
|
||||
// and implemented here, is to use the selectedIndex property on the <select> box itself rather than relying on jQuery's value-based val().
|
||||
|
||||
(function (original) {
|
||||
jQuery.fn.clone = function () {
|
||||
var result = original.apply(this, arguments),
|
||||
my_textareas = this.find('textarea').add(this.filter('textarea')),
|
||||
result_textareas = result.find('textarea').add(this.filter('textarea')),
|
||||
my_selects = this.find('select').add(this.filter('select')),
|
||||
result_selects = result.find('select').add(this.filter('select'));
|
||||
|
||||
for (var i = 0, l = my_textareas.length; i < l; ++i) $(result_textareas[i]).val($(my_textareas[i]).val());
|
||||
for (var i = 0, l = my_selects.length; i < l; ++i) result_selects[i].selectedIndex = my_selects[i].selectedIndex;
|
||||
|
||||
return result;
|
||||
};
|
||||
}) (jQuery.fn.clone);
|
||||
|
||||
// Generated by SDoc
|
|
@ -102,12 +102,14 @@ var pageManagementUtils = {
|
|||
bindEventListeners:function(){
|
||||
|
||||
this.defaultTemplateRadio.click( function() {
|
||||
pageManagementUtils.customTemplateRadio.addClass('hidden');
|
||||
pageManagementUtils.customTemplate.addClass('hidden');
|
||||
//Also clear custom template value so as not to submit it
|
||||
pageManagementUtils.clearInputs(pageManagementUtils.customTemplate);
|
||||
|
||||
});
|
||||
|
||||
this.customTemplateRadio.click( function() {
|
||||
pageManagementUtils.defaultTemplateRadio.removeClass('hidden');
|
||||
pageManagementUtils.customTemplate.removeClass('hidden');
|
||||
});
|
||||
|
||||
this.isMenuCheckbox.click( function() {
|
||||
|
@ -398,17 +400,20 @@ var pageManagementUtils = {
|
|||
// Check/unckeck all classes for selection
|
||||
$('input:checkbox[name=allSelected]').click(function(){
|
||||
if ( this.checked ) {
|
||||
// if checked, select all the checkboxes
|
||||
$('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
||||
// if checked, select all the checkboxes for this particular section
|
||||
$(this).closest("ul").find('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
||||
//$('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
||||
|
||||
} else {
|
||||
// if not checked, deselect all the checkboxes
|
||||
$('input:checkbox[name=classInClassGroup]').removeAttr('checked');
|
||||
$(this).closest("ul").find('input:checkbox[name=classInClassGroup]').removeAttr('checked');
|
||||
|
||||
// $('input:checkbox[name=classInClassGroup]').removeAttr('checked');
|
||||
}
|
||||
});
|
||||
|
||||
$('input:checkbox[name=classInClassGroup]').click(function(){
|
||||
$('input:checkbox[name=allSelected]').removeAttr('checked');
|
||||
$(this).closest(ul).find('input:checkbox[name=allSelected]').removeAttr('checked');
|
||||
});
|
||||
}, //This is SPECIFIC to VIVO so should be moved there
|
||||
updateInternalClassMessage:function(classGroupName) { //User has changed content type
|
||||
|
|
|
@ -10,8 +10,11 @@ var processIndividualsForClassesDataGetterContent = {
|
|||
var classGroup = pageContentSection.find("select[name='selectClassGroup']").val();
|
||||
//query model should also be an input
|
||||
//Get classes selected
|
||||
var classesSelected = pageContentSection.find("input[name='classInClassGroup']:checked").val();
|
||||
var returnObject = {classGroup:classGroup, classesSelected:classesSelected, dataGetterClass:this.dataGetterClass};
|
||||
var classesSelected = [];
|
||||
pageContentSection.find("input[name='classInClassGroup']:checked").each(function(){
|
||||
classesSelected.push($(this).val());
|
||||
});
|
||||
var returnObject = {classGroup:classGroup, classesSelectedInClassGroup:classesSelected, dataGetterClass:this.dataGetterClass};
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue