Skip to content

Commit

Permalink
Change fields affected by expander, refs #9266
Browse files Browse the repository at this point in the history
Apply expander to all fields except those with only one child,
if that child is a list
  • Loading branch information
jraddaoui committed Jan 31, 2016
1 parent 76a9db3 commit cfb0385
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions js/qubit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ window.log = function()
Drupal.behaviors.expander = {
attach: function (context)
{
jQuery('div.field:not(:has(div.field)) > div:not(:has(ul, li))')
.expander({
slicePoint: 255,
expandText: '»',
expandPrefix: '... ',
userCollapseText: '«',
widow: 4,
expandEffect: 'show'
});
jQuery('div.field:not(:has(div.field)) > div').each(function (index, element) {
var $element = jQuery(element);
// Don't apply expander to fields with only one child, if that child is a list
if ($element.children().length !== 1 || !$element.children().first().is('ul')) {
$element.expander({
slicePoint: 255,
expandText: '»',
expandPrefix: '... ',
userCollapseText: '«',
widow: 4,
expandEffect: 'show'
});
}
});
}
};

0 comments on commit cfb0385

Please sign in to comment.