1 {% extends "base.html" %}
2 {% load toolbar_tags %}
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 type="text/javascript" charset="utf-8">
11 $('#id_folders').change(function() {
12 $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() {
13 $('#images').data('lastScroll', -1000);
17 function resizePanels() {
18 $('iframe').width($(window).width() - $('#sidebar').outerWidth());
19 $('iframe').height($(window).height() - 100);
20 $('#images-wrap, #toggle-sidebar').height($(window).height() - 100);
23 $('#toggle-sidebar').toggle(function() {
24 $('#images-wrap').width(480);
25 $('#sidebar').width(488);
28 $('#images-wrap').width(0);
29 $('#sidebar').width(8);
33 $(window).resize(function() {
37 var editor = CodeMirror.fromTextArea("id_text", {
38 parserfile: 'parsexml.js',
39 path: "/static/js/codemirror/",
40 stylesheet: "/static/css/xmlcolors.css",
41 parserConfig: {useHTMLKludges: false},
42 initCallback: function() {
43 $('#images').autoscroll('iframe');
44 $('.toggleAutoscroll').toggle(function() {
45 $(this).html('Synchronizuj przewijanie');
46 $('#images').disableAutoscroll();
48 $(this).html('Nie synchronizuj przewijania');
49 $('#images').enableAutoscroll();
53 $('#toolbar-tabs li').click(function() {
54 var id = $(this).attr('p:button-list');
55 $('#toolbar-tabs li').removeClass('active');
56 $(this).addClass('active');
57 if (!$('#' + id).is(':visible')) {
58 $('#toolbar-buttons ol').not('#' + id).hide();
64 $('#toolbar-buttons li').each(function() {
65 var tag = $(this).attr('p:tag');
66 var handler = function() {
67 var text = editor.selection();
68 editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
69 if (text.length == 0) {
70 var pos = editor.cursorPosition();
71 editor.selectLines(pos.line, pos.character + tag.length + 2);
74 if ($(this).attr('p:key')) {
75 keys[$(this).attr('p:key')] = handler;
77 $(this).click(handler)
80 editor.grabKeys(function(event) {
81 console.log('handle', event, event.keyCode)
82 if (keys[event.keyCode]) {
83 keys[event.keyCode]();
85 }, function(event) { return event.ctrlKey && event.keyCode != 17; });
91 $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});
95 {% endblock extrahead %}
97 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
99 {% block maincontent %}
102 <form action="." method="post" accept-charset="utf-8">
105 <div id="images-wrap">
107 <p>Aby zobaczyć obrazki wybierz folder poniżej:</p>
108 <p>{{ image_folders_form.folders }}</p>
111 <div id="toggle-sidebar"></div>
113 <textarea id="id_text" name="text" width="480px">{{ form.text.field.initial }}</textarea>
116 <div id="status-bar">
117 {{ form.user.errors }} {{ form.commit_message.errors }}
119 Użytkownik: {{ form.user }}
120 Opis zmian: {{ form.commit_message }}
121 <input type="submit" value="Zapisz"/>
122 <a href="#" class="toggleAutoscroll" style="float: right">Nie synchronizuj przewijania</a>
126 {% endblock maincontent %}