Skip to content

Instantly share code, notes, and snippets.

@aanchalsikka
Last active March 24, 2018 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aanchalsikka/2c64ae131eb0529d9908305db4ca4791 to your computer and use it in GitHub Desktop.
Save aanchalsikka/2c64ae131eb0529d9908305db4ca4791 to your computer and use it in GitHub Desktop.
Checkbox for schema editor
var allCheckbox = $('[data-metatype=checkbox]', $form);
allCheckbox.each(function (index, checkbox) {
var $checkbox = $(checkbox);
if($checkbox.is(":checked")){
$checkbox.attr('value','true');
}
// Add false to checkbox if asset is not opened in bulk metadata editor
// see https://jira.corp.adobe.com/browse/CQ-98699 for details .
// in bulk metadata editor only checked state is considered.
else if(!($(".foundation-collection").data("foundation-selections-mode")=="multiple")){
$checkbox.attr('value','false');
}
var typeHint = $checkbox.data('typehint');
if (!typeHint) {
typeHint = 'Boolean';
}
var name = $checkbox.attr('name');
hintFields.push({
'name': name + '@TypeHint',
'value': typeHint
});
});
var allMetatypeCheckbox = $('coral-checkbox[data-metatype=checkbox]', $form);
allMetatypeCheckbox.each(function (index, coralCheckbox) {
var $coralCheckbox = $(coralCheckbox);
var $checkbox = $coralCheckbox.find("input[type='checkbox']");
if($checkbox){
if($checkbox.is(":checked")){
$checkbox.attr('value','true');
}
// Add false to checkbox if asset is not opened in bulk metadata editor
// see https://jira.corp.adobe.com/browse/CQ-98699 for details .
// in bulk metadata editor only checked state is considered.
else if(!($(".foundation-collection").data("foundation-selections-mode")=="multiple")){
$checkbox.attr('value','false');
}
var typeHint = $checkbox.data('typehint');
if (!typeHint) {
typeHint = 'Boolean';
}
var name = $checkbox.attr('name');
hintFields.push({
'name': name + '@TypeHint',
'value': typeHint
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment