From 16c1f6ba31642aa189c514d21dcdc1b27e1dcd4e Mon Sep 17 00:00:00 2001 From: zuber Date: Wed, 19 Aug 2009 12:46:03 +0200 Subject: [PATCH] Dodanie toolbara z przyciskami. --- project/static/css/master.css | 28 ++++++- project/templates/base.html | 2 +- project/templates/explorer/file_xml.html | 100 ++++++++++++++++++----- 3 files changed, 106 insertions(+), 24 deletions(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index f699cd6d..66997a93 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -1,6 +1,6 @@ body { margin: 0; - font: 100%/1.5 Georgia, Verdana, sans-serif; + font: 14px Helvetica, Verdana, sans-serif; overflow: hidden; } @@ -127,3 +127,29 @@ p { .image-box { border-top: 1px solid #DDD; } + +#toolbar, #toolbar ol { + display: block; + margin: 0; + padding: 0; + background-color: #CCC; + border-bottom: 1px solid #AAA; +} + +#toolbar li { + display: block; + float: left; + margin: 0; + padding: 0; + border-left: 1px solid #EEE; + border-right: 1px solid #AAA; +} + +#toolbar li p, #toolbar ol li { + padding: 2px 10px; +} + +#toolbar li p:hover { + cursor:pointer; + background-color: #EEE; +} \ No newline at end of file diff --git a/project/templates/base.html b/project/templates/base.html index 7ddfc180..6e9c389f 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -1,6 +1,6 @@ - + {% block title %}Platforma Redakcyjna{% endblock %} diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index cef1800b..2d502cd9 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -47,28 +47,31 @@ $(this).html('Nie synchronizuj przewijania'); $('#images').enableAutoscroll(); }) - - keys = {} - function addEditorButton(editor, label, keyCode, fn) { + $('#toolbar li p').click(function() { + $('#toolbar ol:visible').hide(); + $(this).next('ol').show('fast'); + }) + + var keys = {}; + $('#toolbar ol li').each(function() { + var tag = $(this).attr('p:tag'); var handler = function() { var text = editor.selection(); - editor.replaceSelection(fn(text)); + editor.replaceSelection('<' + tag + '>' + text + ''); + if (text.length == 0) { + var pos = editor.cursorPosition(); + editor.selectLines(pos.line, pos.character + tag.length + 2); + } } - - keys[keyCode] = handler; - - $('').click(function(event) { - event.preventDefault(); - handler(); - }).appendTo('#buttons'); - } - - addEditorButton(editor, 'utwór', 65, function(text) { return '' + text + ''; }); - addEditorButton(editor, 'akap', 83, function(text) { return '' + text + ''; }); + if ($(this).attr('p:key')) { + keys[$(this).attr('p:key')] = handler; + } + $(this).click(handler) + }); editor.grabKeys(function(event) { - // console.log('handle', event, event.keyCode) + console.log('handle', event, event.keyCode) if (keys[event.keyCode]) { keys[event.keyCode](); } @@ -77,7 +80,7 @@ resizePanels(); } }); - + $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5}); }); @@ -87,12 +90,65 @@ {% block breadcrumbs %}Platforma Redakcyjna ❯ plik {{ hash }}{% endblock breadcrumbs %} {% block maincontent %} -
- Źródło - HTML -
+
    +
  1. +

    Nagłówki

    +
      +
    1. część/księga
    2. +
    3. rozdział
    4. +
    5. podrozdział
    6. +
    7. śródtytuł
    8. +
    9. akt
    10. +
    +
  2. +
  3. +

    Struktr. i mastery

    +
      +
    1. tagi główne
    2. +
    3. opowiadanie
    4. +
    5. powieść
    6. +
    7. dramat wiersz.
    8. +
    9. dramat wiersz./w. łam
    10. +
    11. dramat współcz.
    12. +
    13. liryka
    14. +
    15. liryka/w. łam
    16. +
    17. wywiad
    18. +
    +
  4. +
  5. +

    Dramat wiersz.

    +
      +
    1. wers m. wcięty
    2. +
    3. wers cd.
    4. +
    5. wers wcięty
    6. +
    7. wers akap.
    8. +
    9. kwestiostrofa cd.
    10. +
    11. kwestia
    12. +
    13. kwestiostrofa
    14. +
    15. strofa
    16. +
    17. strofa cd.
    18. +
    19. didask.
    20. +
    21. kwestioakap
    22. +
    +
  6. +
  7. +

    Elementy początk.

    +
      +
    1. autor
    2. +
    3. tytuł
    4. +
    5. podtytuł
    6. +
    7. nota
    8. +
    9. dedykacja
    10. +
    11. motto
    12. +
    13. motto-podp.
    14. +
    15. dzieło nadrzędne
    16. +
    +
  8. + {#
  9. Akapity i dł. cyt.
  10. #} + {#
  11. Style znakowe
  12. #} +
     
    -
+
-- 2.20.1