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