if( data == this ) {
$.log('unloading', this);
$(this.contentDiv).html('');
+
+ // disconnect the toolbar
+ $('div.panel-toolbar span.panel-toolbar-extra', this.wrap).empty();
+
this.callHook('unload');
this.hooks = null; // flush the hooks
return false;
$.log('Connecting toolbar', toolbar);
if(toolbar.length == 0) return;
+ // move the extra
+ var extra_buttons = $('span.panel-toolbar-extra', toolbar);
+ var placeholder = $('div.panel-toolbar span.panel-toolbar-extra', this.wrap);
+ placeholder.replaceWith(extra_buttons);
+
+ var action_buttons = $('button', extra_buttons);
+
// connect group-switch buttons
var group_buttons = $('*.toolbar-tabs-container button', toolbar);
});
// connect action buttons
- var action_buttons = $('*.toolbar-button-groups-container button', toolbar);
- action_buttons.each(function() {
+ var allbuttons = $.makeArray(action_buttons)
+ $.merge(allbuttons,
+ $.makeArray($('*.toolbar-button-groups-container button', toolbar)) );
+
+ $(allbuttons).each(function() {
var button = $(this);
var hk = button.attr('ui:hotkey');
if(hk) hk = new Hotkey( parseInt(hk) );
var self = this;
self.rootDiv.makeHorizPanel({}); // TODO: this probably doesn't belong into jQuery
- // self.rootDiv.css('top', ($('#header').outerHeight() ) + 'px');
+ // self.rootcDiv.css('top', ($('#header').outerHeight() ) + 'px');
$('#panels > *.panel-wrap').each(function() {
var panelWrap = $(this);
$('.panel-toolbar select', panelWrap).change(function() {
var url = $(this).val();
- panelWrap.data('ctrl').load(url);
self.savePanelOptions();
+ panelWrap.data('ctrl').load(url);
});
$('.panel-toolbar button.refresh-button', panelWrap).click(
totalWidth += panelWidth;
}
$.log('panel:', this, $(this).css('left'));
- $('.panel-toolbar select', this).val(
- $('.panel-toolbar option[name=' + self.options.panels[index].name + ']', this).attr('value')
- )
+ $('.panel-toolbar option', this).each(function() {
+ if ($(this).attr('p:panel-name') == self.options.panels[index].name) {
+ $(this).parent('select').val($(this).attr('value'));
+ }
+ });
});
}
var panels = [];
$('.panel-wrap', self.rootDiv).not('.panel-content-overlay').each(function() {
panels.push({
- name: $('.panel-toolbar option:selected', this).attr('name'),
+ name: $('.panel-toolbar option:selected', this).attr('p:panel-name'),
ratio: $(this).width() / self.rootDiv.width()
})
});