X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/38747104cc8581d642f3c5a0d78c17565cc9988c..927a991b71d9876995dd2beadee8d9ff16175a50:/project/static/js/views/button_toolbar.js diff --git a/project/static/js/views/button_toolbar.js b/project/static/js/views/button_toolbar.js index ef3af784..3e0a1488 100644 --- a/project/static/js/views/button_toolbar.js +++ b/project/static/js/views/button_toolbar.js @@ -23,30 +23,33 @@ var ButtonToolbarView = View.extend({ render: function() { $('.buttontoolbarview-tab', this.element).unbind('click.buttontoolbarview'); $('.buttontoolbarview-button', this.element).unbind('click.buttontoolbarview'); + var self = this; this.element.html(render_template(this.template, this)); $('.buttontoolbarview-tab', this.element).bind('click.buttontoolbarview', function() { var groupIndex = $(this).attr('ui:groupindex'); - $('.buttontoolbarview-group', this.element).each(function() { + $('.buttontoolbarview-group', self.element).each(function() { if ($(this).attr('ui:groupindex') == groupIndex) { $(this).show(); } else { $(this).hide(); } }); + $(self.element).trigger('resize'); }); - var self = this; - $('.buttontoolbarview-button', this.element).bind('click.buttontoolbarview', function() { + $('.buttontoolbarview-button', this.element).bind('click.buttontoolbarview', function(event) { var groupIndex = parseInt($(this).attr('ui:groupindex'), 10); var buttonIndex = parseInt($(this).attr('ui:buttonindex'), 10); var button = self.get('buttons')[groupIndex].buttons[buttonIndex]; var scriptletId = button.scriptlet_id; var params = eval('(' + button.params + ')'); // To nie powinno być potrzebne console.log('Executing', scriptletId, 'with params', params); - scriptletCenter[scriptletId](self.parent, params); + scriptletCenter.scriptlets[scriptletId](self.parent, params); }); + + $(this.element).trigger('resize'); }, dispose: function() {