From 4414d3a80488c222a54bc98309075b03cc9e37f3 Mon Sep 17 00:00:00 2001 From: zuber Date: Fri, 21 Aug 2009 14:16:55 +0200 Subject: [PATCH] =?utf8?q?Podstawowe=20=C5=82adowanie=20i=20od=C5=82adowyw?= =?utf8?q?anie=20paneli=20przez=20AJAX=20(w=C5=82a=C5=9Bciwie=20AJAH).?= 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