From 4414d3a80488c222a54bc98309075b03cc9e37f3 Mon Sep 17 00:00:00 2001 From: zuber Date: Fri, 21 Aug 2009 14:16:55 +0200 Subject: [PATCH 01/16] =?utf8?q?Podstawowe=20=C5=82adowanie=20i=20od=C5=82?= =?utf8?q?adowywanie=20paneli=20przez=20AJAX=20(w=C5=82a=C5=9Bciwie=20AJAH?= =?utf8?q?).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/js/panels.js | 21 ++++++++++- project/templates/explorer/file_xml.html | 22 ++++++------ .../templates/explorer/panels/xmleditor.html | 35 +++++++++++++++++++ project/urls.py | 2 ++ 4 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 project/templates/explorer/panels/xmleditor.html diff --git a/project/static/js/panels.js b/project/static/js/panels.js index e5028619..eca4ddfc 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -1,3 +1,22 @@ +function loadPanel(target, url) { + console.log('ajax', url, 'into', target); + $(document).trigger('panel:unload', target); + $.ajax({ + url: url, + dataType: 'html', + success: function(data, textStatus) { + $(target).html(data); + $(document).trigger('panel:unload', target); + $(document).trigger('panel:load', target); + // panel(target); + }, + error: function(request, textStatus, errorThrown) { + $(document).trigger('panel:unload', target); + console.log('ajax', url, target, 'error:', textStatus, errorThrown); + } + }); +} + $(function() { // ======================== // = Resizable panels = @@ -17,7 +36,7 @@ $(function() { resizePanels(); $('.panel-toolbar select').change(function() { - console.log('loading panel', $(this).val(), 'into', $('.panel-contents', $(this).parent())); + loadPanel($('.panel-contents', $(this).parent().parent()), $(this).val()) }); // $('#id_folders').change(function() { // $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() { diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index ab2f2372..61405d95 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -17,12 +17,14 @@
-
- - +
+
+ + +
@@ -33,13 +35,13 @@
-
-
- {# #} +
+
+ {# #}
{# #} diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html new file mode 100644 index 00000000..356b76c1 --- /dev/null +++ b/project/templates/explorer/panels/xmleditor.html @@ -0,0 +1,35 @@ +
+ +
+ diff --git a/project/urls.py b/project/urls.py index 19f0520c..47a42748 100644 --- a/project/urls.py +++ b/project/urls.py @@ -14,6 +14,8 @@ urlpatterns = patterns('', url(r'^images/(?P[^/]+)/$', 'explorer.views.folder_images', name='folder_image'), url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'), + url(r'^panels/xmleditor$', 'django.views.generic.simple.direct_to_template', + {'template': 'explorer/panels/xmleditor.html'}, name='xmleditor'), # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/(.*)', admin.site.root), -- 2.20.1 From c3694f3c7912e1b8dd32c83b6d111af6d9412d8f Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 14:38:24 +0200 Subject: [PATCH 02/16] =?utf8?q?Zablokowanie=20event=C3=B3w=20drag=20i=20d?= =?utf8?q?raggesture=20w=20jquery.resizable.js.=20Powinno=20to=20ostateczn?= =?utf8?q?ie=20wyeliminowa=C4=87=20b=C5=82=C4=85d=20risajzowania=20w=20Fir?= =?utf8?q?efox=20<=203.5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/js/jquery.resizable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/static/js/jquery.resizable.js b/project/static/js/jquery.resizable.js index 44111ee9..c77c85b4 100644 --- a/project/static/js/jquery.resizable.js +++ b/project/static/js/jquery.resizable.js @@ -38,7 +38,9 @@ }; $(document).mousemove($.resizable.drag).mouseup($.resizable.stop); $('body').css('cursor', 'col-resize'); - }).bind('dragstart', function(event) { event.preventDefault() }); + }).bind('dragstart', function(event) { event.preventDefault(); }) + .bind('drag', function(event) { event.preventDefault(); }) + .bind('draggesture', function(event) { event.preventDefault(); }); }; })(jQuery); -- 2.20.1 From 34672fb6ded3a27e2b61959d7c5af184e3180ab9 Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 16:19:00 +0200 Subject: [PATCH 03/16] =?utf8?q?Dodanie=20marginesu=20do=20lewego=20panelu?= =?utf8?q?,=20=C5=BCeby=20jego=20zawarto=C5=9B=C4=87=20nie=20wchodzi=C5=82?= =?utf8?q?a=20na=20slider.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/templates/explorer/file_xml.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 61405d95..f57d9ea2 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -17,7 +17,7 @@
-
+
-- 2.20.1 From be97b26f386471a32186791be8f72f8ad9f6b3e1 Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 21:25:54 +0200 Subject: [PATCH 05/16] =?utf8?q?=20-=20Sensownie=20dzia=C5=82aj=C4=85cy=20?= =?utf8?q?mechanizm=20paneli.=20=20-=20Dodanie=20panelu=20z=20galeri=C4=85?= =?utf8?q?=20skan=C3=B3w.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apps/explorer/views.py | 21 ++++++++++- project/static/css/master.css | 10 ++++- project/static/js/panels.js | 11 +++++- project/templates/explorer/file_xml.html | 8 ++-- .../templates/explorer/panels/gallery.html | 33 +++++++++++++++++ .../templates/explorer/panels/xmleditor.html | 37 ++++++++++++------- project/urls.py | 6 ++- 7 files changed, 103 insertions(+), 23 deletions(-) create mode 100644 project/templates/explorer/panels/gallery.html diff --git a/apps/explorer/views.py b/apps/explorer/views.py index 8d80d029..3b3fdb1d 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -39,13 +39,32 @@ def file_xml(request, path): }) +# =============== +# = Panel views = +# =============== +def xmleditor_panel(request, path): + form = forms.BookForm() + text = repo.get_file(path).data() + + return direct_to_template(request, 'explorer/panels/xmleditor.html', extra_context={ + 'text': text, + }) + + +def gallery_panel(request, path): + return direct_to_template(request, 'explorer/panels/gallery.html', extra_context={ + 'form': forms.ImageFoldersForm(), + }) + + def file_html(request, path): return direct_to_template(request, 'explorer/file_html.html', extra_context={ 'object': html.transform(repo.get_file(path).data(), is_file=False), 'hash': path, 'image_folders_form': forms.ImageFoldersForm(), }) - + + def folder_images(request, folder): return direct_to_template(request, 'explorer/folder_images.html', extra_context={ 'images': models.get_images_from_folder(folder), diff --git a/project/static/css/master.css b/project/static/css/master.css index c9835892..a9c0a41b 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -78,7 +78,6 @@ label { /* = Panels = */ /* ========== */ .panel-wrap { - position: relative; overflow: hidden; } @@ -121,3 +120,12 @@ label { background-color: #999; cursor: col-resize; } + +/* ================= */ +/* = Gallery panel = */ +/* ================= */ +.images-wrap { + overflow-x: hidden; + overflow-y: scroll; +} + diff --git a/project/static/js/panels.js b/project/static/js/panels.js index eb1380d4..2f20a28a 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -5,7 +5,9 @@ function loadPanel(target, url) { url: url, dataType: 'html', success: function(data, textStatus) { + console.log(target, 'ajax success'); $(target).html(data); + console.log(target, 'triggering panel:load'); $(document).trigger('panel:load', target); // panel(target); }, @@ -22,15 +24,21 @@ function panel(load, unload) { unloadHandler = function(event, panel) { if (self && self == panel) { - $(document).unbind('panel:unload.' + eventId, unloadHandler); + console.log('Panel', panel, 'unloading'); + $(document).unbind('panel:unload.' + eventId); + $(panel).html(''); unload(event, panel); + console.log('Panel', panel, 'unloaded'); + return false; } }; $(document).one('panel:load', function(event, panel) { self = panel; + console.log('Panel', panel, 'loading'); $(document).bind('panel:unload.' + eventId, unloadHandler); load(event, panel); + console.log('Panel', panel, 'loaded'); }); } @@ -40,6 +48,7 @@ $(function() { // ======================== function resizePanels() { $('.panel').height($(window).height() - $('.panel').position().top); + $('.panel-contents').height($(window).height() - $('.panel-contents').position().top); $('#right-panel-wrap').width($(window).width() - $('#left-panel-wrap').outerWidth()); } diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index f57d9ea2..992bb8d4 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -21,8 +21,8 @@
@@ -35,8 +35,8 @@
diff --git a/project/templates/explorer/panels/gallery.html b/project/templates/explorer/panels/gallery.html new file mode 100644 index 00000000..d35366e1 --- /dev/null +++ b/project/templates/explorer/panels/gallery.html @@ -0,0 +1,33 @@ +
+
+
+

