silverstripe-framework/javascript/ToggleCompositeField.js
Andrew Short aa67b56b10 ENHANCEMENT: Refactored ToggleCompositeField.
* Use jquery ui accordion for the field, and implemented an admin theme.
* Made the setting of configuration consistent with other form fields.
* ToggleComposteField->startClosed() has been deprecated in favour of
  setStartClosed().
* Removed public access to the heading level, instead use getHeadingLevel()
  or setHeadingLevel().
2012-06-13 14:20:27 +10:00

27 lines
500 B
JavaScript

(function($){
$.entwine('ss', function($){
$('.ss-toggle').entwine({
onmatch: function() {
var self = $(this);
var opts = { collapsible: true };
var tab = self.parents(".ss-tabset");
if(self.hasClass("ss-toggle-start-closed")) {
opts.active = false;
}
if(tab.length) {
tab.bind("tabsshow", function() {
self.accordion("resize");
});
}
this.accordion(opts);
},
onunmatch: function() {
this._super();
}
});
});
})(jQuery);