merging 9989 to the trunk
This commit is contained in:
parent
083678f5b2
commit
6a63de6144
6 changed files with 79 additions and 26 deletions
|
@ -105,10 +105,11 @@ var pageManagementUtils = {
|
|||
//From original menu management edit
|
||||
this.defaultTemplateRadio = $('input.default-template');
|
||||
this.customTemplateRadio = $('input.custom-template');
|
||||
this.selfContainedTemplateRadio = $('input.selfContained-template');
|
||||
this.customTemplate = $('#custom-template');
|
||||
//In this version, these don't exist but we can consider this later
|
||||
// this.changeContentType = $('#changeContentType');
|
||||
this.selectContentType = $('#selectContentType');
|
||||
// this.selectContentType = $('#selectContentType');
|
||||
// this.existingContentType = $('#existingContentType');
|
||||
this.selectClassGroupDropdown = $('select#selectClassGroup');
|
||||
this.classesForClassGroup = $('section#classesInSelectedGroup');
|
||||
|
@ -141,7 +142,6 @@ var pageManagementUtils = {
|
|||
this.sparqlQuerySection.hide();
|
||||
this.fixedHTMLSection.hide();
|
||||
this.classesForClassGroup.addClass('hidden');
|
||||
// tlw72 this.moreContentButton.hide();
|
||||
//left side components
|
||||
//These depend on whether or not this is an existing item or not
|
||||
if(this.isAdd()) {
|
||||
|
@ -161,12 +161,22 @@ var pageManagementUtils = {
|
|||
pageManagementUtils.customTemplate.addClass('hidden');
|
||||
//Also clear custom template value so as not to submit it
|
||||
pageManagementUtils.clearInputs(pageManagementUtils.customTemplate);
|
||||
pageManagementUtils.rightSideDiv.show();
|
||||
pageManagementUtils.disablePageSave();
|
||||
});
|
||||
|
||||
this.customTemplateRadio.click( function() {
|
||||
pageManagementUtils.customTemplate.removeClass('hidden');
|
||||
pageManagementUtils.rightSideDiv.show();
|
||||
pageManagementUtils.disablePageSave();
|
||||
});
|
||||
|
||||
this.selfContainedTemplateRadio.click( function() {
|
||||
pageManagementUtils.customTemplate.removeClass('hidden');
|
||||
pageManagementUtils.rightSideDiv.hide();
|
||||
pageManagementUtils.enablePageSave();
|
||||
});
|
||||
|
||||
this.isMenuCheckbox.click( function() {
|
||||
if ( pageManagementUtils.menuSection.is(':hidden') ) {
|
||||
pageManagementUtils.menuSection.show();
|
||||
|
@ -190,6 +200,8 @@ var pageManagementUtils = {
|
|||
pageManagementUtils.sparqlQuerySection.hide();
|
||||
pageManagementUtils.contentTypeSelectOptions.eq(0).attr('selected', 'selected');
|
||||
pageManagementUtils.contentTypeSelect.focus();
|
||||
pageManagementUtils.adjustSaveButtonHeight();
|
||||
pageManagementUtils.checkSelfContainedRadio();
|
||||
});
|
||||
//replacing with menu management edit version which is extended with some of the logic below
|
||||
this.selectClassGroupDropdown.change(function() {
|
||||
|
@ -242,16 +254,19 @@ var pageManagementUtils = {
|
|||
//Form submission
|
||||
handleFormSubmission:function(event) {
|
||||
var validationError = pageManagementUtils.validateMenuItemForm();
|
||||
//Add any errors from page content sections
|
||||
validationError += pageManagementUtils.validatePageContentSections();
|
||||
//Add any errors from page content sections if necessary
|
||||
// Only validate the content sections if the self contained template section is NOT selected tlw72
|
||||
if ( !pageManagementUtils.selfContainedTemplate.is(':checked') ) {
|
||||
validationError += pageManagementUtils.validatePageContentSections();
|
||||
}
|
||||
if (validationError == "") {
|
||||
//Check if menu label needs to be page title
|
||||
pageManagementUtils.checkMenuTitleSubmission();
|
||||
//Create the appropriate json objects
|
||||
//Create the appropriate json objects if necessary
|
||||
pageManagementUtils.createPageContentForSubmission();
|
||||
pageManagementUtils.mapCustomTemplateName();
|
||||
return true;
|
||||
} else{
|
||||
|
||||
$('#error-alert').removeClass('hidden');
|
||||
$('#error-alert p').html(validationError);
|
||||
event.preventDefault();
|
||||
|
@ -278,6 +293,7 @@ var pageManagementUtils = {
|
|||
pageManagementUtils.sparqlQuerySection.hide();
|
||||
pageManagementUtils.headerBar.text("Browse Class Group - ");
|
||||
pageManagementUtils.headerBar.show();
|
||||
$('div#selfContainedDiv').hide();
|
||||
}
|
||||
if ( _this.contentTypeSelect.val() == "fixedHtml" || _this.contentTypeSelect.val() == "sparqlQuery" ) {
|
||||
pageManagementUtils.classGroupSection.hide();
|
||||
|
@ -295,6 +311,7 @@ var pageManagementUtils = {
|
|||
|
||||
pageManagementUtils.headerBar.show();
|
||||
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
||||
$('div#selfContainedDiv').hide();
|
||||
}
|
||||
if ( _this.contentTypeSelect.val() == "" ) {
|
||||
pageManagementUtils.classGroupSection.hide();
|
||||
|
@ -303,6 +320,7 @@ var pageManagementUtils = {
|
|||
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
||||
pageManagementUtils.headerBar.hide();
|
||||
pageManagementUtils.headerBar.text("");
|
||||
pageManagementUtils.checkSelfContainedRadio();
|
||||
}
|
||||
//Collapse any divs for existing content if it exists
|
||||
pageManagementUtils.collapseAllExistingContent();
|
||||
|
@ -337,7 +355,6 @@ var pageManagementUtils = {
|
|||
},
|
||||
clearInputs:function($el) {
|
||||
// jquery selector :input selects all input text area select and button elements
|
||||
// $el.find("input").val(""); cannot delete the value of the done button -- tlw72
|
||||
$el.find("input").each( function() {
|
||||
if ( $(this).attr('id') != "doneWithContent" ) {
|
||||
$(this).val("");
|
||||
|
@ -445,7 +462,7 @@ var pageManagementUtils = {
|
|||
});
|
||||
|
||||
//remove button
|
||||
$newRemoveLink = $innerDiv.find('a#remove' + counter); // tlw72 changed button to link
|
||||
$newRemoveLink = $innerDiv.find('a#remove' + counter);
|
||||
//remove the content entirely
|
||||
$newRemoveLink.click(function(event) {
|
||||
//if content type of what is being deleted is browse class group, then
|
||||
|
@ -457,6 +474,7 @@ var pageManagementUtils = {
|
|||
//remove the section
|
||||
$innerDiv.parent("div").remove();
|
||||
pageManagementUtils.adjustSaveButtonHeight();
|
||||
pageManagementUtils.checkSelfContainedRadio();
|
||||
//Because this is now a link, have to prevent default action of navigating to link
|
||||
event.preventDefault();
|
||||
});
|
||||
|
@ -465,7 +483,7 @@ var pageManagementUtils = {
|
|||
createCloneObject:function(contentType, counter) {
|
||||
var originalObjectPath = 'section#' + contentType;
|
||||
var $newContentObj = $(originalObjectPath).clone();
|
||||
$newContentObj.removeClass("sparqlHtmlContent");
|
||||
$newContentObj.removeClass("contentSectionContainer");
|
||||
$newContentObj.addClass("pageContent");
|
||||
$newContentObj.attr("contentNumber", counter);
|
||||
//Save content type
|
||||
|
@ -794,6 +812,22 @@ var pageManagementUtils = {
|
|||
});
|
||||
}
|
||||
return validationErrorMsg;
|
||||
},
|
||||
|
||||
//If the selfContained-template radio is checked, copy the custom template name to the hidden
|
||||
//selfContainedTemplate input element. We need that for edit mode to select the correct radio button.
|
||||
mapCustomTemplateName:function() {
|
||||
if ( this.selfContainedTemplateRadio.is(':checked') ) {
|
||||
$("input[name='selfContainedTemplate']").val($("input[name='customTemplate']").val());
|
||||
}
|
||||
},
|
||||
|
||||
//If any content is defined, keep the selContained radio button hidden
|
||||
checkSelfContainedRadio:function() {
|
||||
if ( pageManagementUtils.savedContentDivs.html().length == 0 ) {
|
||||
$('div#selfContainedDiv').show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue