Dodanie panelu htmleditor.
authorzuber <marek@stepniowski.com>
Sat, 22 Aug 2009 21:45:58 +0000 (23:45 +0200)
committerzuber <marek@stepniowski.com>
Sat, 22 Aug 2009 21:45:58 +0000 (23:45 +0200)
apps/explorer/views.py
project/static/css/master.css
project/static/js/panels.js
project/templates/explorer/file_xml.html
project/templates/explorer/panels/htmleditor.html [new file with mode: 0644]
project/urls.py

index 3b3fdb1..68fd192 100644 (file)
@@ -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),
     })
  
 
index a9c0a41..7fa5dda 100644 (file)
@@ -124,7 +124,7 @@ label {
 /* ================= */
 /* = Gallery panel = */
 /* ================= */
-.images-wrap {
+.images-wrap, .htmleditor {
     overflow-x: hidden;
     overflow-y: scroll;
 }
index 2f20a28..abbd218 100644 (file)
@@ -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();
index 992bb8d..dfbbc56 100644 (file)
@@ -22,6 +22,7 @@
                             <label for="select-left-panel">Lewy panel:</label>
                             <select name="select-left-panel" id="select-left-panel">
                                 <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
+                                <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
                                 <option value="{% url gallery_panel hash %}">Galeria skanów</option>                            
                             </select>
                         </div>
@@ -36,7 +37,8 @@
                         <label for="select-right-panel">Prawy panel:</label>
                         <select name="select-right-panel" id="select-right-panel">
                             <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
-                            <option value="{% url gallery_panel hash %}">Galeria skanów</option>                            
+                            <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
+                            <option value="{% url gallery_panel hash %}">Galeria skanów</option>
                         </select>
                     </div>
                     <div id="right-panel-contents" class="panel-contents">
diff --git a/project/templates/explorer/panels/htmleditor.html b/project/templates/explorer/panels/htmleditor.html
new file mode 100644 (file)
index 0000000..0eab0b2
--- /dev/null
@@ -0,0 +1,18 @@
+<div class="panel">
+    <div class="htmleditor">
+        {{ html|safe }}
+    </div>
+</div>
+<script type="text/javascript" charset="utf-8">
+    (function() {
+        function resizeEditor(event, panel) {
+            var panel = panel || event.data.panel;
+            $('.htmleditor', panel).height($(panel).height());
+        }
+
+        panel(function(event, panel) {
+            $(window).bind('resize', {'panel': panel}, resizeEditor);
+            resizeEditor(null, panel);  
+        }, function(event, panel) {});
+    })()
+</script>
\ No newline at end of file
index 7a90ed1..cc433c0 100644 (file)
@@ -10,13 +10,13 @@ urlpatterns = patterns('',
     # Example:
     url(r'^$', 'explorer.views.file_list', name='file_list'),
     url(r'^file/(?P<path>[^/]+)/$', 'explorer.views.file_xml', name='file_xml'),
-    url(r'^html/(?P<path>[^/]+)/$', 'explorer.views.file_html', name='file_html'),
     url(r'^images/(?P<folder>[^/]+)/$', '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<path>[^/]+)/panels/xmleditor$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
-    url(r'^editor/(?P<path>[^/]+)/panels/gallery$', 'explorer.views.gallery_panel', name='gallery_panel'),
+    url(r'^editor/(?P<path>[^/]+)/panels/xmleditor/$', 'explorer.views.xmleditor_panel', name='xmleditor_panel'),
+    url(r'^editor/(?P<path>[^/]+)/panels/gallery/$', 'explorer.views.gallery_panel', name='gallery_panel'),
+    url(r'^editor/(?P<path>[^/]+)/panels/htmleditor/$', 'explorer.views.htmleditor_panel', name='htmleditor_panel'),
     
     # Admin panel
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),