Aby zobaczyć obrazki wybierz folder poniżej:

+

+
+
+
+ diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index 6bdcc30b..f8d3feff 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -1,19 +1,28 @@
- +
diff --git a/project/urls.py b/project/urls.py index 47a42748..7a90ed1f 100644 --- a/project/urls.py +++ b/project/urls.py @@ -14,8 +14,10 @@ urlpatterns = patterns('', url(r'^images/(?P[^/]+)/$', 'explorer.views.folder_images', name='folder_image'), url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'), - url(r'^panels/xmleditor$', 'django.views.generic.simple.direct_to_template', - {'template': 'explorer/panels/xmleditor.html'}, name='xmleditor'), + # Editor panels + url(r'^editor/(?P[^/]+)/panels/xmleditor$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'), + url(r'^editor/(?P[^/]+)/panels/gallery$', 'explorer.views.gallery_panel', name='gallery_panel'), + # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/(.*)', admin.site.root), -- 2.20.1 From 29e85f3abb726164e4fb336fccdbffb8819c9d13 Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 23:04:21 +0200 Subject: [PATCH 06/16] =?utf8?q?jquery.lazyload=20przestaje=20sprawdza?= =?utf8?q?=C4=87=20scrollTop,=20je=C5=BCeli=20element=20nie=20ma=20atrybut?= =?utf8?q?u=20'lazyload:lastCheckedScrollTop'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/js/jquery.lazyload.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project/static/js/jquery.lazyload.js b/project/static/js/jquery.lazyload.js index 522250ff..50a183ec 100644 --- a/project/static/js/jquery.lazyload.js +++ b/project/static/js/jquery.lazyload.js @@ -23,6 +23,10 @@ } function checkScroll() { + console.log(checkScroll, container.data('lazyload:lastCheckedScrollTop')); + if (container.data('lazyload:lastCheckedScrollTop') == undefined) { + return; + } if (Math.abs(container.scrollTop() - container.data('lazyload:lastCheckedScrollTop')) > settings.scrollThreshold) { container.data('lazyload:lastCheckedScrollTop', container.scrollTop()); -- 2.20.1 From 3d36b15a04d228e79c4c1722a3545eaa14a9fa81 Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 23:11:57 +0200 Subject: [PATCH 07/16] =?utf8?q?jquery.lazyload=20przestaje=20sprawdza?= =?utf8?q?=C4=87=20scrollTop,=20je=C5=BCeli=20element=20nie=20ma=20atrybut?= =?utf8?q?u=20'lazyload:lastCheckedScrollTop'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/js/jquery.lazyload.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/project/static/js/jquery.lazyload.js b/project/static/js/jquery.lazyload.js index 522250ff..c15167bd 100644 --- a/project/static/js/jquery.lazyload.js +++ b/project/static/js/jquery.lazyload.js @@ -23,6 +23,9 @@ } function checkScroll() { + if (container.data('lazyload:lastCheckedScrollTop') == undefined) { + return; + } if (Math.abs(container.scrollTop() - container.data('lazyload:lastCheckedScrollTop')) > settings.scrollThreshold) { container.data('lazyload:lastCheckedScrollTop', container.scrollTop()); -- 2.20.1 From 1f58a10a88c18512abc9c84f49a04a18e00fa8c5 Mon Sep 17 00:00:00 2001 From: zuber Date: Sat, 22 Aug 2009 23:45:58 +0200 Subject: [PATCH 08/16] Dodanie panelu htmleditor. --- apps/explorer/views.py | 8 +++----- project/static/css/master.css | 2 +- project/static/js/panels.js | 2 +- project/templates/explorer/file_xml.html | 4 +++- .../templates/explorer/panels/htmleditor.html | 18 ++++++++++++++++++ project/urls.py | 6 +++--- 6 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 project/templates/explorer/panels/htmleditor.html diff --git a/apps/explorer/views.py b/apps/explorer/views.py index 3b3fdb1d..68fd1921 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -57,11 +57,9 @@ def gallery_panel(request, path): }) -def file_html(request, path): - return direct_to_template(request, 'explorer/file_html.html', extra_context={ - 'object': html.transform(repo.get_file(path).data(), is_file=False), - 'hash': path, - 'image_folders_form': forms.ImageFoldersForm(), +def htmleditor_panel(request, path): + return direct_to_template(request, 'explorer/panels/htmleditor.html', extra_context={ + 'html': html.transform(repo.get_file(path).data(), is_file=False), }) diff --git a/project/static/css/master.css b/project/static/css/master.css index a9c0a41b..7fa5ddac 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -124,7 +124,7 @@ label { /* ================= */ /* = Gallery panel = */ /* ================= */ -.images-wrap { +.images-wrap, .htmleditor { overflow-x: hidden; overflow-y: scroll; } diff --git a/project/static/js/panels.js b/project/static/js/panels.js index 2f20a28a..abbd2182 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -56,7 +56,7 @@ $(function() { resizePanels(); }) - $('#left-panel-wrap').bind('resizable:resize', resizePanels) + $('#left-panel-wrap').bind('resizable:stop', resizePanels) .resizable('#slider', {minWidth: 8}); resizePanels(); diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 992bb8d4..dfbbc56e 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -22,6 +22,7 @@
@@ -36,7 +37,8 @@
diff --git a/project/templates/explorer/panels/htmleditor.html b/project/templates/explorer/panels/htmleditor.html new file mode 100644 index 00000000..0eab0b28 --- /dev/null +++ b/project/templates/explorer/panels/htmleditor.html @@ -0,0 +1,18 @@ +
+
+ {{ html|safe }} +
+
+ \ No newline at end of file diff --git a/project/urls.py b/project/urls.py index 7a90ed1f..cc433c05 100644 --- a/project/urls.py +++ b/project/urls.py @@ -10,13 +10,13 @@ urlpatterns = patterns('', # Example: url(r'^$', 'explorer.views.file_list', name='file_list'), url(r'^file/(?P[^/]+)/$', 'explorer.views.file_xml', name='file_xml'), - url(r'^html/(?P[^/]+)/$', 'explorer.views.file_html', name='file_html'), url(r'^images/(?P[^/]+)/$', 'explorer.views.folder_images', name='folder_image'), url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'), # Editor panels - url(r'^editor/(?P[^/]+)/panels/xmleditor$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'), - url(r'^editor/(?P[^/]+)/panels/gallery$', 'explorer.views.gallery_panel', name='gallery_panel'), + url(r'^editor/(?P[^/]+)/panels/xmleditor/$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'), + url(r'^editor/(?P[^/]+)/panels/gallery/$', 'explorer.views.gallery_panel', name='gallery_panel'), + url(r'^editor/(?P[^/]+)/panels/htmleditor/$', 'explorer.views.htmleditor_panel', name='htmleditor_panel'), # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), -- 2.20.1 From 3b370c78b8ac967a56be8321bbd88618a52aa017 Mon Sep 17 00:00:00 2001 From: zuber Date: Sun, 23 Aug 2009 00:05:50 +0200 Subject: [PATCH 09/16] Dodanie toolbara do panelu xmleditor. --- project/static/css/master.css | 76 +++++++++++++++++++ project/templates/explorer/file_xml.html | 22 ------ .../templates/explorer/panels/xmleditor.html | 3 + 3 files changed, 79 insertions(+), 22 deletions(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index 7fa5ddac..8b971142 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -129,3 +129,79 @@ label { overflow-y: scroll; } + +/* ==================== */ +/* = XML Editor panel = */ +/* ==================== */ + +#toolbar { + height: 48px; + overflow: hidden; +} + +#toolbar, #toolbar ol, #sidebar-toolbar, #sidebar-toolbar ol { +/* overflow: hidden;*/ + display: block; + margin: 0; + padding: 0; + background-color: #CCC; + border-top: 1px solid #AAA; +} + +#sidebar-toolbar { + width: 0; +} + +#sidebar-toolbar, #sidebar-toolbar ol { + overflow: hidden; +} + +#sidebar-tabs li, #toolbar-tabs li { + font-size: 14px; + display: block; + float: left; + margin: 4px 0 -1px 4px; + padding: 2px 10px 0 10px; + background-color: #CCC; + border: 1px solid #AAA; + border-radius-topleft: 8px; + border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + -moz-border-radius-topright: 8px; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; +} + +#sidebar-tabs, #toolbar-tabs { + height: 21px; + z-index: 1000; +/* overflow: hidden;*/ +} + +#sidebar-tabs li:hover, #sidebar-tabs li.active, #toolbar-tabs li:hover, #toolbar-tabs li.active { + cursor: default; + background-color: #EEE; + border-bottom: 1px solid #EEE; +} + +#toolbar-buttons { + background-color: #EEE; + border-bottom: 1px solid #AAA; +} + +#toolbar-buttons li { + display: block; + font-size: 12px; + padding: 1px 8px; + margin: 4px; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 8px; + float: left; +} + +#toolbar-buttons li:hover { + background-color: #777; + color: #FFF; + cursor: default; +} diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index dfbbc56e..093e3044 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -1,5 +1,4 @@ {% extends "base.html" %} -{% load toolbar_tags %} {% block extrahead %} @@ -43,28 +42,7 @@
- {# #}
- {# #} - {#
#} - {#
#} - {# #} - {#
#} - {# #} - {#
 
#} - {#
#} - {#

Aby zobaczyć obrazki wybierz folder poniżej:

#} - {#

{{ image_folders_form.folders }}

#} - {#
#} - {#
#} - {#
#} - {#
#} - {# {% toolbar %} #}
{% endblock maincontent %} diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index f8d3feff..ef5976c5 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -1,4 +1,7 @@ +{% load toolbar_tags %} +
+ {% toolbar %}
- + + {% endblock extrahead %} @@ -15,22 +16,20 @@
-
-
+
-
-
+
+
+
-
+
-- 2.20.1 From 53aa67dfd12e44e9ed8fffabec228ec7a4e2d144 Mon Sep 17 00:00:00 2001 From: Lukasz Rekucki Date: Sun, 23 Aug 2009 13:16:50 +0200 Subject: [PATCH 11/16] Nothing interesting. --- project/static/js/jquery.hpanel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index ec8c1e74..bd75e9cb 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -8,14 +8,13 @@ console.log('Panel ' + mydata.panel.attr('id') + ' started resizing'); $(document).bind('mousemove', mydata, $.hpanel.resize_changed). bind('mouseup', mydata, $.hpanel.resize_stop); + $('iframe').bind('mousemove', mydata, $.hpanel.resize_changed). + bind('mouseup', mydata, $.hpanel.resize_stop); return false; }, resize_changed: function(event) { var old_width = parseInt(event.data.panel.css('width')); var delta = event.pageX + event.data.hotspot_x - old_width; - - console.log('o: ' + (old_width) + ' pX: ' + event.pageX + ' hX: ' + event.data.hotspot_x); - console.log('next_panel: ' + $(event.data.panel.next_panel).attr('id')); event.data.panel.css({'width': old_width + delta}); if(event.data.panel.next_panel) { @@ -28,6 +27,7 @@ }, resize_stop: function(event) { $(document).unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop); + $('iframe').unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop); $('body').css('cursor', 'auto'); } }; -- 2.20.1 From eee32b1483a26a3faa9ad19beb32cfd57aca6c4b Mon Sep 17 00:00:00 2001 From: Lukasz Rekucki Date: Sun, 23 Aug 2009 18:02:49 +0200 Subject: [PATCH 12/16] =?utf8?q?Automatyczna=20zmiana=20wysoko=C5=9Bci=20e?= =?utf8?q?dytora=20w=20CSS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/css/master.css | 9 +++++- project/templates/explorer/file_xml.html | 24 ++++++-------- .../templates/explorer/panels/xmleditor.html | 32 ++++++++++++++++--- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index f7450f52..bbd98155 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -80,7 +80,14 @@ label { #panels { position: absolute; - bottom: 0px; left: 0px; right: 0px; top: 100px; + bottom: 0px; left: 0px; right: 0px; top: 50px; +} + +.panels-mouse-overlay { + position: absolute; + top: 0px; bottom: 0px; left: 0px; right: 0px; + z-index: 0; + background: transparent; } .panel-wrap { diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 30c52f72..4bf439c4 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -14,34 +14,30 @@ {% block maincontent %}
+
-
-
+
-
-
+
+
-
-
- - - -
-
-
-
+ +
+
{% endblock maincontent %} diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index ef5976c5..81153085 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -1,10 +1,34 @@ {% load toolbar_tags %} -
- {% toolbar %} - +{% toolbar %} +
+
+ + + -- 2.20.1 From bf77ae4a3e1a3593c2fac8c289f177aec15602c9 Mon Sep 17 00:00:00 2001 From: Lukasz Rekucki Date: Mon, 24 Aug 2009 09:53:11 +0200 Subject: [PATCH 13/16] Overlay deleted. --- project/static/js/panels.js | 2 +- project/templates/explorer/file_xml.html | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/project/static/js/panels.js b/project/static/js/panels.js index 562d82b4..c680331b 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -57,7 +57,7 @@ $(function() { // resizePanels(); // }) - $('#panels').make_hpanel({}); + $('#panels').make_hpanel({}); // $('#left-panel-wrap').bind('resizable:stop', resizePanels) // .resizable({minWidth: 8}); diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 4bf439c4..1681d9cd 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -14,19 +14,16 @@ {% block maincontent %}
-
-
-
+
-
-
- -
+ +
+
+
-- 2.20.1 From bc45c0b826b50a6d5f472d0ebcbe92bb1b5a68c4 Mon Sep 17 00:00:00 2001 From: Lukasz Rekucki Date: Mon, 24 Aug 2009 10:05:50 +0200 Subject: [PATCH 14/16] Zmiana layout-u na divy absolute. --- project/static/css/master.css | 6 ++++-- project/static/js/panels.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index 71c9fb4b..84a91294 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -152,12 +152,14 @@ label { /* Slider between panels */ .panel-wrap .panel-slider { - position: absolute; + position: absolute; - top: 0px; bottom: 0px; right: 0px; width: 6px; + top: 0px; bottom: 0px; right: 0px; width: 6px; border-left: 1px solid #999; border-right: 1px solid #999; + border-top: none; + border-bottom: none; } .panel-wrap .panel-slider:hover { diff --git a/project/static/js/panels.js b/project/static/js/panels.js index c680331b..5d0aa08e 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -57,7 +57,8 @@ $(function() { // resizePanels(); // }) - $('#panels').make_hpanel({}); + $('#panels').make_hpanel({}); + $('#panels').css('top', ($('#header').outerHeight() ) + 'px'); // $('#left-panel-wrap').bind('resizable:stop', resizePanels) // .resizable({minWidth: 8}); -- 2.20.1 From 456187c9000834d77372cf03f7a63c7bb4d9da49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Mon, 24 Aug 2009 12:27:58 +0200 Subject: [PATCH 15/16] Ulepszone zmienianie rozmiaru. Fixes #58. --- project/static/css/master.css | 34 +++++++--- project/static/js/jquery.hpanel.js | 80 ++++++++++++++++-------- project/static/js/panels.js | 6 +- project/templates/explorer/file_xml.html | 6 +- 4 files changed, 83 insertions(+), 43 deletions(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index 84a91294..88e6583e 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -94,13 +94,6 @@ label { bottom: 0px; left: 0px; right: 0px; top: 50px; } -.panels-mouse-overlay { - position: absolute; - top: 0px; bottom: 0px; left: 0px; right: 0px; - z-index: 0; - background: transparent; -} - .panel-wrap { overflow: hidden; position: absolute; /* absolute to relation with #panels */ @@ -120,12 +113,26 @@ label { } /* contents */ -.panel-contents { +.panel-content { position: absolute; - top: 22px; left: 0px; right: 8px; bottom:0px; + top: 22px; left: 0px; bottom:0px; right: 0px; } -.panel-wrap.no-slider .panel-contents { +.panel-overlay { + position: absolute; + top: 0px; bottom: 0px; left: 0px; right: 0px; + z-index: 10; + background: gray; + opacity: 0.8; + text-align: center; + overflow: hidden; + display: none; +} + +.panel-content-overlay { +} + +.panel-wrap.last-panel .panel-content { right: 0px; } @@ -153,6 +160,7 @@ label { /* Slider between panels */ .panel-wrap .panel-slider { position: absolute; + background-color: #DDD; top: 0px; bottom: 0px; right: 0px; width: 6px; @@ -160,6 +168,8 @@ label { border-right: 1px solid #999; border-top: none; border-bottom: none; + + z-index: 5; } .panel-wrap .panel-slider:hover { @@ -167,6 +177,10 @@ label { cursor: col-resize; } +.panel-content-overlay.panel-wrap .panel-slider { + background-color: #DDD; +} + /* ================= */ /* = Gallery panel = */ /* ================= */ diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index bd75e9cb..0877400c 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -5,63 +5,89 @@ settings: {}, current_data: {}, resize_start: function(event, mydata) { - console.log('Panel ' + mydata.panel.attr('id') + ' started resizing'); + console.log('Overlay: ' + mydata.overlay); $(document).bind('mousemove', mydata, $.hpanel.resize_changed). bind('mouseup', mydata, $.hpanel.resize_stop); - $('iframe').bind('mousemove', mydata, $.hpanel.resize_changed). - bind('mouseup', mydata, $.hpanel.resize_stop); + + $('.panel-overlay', mydata.root).css('display', 'block'); return false; }, resize_changed: function(event) { - var old_width = parseInt(event.data.panel.css('width')); + var old_width = parseInt(event.data.overlay.css('width')); var delta = event.pageX + event.data.hotspot_x - old_width; - event.data.panel.css({'width': old_width + delta}); + event.data.overlay.css({'width': old_width + delta}); - if(event.data.panel.next_panel) { - var left = parseInt(event.data.panel.next_panel.css('left')); - console.log('left: ' + left + ' new_left: ' + (left+delta) ); - event.data.panel.next_panel.css('left', left+delta); + if(event.data.overlay.next) { + var left = parseInt(event.data.overlay.next.css('left')); + event.data.overlay.next.css('left', left+delta); } return false; }, resize_stop: function(event) { $(document).unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop); - $('iframe').unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop); - $('body').css('cursor', 'auto'); + // $('.panel-content', event.data.root).css('display', 'block'); + var overlays = $('.panel-content-overlay', event.data.root); + $('.panel-content-overlay', event.data.root).each(function(i) { + $(this).data('panel').css({ + 'left': $(this).css('left'), + 'width': $(this).css('width') + }); + }); + + $('.panel-overlay', event.data.root).css('display', 'none'); } }; - $.fn.make_hpanel = function(options) + $.fn.makeHorizPanel = function(options) { console.log('Making an hpanel out of "#' + $(this).attr('id') + '"'); var root = $(this) var all_panels = $('.panel-wrap', root) console.log('Panels: ' + all_panels); + /* create an overlay */ + var overlay_root = $("
"); + root.append(overlay_root); + var prev = null; all_panels.each(function(i) { var panel = $(all_panels[i]); - var handle = $('.panel-slider', panel) + var handle = $('.panel-slider', panel); - panel.next_panel = null; - if (prev) prev.next_panel = panel; + var overlay = $("

Panel #"+i+"

"); + overlay_root.append(overlay); + overlay.data('panel', panel); + overlay.data('next', null); - /* attach the trigger */ - handle.mousedown(function(event) { - var touch_data = { - panel_root: root, - panel: panel, - hotspot_x: event.pageX - handle.position().left - }; - $(this).trigger('hpanel:panel-resize-start', touch_data); - return false; - }); - prev = panel; + if( panel.hasClass('last-panel') ) + overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); + else + overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); + + if (prev) prev.next = overlay; + + if(handle) { + overlay.append(handle.clone()); + /* attach the trigger */ + handle.mousedown(function(event) { + var touch_data = { + root: root, overlay: overlay, + hotspot_x: event.pageX - handle.position().left + }; + + $(this).trigger('hpanel:panel-resize-start', touch_data); + return false; + }); + $('.panel-content', panel).css('right',handle.outerWidth() + 'px'); + $('.panel-content-overlay', panel).css('right',handle.outerWidth() + '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/static/js/panels.js b/project/static/js/panels.js index 5d0aa08e..0c8761c8 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -49,7 +49,7 @@ $(function() { // function resizePanels() { // // called on resize // $('.panel').height($(window).height() - $('.panel').position().top); -// $('.panel-contents').height($(window).height() - $('.panel-contents').position().top); +// $('.panel-content').height($(window).height() - $('.panel-contents').position().top); // $('#right-panel-wrap').width($(window).width() - $('#left-panel-wrap').outerWidth()); // } @@ -57,7 +57,7 @@ $(function() { // resizePanels(); // }) - $('#panels').make_hpanel({}); + $('#panels').makeHorizPanel({}); $('#panels').css('top', ($('#header').outerHeight() ) + 'px'); // $('#left-panel-wrap').bind('resizable:stop', resizePanels) @@ -65,7 +65,7 @@ $(function() { // resizePanels(); $('.panel-toolbar select').change(function() { - loadPanel($('.panel-contents', $(this).parent().parent()), $(this).val()) + loadPanel($('.panel-content', $(this).parent().parent()), $(this).val()) }); // $('#id_folders').change(function() { // $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() { diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 1681d9cd..c6caca69 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -22,10 +22,10 @@
-
+
-
+
-
+
{% endblock maincontent %} -- 2.20.1 From c7917ce18f0f62eac89e1eb4b6ae6d8c48133600 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Mon, 24 Aug 2009 17:55:55 +0200 Subject: [PATCH 16/16] Plugin do logowania. --- project/static/js/jquery.hpanel.js | 24 ++-- project/static/js/panels.js | 110 ++---------------- project/templates/base.html | 1 + .../templates/explorer/panels/xmleditor.html | 8 +- 4 files changed, 27 insertions(+), 116 deletions(-) diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index 0877400c..d33e47fb 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -5,7 +5,7 @@ settings: {}, current_data: {}, resize_start: function(event, mydata) { - console.log('Overlay: ' + mydata.overlay); + $.log('Overlay: ' + mydata.overlay); $(document).bind('mousemove', mydata, $.hpanel.resize_changed). bind('mouseup', mydata, $.hpanel.resize_stop); @@ -29,10 +29,12 @@ // $('.panel-content', event.data.root).css('display', 'block'); var overlays = $('.panel-content-overlay', event.data.root); $('.panel-content-overlay', event.data.root).each(function(i) { - $(this).data('panel').css({ - 'left': $(this).css('left'), - 'width': $(this).css('width') - }); + if( $(this).data('panel').hasClass('last-panel') ) + $(this).data('panel').css({ + 'left': $(this).css('left'), 'right': $(this).css('right')}); + else + $(this).data('panel').css({ + 'left': $(this).css('left'), 'width': $(this).css('width')}); }); $('.panel-overlay', event.data.root).css('display', 'none'); @@ -41,10 +43,10 @@ $.fn.makeHorizPanel = function(options) { - console.log('Making an hpanel out of "#' + $(this).attr('id') + '"'); + $.log('Making an hpanel out of "#' + $(this).attr('id') + '"'); var root = $(this) var all_panels = $('.panel-wrap', root) - console.log('Panels: ' + all_panels); + $.log('Panels: ' + all_panels); /* create an overlay */ var overlay_root = $("
"); @@ -61,7 +63,7 @@ overlay.data('panel', panel); overlay.data('next', null); - if( panel.hasClass('last-panel') ) + if( panel.hasClass('last-panel') ) overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); else overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); @@ -80,8 +82,10 @@ $(this).trigger('hpanel:panel-resize-start', touch_data); return false; }); - $('.panel-content', panel).css('right',handle.outerWidth() + 'px'); - $('.panel-content-overlay', panel).css('right',handle.outerWidth() + 'px'); + $('.panel-content', panel).css('right', + (handle.outerWidth() || 10) + 'px'); + $('.panel-content-overlay', panel).css('right', + (handle.outerWidth() || 10) + 'px'); } prev = overlay; diff --git a/project/static/js/panels.js b/project/static/js/panels.js index 0c8761c8..d5fc757d 100644 --- a/project/static/js/panels.js +++ b/project/static/js/panels.js @@ -1,18 +1,18 @@ function loadPanel(target, url) { - console.log('ajax', url, 'into', target); + $.log('ajax', url, 'into', target); $(document).trigger('panel:unload', target); $.ajax({ url: url, dataType: 'html', success: function(data, textStatus) { - console.log(target, 'ajax success'); + $.log(target, 'ajax success'); $(target).html(data); - console.log(target, 'triggering panel:load'); + $.log(target, 'triggering panel:load'); $(document).trigger('panel:load', target); // panel(target); }, error: function(request, textStatus, errorThrown) { - console.log('ajax', url, target, 'error:', textStatus, errorThrown); + $.log('ajax', url, target, 'error:', textStatus, errorThrown); } }); } @@ -24,123 +24,29 @@ function panel(load, unload) { unloadHandler = function(event, panel) { if (self && self == panel) { - console.log('Panel', panel, 'unloading'); + $.log('Panel', panel, 'unloading'); $(document).unbind('panel:unload.' + eventId); $(panel).html(''); unload(event, panel); - console.log('Panel', panel, 'unloaded'); + $.log('Panel', panel, 'unloaded'); return false; } }; $(document).one('panel:load', function(event, panel) { self = panel; - console.log('Panel', panel, 'loading'); + $.log('Panel', panel, 'loading'); $(document).bind('panel:unload.' + eventId, unloadHandler); load(event, panel); - console.log('Panel', panel, 'loaded'); + $.log('Panel', panel, 'loaded'); }); } $(function() { - // ======================== - // = Resizable panels = - // ======================== -// function resizePanels() { -// // called on resize -// $('.panel').height($(window).height() - $('.panel').position().top); -// $('.panel-content').height($(window).height() - $('.panel-contents').position().top); -// $('#right-panel-wrap').width($(window).width() - $('#left-panel-wrap').outerWidth()); -// } - -// $(window).resize(function() { -// resizePanels(); -// }) - $('#panels').makeHorizPanel({}); $('#panels').css('top', ($('#header').outerHeight() ) + 'px'); -// $('#left-panel-wrap').bind('resizable:stop', resizePanels) -// .resizable({minWidth: 8}); -// resizePanels(); - $('.panel-toolbar select').change(function() { loadPanel($('.panel-content', $(this).parent().parent()), $(this).val()) }); - // $('#id_folders').change(function() { - // $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() { - // $('#images-wrap').data('lazyload:lastCheckedScrollTop', -10000); - // }); - // }); - // - // - - // var editor = CodeMirror.fromTextArea("id_text", { - // parserfile: 'parsexml.js', - // path: "/static/js/codemirror/", - // stylesheet: "/static/css/xmlcolors.css", - // parserConfig: {useHTMLKludges: false}, - // initCallback: function() { - // $('#images').autoscroll('iframe'); - // $('.toggleAutoscroll').toggle(function() { - // $(this).html('Synchronizuj przewijanie'); - // $('#images').disableAutoscroll(); - // }, function() { - // $(this).html('Nie synchronizuj przewijania'); - // $('#images').enableAutoscroll(); - // }) - // - // // Toolbar - // $('#toolbar-tabs li').click(function() { - // var id = $(this).attr('p:button-list'); - // $('#toolbar-tabs li').removeClass('active'); - // $(this).addClass('active'); - // if (!$('#' + id).is(':visible')) { - // $('#toolbar-buttons ol').not('#' + id).hide(); - // $('#' + id).show(); - // } - // }) - // - // var keys = {}; - // $('#toolbar-buttons li').each(function() { - // var tag = $(this).attr('p:tag'); - // var handler = function() { - // var text = editor.selection(); - // editor.replaceSelection('<' + tag + '>' + text + ''); - // if (text.length == 0) { - // var pos = editor.cursorPosition(); - // editor.selectLines(pos.line, pos.character + tag.length + 2); - // } - // } - // if ($(this).attr('p:key')) { - // keys[$(this).attr('p:key')] = handler; - // } - // $(this).click(handler) - // }); - // - // editor.grabKeys(function(event) { - // if (keys[event.keyCode]) { - // keys[event.keyCode](); - // } - // }, function(event) { - // return event.altKey && keys[event.keyCode]; - // }); - // } - // }); - - - - - - // $('#toolbar-buttons li').wTooltip({ - // delay: 1000, - // style: { - // border: "1px solid #7F7D67", - // opacity: 0.9, - // background: "#FBFBC6", - // padding: "1px", - // fontSize: "12px", - // }}); - - // $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5}); }); diff --git a/project/templates/base.html b/project/templates/base.html index 9622fa4d..89ebe666 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -6,6 +6,7 @@ {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} + {% block extrahead %} {% endblock %} diff --git a/project/templates/explorer/panels/xmleditor.html b/project/templates/explorer/panels/xmleditor.html index 81153085..350f6e85 100644 --- a/project/templates/explorer/panels/xmleditor.html +++ b/project/templates/explorer/panels/xmleditor.html @@ -8,7 +8,7 @@ --> -- 2.20.1