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