From: zuber Date: Sun, 27 Sep 2009 17:55:27 +0000 (+0200) Subject: Dostosowanie wielkości paska z przyciskami i edytora XML. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9c3c3bf7dd4eb215e3e215d581fa72c276b03a25?ds=sidebyside Dostosowanie wielkości paska z przyciskami i edytora XML. --- diff --git a/project/static/css/master.css b/project/static/css/master.css index 6ba367b0..dbf5c77f 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -1,6 +1,6 @@ body { margin: 0; - font: 10pt Helvetica, Verdana, sans-serif; + font: 12px Helvetica, Verdana, sans-serif; overflow: hidden; background: #AAA; } @@ -399,3 +399,14 @@ text#commit-dialog-message { top: auto; bottom: auto; height: 40px; +} + +.buttontoolbarview { + display: block; + background-color: #CCC; +} + +.buttontoolbarview a { + color: #000; + text-decoration: none; +} diff --git a/project/static/js/views/button_toolbar.js b/project/static/js/views/button_toolbar.js index ef3af784..11cc1487 100644 --- a/project/static/js/views/button_toolbar.js +++ b/project/static/js/views/button_toolbar.js @@ -23,21 +23,22 @@ 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() { var groupIndex = parseInt($(this).attr('ui:groupindex'), 10); var buttonIndex = parseInt($(this).attr('ui:buttonindex'), 10); @@ -47,6 +48,8 @@ var ButtonToolbarView = View.extend({ console.log('Executing', scriptletId, 'with params', params); scriptletCenter[scriptletId](self.parent, params); }); + + $(this.element).trigger('resize'); }, dispose: function() { diff --git a/project/static/js/views/xml.js b/project/static/js/views/xml.js index ecd27342..460317bc 100644 --- a/project/static/js/views/xml.js +++ b/project/static/js/views/xml.js @@ -12,8 +12,10 @@ var XMLView = View.extend({ this.parent = parent; this.buttonToolbar = new ButtonToolbarView( $('.xmlview-toolbar', this.element), - this.model.toolbarButtonsModel); + this.model.toolbarButtonsModel, parent); + $('.xmlview-toolbar', this.element).bind('resize.xmlview', this.resized.bind(this)); + this.parent.freeze('Ładowanie edytora...'); this.editor = new CodeMirror($('.xmlview', this.element).get(0), { parserfile: 'parsexml.js', @@ -28,6 +30,12 @@ var XMLView = View.extend({ }); }, + resized: function(event) { + var height = this.element.height() - $('.xmlview-toolbar', this.element).outerHeight(); + console.log('.xmlview height =', height); + $('.xmlview', this.element).height(height); + }, + editorDidLoad: function(editor) { $(editor.frame).css({width: '100%', height: '100%'}); this.model