Skip to content

Commit

Permalink
- Use options as second param for panels
Browse files Browse the repository at this point in the history
- Add code for handling future json response to UpdateNotifier
  • Loading branch information
jmelnick committed May 14, 2011
1 parent b25439b commit cf57758
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ document.observe("dom:loaded", function()
new DevelHintBlock('.devel-hint .hints .hint[rel="block"]');
new DevelHintTemplate('.devel-hint .hints .hint[rel="template"]');

DevelGlobals.PanelManager = new DevelPanelManager('#dhmedia_devel_block_panels', '.devel-panel');
DevelGlobals.PanelManager = new DevelPanelManager('#dhmedia_devel_block_panels', {
panel: {
selector: '.devel-panel'
}
});

new DevelUpdateNotifier('#dhmedia_devel_block_frontend .update-notifier-box', '<?= Mage::getBaseUrl() ?>devel/self/hasupdate');
});
Expand Down
18 changes: 9 additions & 9 deletions js/devel/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
var DevelPanelManager = Class.create();
DevelPanelManager.prototype =
{
initialize: function(containerSelector, selector)
initialize: function(selector, options)
{
var panelManager = this;
this.panels = [];
panelManager.panels = [];

this.container = $$(containerSelector)[0];
panelManager.container = $$(selector)[0];
console.log(this.container);

this.moveHandle = new DevelPanelMoveHandle();
panelManager.moveHandle = new DevelPanelMoveHandle();

this.buttonContainer = document.createElement('div');
$(this.buttonContainer).addClassName('devel-panel-buttons');
$$('body')[0].appendChild(this.buttonContainer);
panelManager.buttonContainer = document.createElement('div');
$(panelManager.buttonContainer).addClassName('devel-panel-buttons');
$$('body')[0].appendChild(panelManager.buttonContainer);

$$(selector).each(function(panelDom) {
$$(options.panel.selector).each(function(panelDom) {
var panel = new DevelPanel(panelManager, panelDom);

panelManager.panels[panelDom.id] = panel;
Expand All @@ -34,7 +34,7 @@ DevelPanelManager.prototype =
Event.stop(e); // stop the form from submitting
});

this.addButton(btnClose);
panelManager.addButton(btnClose);
},
get: function(panelId)
{
Expand Down
6 changes: 5 additions & 1 deletion js/devel/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ DevelUpdateNotifier.prototype =
new Ajax.Request(this.hasUpdateUrl, {
method:'get',
onSuccess: function(transport) {
console.log(transport);
/* @todo: when backend implements JSON for notifiers, use something like this: */
//el.innerHtml = transport.responseJSON.text;
//transport.responseJSON.classes.each(function(classname){
// el.addClassName(classname);
//});
if (transport.responseText == 'Y') {
var html = '<font style="color:#CC3333;">Update available!</font>';
el.addClassName('has-update');
Expand Down

0 comments on commit cf57758

Please sign in to comment.