From: zuber Date: Sat, 22 Aug 2009 19:25:54 +0000 (+0200) Subject: - Sensownie działający mechanizm paneli. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/be97b26f386471a32186791be8f72f8ad9f6b3e1?ds=sidebyside;hp=--cc - Sensownie działający mechanizm paneli. - Dodanie panelu z galerią skanów. --- be97b26f386471a32186791be8f72f8ad9f6b3e1 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),