From: Łukasz Rekucki Date: Fri, 28 Aug 2009 09:43:15 +0000 (+0200) Subject: Galeria nie wypisuję, że jest nieaktualna, bo zawsze jest aktualna. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/203796649b4f3498c6b05adef07fc8cb1ee63f3b?ds=inline;hp=-c Galeria nie wypisuję, że jest nieaktualna, bo zawsze jest aktualna. --- 203796649b4f3498c6b05adef07fc8cb1ee63f3b diff --git a/apps/explorer/views.py b/apps/explorer/views.py index ea031216..896ed09c 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -76,7 +76,7 @@ def file_dc(request, path, repo): # Display the main editor view def display_editor(request, path): return direct_to_template(request, 'explorer/editor.html', extra_context={ - 'hash': path, + 'hash': path, 'panel_list': ['lewy', 'prawy'], }) # =============== diff --git a/project/static/css/master.css b/project/static/css/master.css index e665a615..1b428fde 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -144,6 +144,10 @@ label { right: 0px; } +.panel-wrap.last-panel .panel-slider { + display: none; +} + /* Toolbars with select box to change panel contents*/ .panel-toolbar { position: absolute; diff --git a/project/static/js/editor.js b/project/static/js/editor.js index b732810e..05232b23 100644 --- a/project/static/js/editor.js +++ b/project/static/js/editor.js @@ -19,13 +19,19 @@ function Panel(panelWrap) { }); } -Panel.prototype.callHook = function(hookName) { +Panel.prototype.callHook = function() { + args = $.makeArray(arguments) + var hookName = args.splice(0,1)[0] + var noHookAction = args.splice(0,1)[0] + + $.log('calling hook: ', hookName, 'with args: ', args); if(this.hooks && this.hooks[hookName]) - { -// arguments.shift(); - $.log('calling hook: ', hookName, 'with args: ', arguments); - return this.hooks[hookName].apply(this, arguments); + { + return this.hooks[hookName].apply(this, args); } + else if (noHookAction instanceof Function) + return noHookAction(args); + else return false; } Panel.prototype.load = function (url) { @@ -63,16 +69,20 @@ Panel.prototype.unload = function(event, data) { } Panel.prototype.refresh = function(event, data) { - $('.change-notification', this.wrap).fadeOut(); - $.log('refreshing view for panel ', this.current_url); - this.load(this.current_url); -// if( this.callHook('refresh') ) + reload = function() { + $.log('hard reload for panel ', this.current_url); + this.load(this.current_url); + return true; + } + + if( this.callHook('refresh', reload) ) + $('.change-notification', this.wrap).fadeOut(); } Panel.prototype.otherPanelChanged = function(other) { $.log('panel ', other, ' changed.'); - $('.change-notification', this.wrap).fadeIn(); - this.callHook('dirty'); + if(!this.callHook('dirty')) + $('.change-notification', this.wrap).fadeIn(); } Panel.prototype.markChanged = function () { @@ -90,7 +100,7 @@ Panel.prototype.unmarkChanged = function () { Panel.prototype.saveInfo = function() { var saveInfo = {}; - this.callHook('saveInfo', saveInfo); + this.callHook('saveInfo', null, saveInfo); return saveInfo; } @@ -105,6 +115,8 @@ Editor.prototype.setupUI = function() { var self = this; var panelRoot = $('#panels'); self.rootDiv = panelRoot; + + $('*.panel-wrap:last', panelRoot).addClass('last-panel'); // Set panel widths from options.panelRatios if (self.options && self.options.panelRatios) { @@ -150,6 +162,11 @@ Editor.prototype.setupUI = function() { $.log($.toJSON(self.options)); $.cookie('options', $.toJSON(self.options), { expires: 7, path: '/'}); }); + + $(document).bind('panel:contentChanged', function(event, data) { + $('#toolbar-button-save').removeAttr('disabled'); + }); + } Editor.prototype.loadConfig = function() { @@ -188,6 +205,7 @@ Editor.prototype.saveToBranch = function() { $.log('save errors: ', data.errors) else self.refreshPanels(changed_panel); + $('#toolbar-button-save').attr('disabled', 'disabled'); }, error: function(rq, tstat, err) { $.log('save error', rq, tstat, err); diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index abb7a5bc..bec82e06 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -43,7 +43,6 @@ $.fn.makeHorizPanel = function(options) { var root = $(this) - var all_panels = $('.panel-wrap', root) /* create an overlay */ var overlay_root = $("
"); @@ -51,23 +50,24 @@ var prev = null; - all_panels.each(function(i) { + $('*.panel-wrap', root).each( function() + { var panel = $(this); var handle = $('.panel-slider', panel); - var overlay = $("

Panel #"+i+"

"); + var overlay = $("
 
"); overlay_root.append(overlay); overlay.data('panel', panel); overlay.data('next', null); + if (prev) prev.next = overlay; + if( panel.hasClass('last-panel') ) + { overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); - else + } + else { overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); - - if (prev) prev.next = overlay; - - if(handle.length != 0) { - $.log('Has handle: ' + panel.attr('id') ); + $.log('Has handle: ' + panel.attr('id')); overlay.append(handle.clone()); /* attach the trigger */ handle.mousedown(function(event) { @@ -83,12 +83,12 @@ (handle.outerWidth() || 10) + 'px'); $('.panel-content-overlay', panel).css('right', (handle.outerWidth() || 10) + 'px'); - } - + }; + prev = overlay; }); - root.bind('hpanel:panel-resize-start', $.hpanel.resize_start); + root.bind('hpanel:panel-resize-start', $.hpanel.resize_start); }; })(jQuery); diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index 1e0cf30b..66320462 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -14,14 +14,15 @@ {% block breadcrumbs %}Platforma Redakcyjna ❯ plik {{ hash }}{% endblock breadcrumbs %} {% block header-toolbar %} - + {% endblock %} {% block maincontent %}
-
-
- - @@ -29,21 +30,9 @@
-
- -
-
-
- - - -
-
+
+
+ {% endfor %}
{% endblock maincontent %} diff --git a/project/templates/explorer/panels/dceditor.html b/project/templates/explorer/panels/dceditor.html index 2ca14d40..a82f796c 100644 --- a/project/templates/explorer/panels/dceditor.html +++ b/project/templates/explorer/panels/dceditor.html @@ -16,7 +16,7 @@ panel_hooks = { }); }); }, - saveInfo: function(hn, saveInfo) { + saveInfo: function(saveInfo) { var myInfo = { url: "{% url file_dc fpath %}", postData: $('form', this.contentDiv).serialize() diff --git a/project/templates/explorer/panels/gallery.html b/project/templates/explorer/panels/gallery.html index 4f5ea910..30c1c83a 100644 --- a/project/templates/explorer/panels/gallery.html +++ b/project/templates/explorer/panels/gallery.html @@ -24,6 +24,12 @@ panel_hooks = { $('.images-wrap', contentDiv).lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5} ); - } + }, + refresh: function() { + return true; // gallery is always fresh + }, + dirty: function() { + return true; // and it doesn't get dirty + } }; diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index 2803b6a1..7651ffb1 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -82,12 +82,11 @@ panel_hooks = { }, - refresh: function(hn) { - // TODO - return true; + refresh: function() { + return false; }, - saveInfo: function(hn, saveInfo) { + saveInfo: function(saveInfo) { var myInfo = { url: "{% url file_xml fpath %}", postData: {