Drobne poprawki wyświetlania panelu bocznego.
[redakcja.git] / project / templates / explorer / file_xml.html
1 {% extends "base.html" %}
2 {% load toolbar_tags %}
3
4 {% block extrahead %}
5     <script src="/static/js/jquery.fieldselection.js" type="text/javascript" charset="utf-8"></script>
6     <script src="/static/js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
7     <script src="/static/js/codemirror/codemirror.js" type="text/javascript" charset="utf-8"></script>
8     <script src="/static/js/jquery.autoscroll.js" type="text/javascript" charset="utf-8"></script>
9     <script src="/static/js/jquery.wtooltip.js" type="text/javascript" charset="utf-8"></script>
10     <script src="/static/js/jquery.resizable.js" type="text/javascript" charset="utf-8"></script>
11     <script type="text/javascript" charset="utf-8">        
12         $(function() {
13             $('#id_folders').change(function() {
14                 $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() {
15                     $('#images-wrap').data('lazyload:lastCheckedScrollTop', -10000);
16                 });
17             });
18             
19             function resizePanels() {
20                 $('iframe').width($(window).width() - $('#sidebar').outerWidth());
21                 $('iframe').height($(window).height() - 100);
22                 $('#toggle-sidebar').height($(window).height() - 55);
23                 $('#images-wrap').height($(window).height() - 82)
24                 $('#images-wrap, #sidebar-toolbar').width($('#sidebar').width() - 10);
25             }
26             
27             $('#toggle-sidebar').toggle(function() {
28                 $('#images-wrap').width(480);
29                 $('#sidebar').width(488);
30                 $('#images-wrap').data('lazyload:lastCheckedScrollTop', -10000);
31                 $('#sidebar-toolbar').width(480);
32                 resizePanels();
33             }, function() {
34                 $('#images-wrap').width(0);
35                 $('#sidebar').width(8);
36                 $('#sidebar-toolbar').width(0);
37                 resizePanels();
38             })
39             
40             $(window).resize(function() {
41                 resizePanels();
42             })
43             
44             var editor = CodeMirror.fromTextArea("id_text", {
45                 parserfile: 'parsexml.js',
46                 path: "/static/js/codemirror/",
47                 stylesheet: "/static/css/xmlcolors.css",
48                 parserConfig: {useHTMLKludges: false},
49                 initCallback: function() {
50                     $('#images').autoscroll('iframe');
51                     $('.toggleAutoscroll').toggle(function() {
52                         $(this).html('Synchronizuj przewijanie');
53                         $('#images').disableAutoscroll();
54                     }, function() {
55                         $(this).html('Nie synchronizuj przewijania');
56                         $('#images').enableAutoscroll();
57                     })
58                     
59                     // Toolbar
60                     $('#toolbar-tabs li').click(function() {
61                         var id = $(this).attr('p:button-list');
62                         $('#toolbar-tabs li').removeClass('active');
63                         $(this).addClass('active');
64                         if (!$('#' + id).is(':visible')) {
65                             $('#toolbar-buttons ol').not('#' + id).hide();
66                             $('#' + id).show();
67                         }
68                     })
69
70                     var keys = {};
71                     $('#toolbar-buttons li').each(function() {
72                         var tag = $(this).attr('p:tag');
73                         var handler = function() {
74                             var text = editor.selection();
75                             editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
76                             if (text.length == 0) {
77                                 var pos = editor.cursorPosition();
78                                 editor.selectLines(pos.line, pos.character + tag.length + 2);
79                             }
80                         }
81                         if ($(this).attr('p:key')) {
82                             keys[$(this).attr('p:key')] = handler;
83                         }
84                         $(this).click(handler)
85                     });
86                     
87                     editor.grabKeys(function(event) { 
88                         if (keys[event.keyCode]) {
89                             keys[event.keyCode]();
90                         }
91                     }, function(event) {
92                         return event.ctrlKey && keys[event.keyCode];
93                     });
94
95                     // $('#sidebar').bind('resizable:resize', resizePanels).resizable('#toggle-sidebar');
96                     
97                     resizePanels();
98                 }
99             });
100             
101             $('#toolbar-buttons li').wTooltip({
102                 delay: 1000, 
103                 style: {
104                     border: "1px solid #7F7D67",
105                     opacity: 0.9, 
106                     background: "#FBFBC6", 
107                     padding: "1px",
108                     fontSize: "12px",
109                 }});
110             
111             $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});
112         });
113
114     </script>
115 {% endblock extrahead %}
116
117 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
118
119 {% block maincontent %}
120     <form action="." method="post" accept-charset="utf-8">
121         <div id="panels">
122             <div id="sidebar">
123                 <div id="toggle-sidebar" style="float: right"></div>
124                 <div id="whatever">
125                     <div id="sidebar-toolbar">
126                         <ol id="sidebar-tabs">
127                             <li>Tab</li>
128                             <li>Tab 2</li>
129                         </ol>
130                     </div>
131                     <div id="images-wrap">
132
133                         <div style="clear: both; height: 0; width: 0">&nbsp;</div>
134                         <div id="images">
135                             <p>Aby zobaczyć obrazki wybierz folder poniżej:</p>
136                             <p>{{ image_folders_form.folders }}</p>
137                         </div>
138                     </div>
139                 </div>
140             </div>
141             {% toolbar %}
142             <textarea id="id_text" name="text" width="480px">{{ form.text.field.initial }}</textarea>
143         </div>
144         
145         <div id="status-bar">
146             {{ form.user.errors }} {{ form.commit_message.errors }}
147             <p>
148                 Użytkownik: {{ form.user }}
149                 Opis zmian: {{ form.commit_message }}
150                 <input type="submit" value="Zapisz"/>
151                 <a href="#" class="toggleAutoscroll" style="float: right">Nie synchronizuj przewijania</a>
152             </p>
153         </div>
154     </form>
155 {% endblock maincontent %}