From: zuber Date: Fri, 21 Aug 2009 12:16:55 +0000 (+0200) Subject: Podstawowe ładowanie i odładowywanie paneli przez AJAX (właściwie AJAH). X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/4414d3a80488c222a54bc98309075b03cc9e37f3 Podstawowe ładowanie i odładowywanie paneli przez AJAX (właściwie AJAH). --- 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),