1 {% extends "base.html" %}
4 <script src="/static/js/jquery.fieldselection.js" type="text/javascript" charset="utf-8"></script>
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 type="text/javascript" charset="utf-8">
8 function addEditorButton(label, fn) {
9 $('<button type="button">' + label + '</button>').click(function(event) {
10 var text = $('#id_text').getSelection().text;
11 $('#id_text').replaceSelection(fn(text));
12 event.preventDefault();
13 }).appendTo('#buttons');
17 $('#id_folders').change(function() {
18 $('#images').load('/images/' + $('#id_folders').val() + '/', function() {
19 $('#images').data('lastScroll', -1000);
23 function resizePanels() {
24 $('iframe').width($(window).width() - $('#sidebar').outerWidth());
25 $('iframe').height($(window).height() - 100);
26 $('#images-wrap, #toggle-sidebar').height($(window).height() - 100);
29 $('#toggle-sidebar').toggle(function() {
30 $('#images-wrap').width(480);
31 $('#sidebar').width(488);
34 $('#images-wrap').width(0);
35 $('#sidebar').width(8);
39 $(window).resize(function() {
43 var editor = CodeMirror.fromTextArea("id_text", {
44 parserfile: 'parsexml.js',
45 path: "/static/js/codemirror/",
46 stylesheet: "/static/css/xmlcolors.css",
47 parserConfig: {useHTMLKludges: false}
50 $('iframe').load(function() {
51 $($('iframe').contents()).scroll(function() {
52 var percentScrolled = $('body', this).scrollTop() / $('body', this).height();
53 $('#images-wrap').scrollTop(percentScrolled * $('#images').height());
56 setTimeout(function() {resizePanels();}, 10);
59 addEditorButton('utwór', function(text) { return '<utwor>' + text + '</utwor>'; });
60 addEditorButton('akap', function(text) { return '<akap>' + text + '</akap>'; });
62 $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});
66 {% endblock extrahead %}
68 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
70 {% block maincontent %}
71 <div id="tabs"><a href="{% url file_xml hash %}" class="active">Źródło</a><a href="{% url file_html hash %}">HTML</a><div style="clear: both; height: 0; width: 0"> </div></div>
73 <form action="." method="post" accept-charset="utf-8">
76 <div id="images-wrap">
78 <p>Aby zobaczyć obrazki wybierz folder poniżej:</p>
79 <p>{{ image_folders_form.folders }}</p>
82 <div id="toggle-sidebar"></div>
84 <textarea id="id_text" name="text" width="480px">{{ form.text.field.initial }}</textarea>
88 {{ form.user.errors }} {{ form.commit_message.errors }}
89 <p>Użytkownik: {{ form.user }} Opis zmian: {{ form.commit_message }} <input type="submit" value="Zapisz"/></p>
92 {% endblock maincontent %}