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