From: Łukasz Rekucki Date: Sun, 18 Apr 2010 10:15:34 +0000 (+0200) Subject: * Better "motto" display. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/d64a8451dafc98e8f71455a55d123d22f3368ef9?hp=00a90d6175599e055f5a84697c8388d81ac1b007 * Better "motto" display. * Had to hack on codemirror, to make line numbers bar resize properly. --- diff --git a/apps/wiki/templates/wiki/summary_view.html b/apps/wiki/templates/wiki/summary_view.html index 9835e632..f6dd3de0 100644 --- a/apps/wiki/templates/wiki/summary_view.html +++ b/apps/wiki/templates/wiki/summary_view.html @@ -2,7 +2,7 @@
- +

diff --git a/apps/wiki/views.py b/apps/wiki/views.py index 82693393..9b7d8076 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -42,9 +42,10 @@ def document_list(request, template_name='wiki/document_list.html'): @never_cache def document_detail(request, name, template_name='wiki/document_details.html'): + storage = getstorage() try: - document = getstorage().get(name) + document = storage.get(name) except DocumentNotFound: return http.HttpResponseRedirect(reverse("wiki_create_missing", args=[name])) diff --git a/lib/vstorage.py b/lib/vstorage.py index f3480744..24d5ec9d 100644 --- a/lib/vstorage.py +++ b/lib/vstorage.py @@ -269,6 +269,10 @@ class VersionedStorage(object): def page_text(self, title, revision=None): """Read unicode text of a page.""" ctx = self._find_filectx(title, revision) + + if ctx is None: + raise DocumentNotFound(title) + return ctx.data().decode(self.charset, 'replace'), ctx.filerev() def page_text_by_tag(self, title, tag): diff --git a/platforma/static/css/html.css b/platforma/static/css/html.css index ba0f8535..bd710a8c 100644 --- a/platforma/static/css/html.css +++ b/platforma/static/css/html.css @@ -159,33 +159,27 @@ } /* wersy */ -.htmlview .strofa .wers_wciety, .htmlview .strofa .wers_wciety[data-wlf-typ = -'1'] { +.htmlview .strofa .wers_wciety, .htmlview .strofa .wers_wciety[data-wlf-typ='1'] { margin-left: 1em; } -.htmlview .strofa .wers_wciety[data-wlf-typ = -'2'] { +.htmlview .strofa .wers_wciety[data-wlf-typ='2'], .htmlview .strofa .wers_cd { margin-left: 2em; } -.htmlview .strofa .wers_wciety[data-wlf-typ = -'3'] { +.htmlview .strofa .wers_wciety[data-wlf-typ='3'] { margin-left: 3em; } -.htmlview .strofa .wers_wciety[data-wlf-typ = -'4'] { +.htmlview .strofa .wers_wciety[data-wlf-typ='4'] { margin-left: 4em; } -.htmlview .strofa .wers_wciety[data-wlf-typ = -'5'] { +.htmlview .strofa .wers_wciety[data-wlf-typ='5'] { margin-left: 5em; } -.htmlview .strofa .wers_wciety[data-wlf-typ = -'6'] { +.htmlview .strofa .wers_wciety[data-wlf-typ='6'] { margin-left: 6em; } @@ -213,15 +207,21 @@ not(.strofa) > *[x-verse]::after { margin: 1.5em 0 0; } +.htmlview .motto_container { + display: inline-block; + margin: 1.5em 0 0; + clear: right; +} + .htmlview .motto { text-align: justify; - font-style: italic; - margin: 1.5em 0 0; + font-style: italic; } .htmlview p.motto_podpis { - font-size: 0.875em; - text-align: right; + position: relative; + right: -3em; + text-align: right; } .htmlview div.fragment { @@ -300,9 +300,10 @@ not(.strofa) > *[x-verse]::after { max-height: 24pt; margin-left: 0.5em; overflow: hidden; + z-index: 500; } -.utwor > .uwaga { +div[x-node] > .uwaga { float: none; padding: 0.5em 1em; margin: 1em; @@ -314,6 +315,10 @@ not(.strofa) > *[x-verse]::after { max-height: 100%; } +.htmlview .annotation-inline-box .uwaga { + max-height: 100%; +} + /* Motywy */ /* ======================== */ /* = Footnotes and themes = */ @@ -356,15 +361,12 @@ not(.strofa) > *[x-verse]::after { * Przypisy */ /* Znaczniki w tekście */ -.htmlview .annotation { - vertical-align: super; - text-decoration: none; - /* font-size: 10px; */ -} - .htmlview .annotation:before { content: "[" counter(main) "]"; counter-increment: main; + vertical-align: super; + text-decoration: none; + font-size: 66%; } .htmlview .annotation:hover { @@ -394,7 +396,7 @@ not(.strofa) > *[x-verse]::after { -webkit-border-radius: 10px; padding: 3px 5px; text-decoration: none; - z-index: 1000; + z-index: 600; } /* @@ -465,7 +467,9 @@ not(.strofa) > *[x-verse]::after { left: 70px; } -.edit-button:hover, .edit-button:active, .delete-button:hover, .delete-button:active, .accept-button:hover, .accept-button:active { +.edit-button:hover, .edit-button:active, +.delete-button:hover, .delete-button:active, +.accept-button:hover, .accept-button:active { /* color: #FFF;*/ background-color: #999; color: #FFF; @@ -562,4 +566,4 @@ not(.strofa) > *[x-verse]::after { margin: -0.25em; padding: 0.25em; border: 1px solid orange; -} +} \ No newline at end of file diff --git a/platforma/static/css/summary.css b/platforma/static/css/summary.css index 8fe3e73d..8fac6e1b 100644 --- a/platforma/static/css/summary.css +++ b/platforma/static/css/summary.css @@ -9,11 +9,13 @@ #summary-view .book-cover { float: left; margin: 1em; - min-height: 300px; - min-width: 240px; + margin-right: 2em; - max-height: 300px; - max-width: 240px; + height: 300px; + width: 212px; + + + border: 1px dashed black; } #summary-view p { @@ -23,3 +25,7 @@ #summary-view label { font-weight: bold; } + +#summary-view .book-cover { + +} diff --git a/platforma/static/img/sample_cover.png b/platforma/static/img/sample_cover.png new file mode 100644 index 00000000..eb7e7d13 Binary files /dev/null and b/platforma/static/img/sample_cover.png differ diff --git a/platforma/static/js/lib/codemirror/codemirror.js b/platforma/static/js/lib/codemirror/codemirror.js index 4eb5fb73..10202174 100644 --- a/platforma/static/js/lib/codemirror/codemirror.js +++ b/platforma/static/js/lib/codemirror/codemirror.js @@ -79,22 +79,8 @@ var CodeMirror = (function(){ var win = frame.contentWindow, doc = win.document, nums = frame.nextSibling, scroller = nums.firstChild; - var nextNum = 1, barWidth = null; - function sizeBar() { - if (!frame.offsetWidth || !win.Editor) { - for (var cur = frame; cur.parentNode; cur = cur.parentNode) { - if (cur != document) { - clearInterval(sizeInterval); - return; - } - } - } - - if (nums.offsetWidth != barWidth) { - barWidth = nums.offsetWidth; - nums.style.left = "-" + (frame.parentNode.style.marginLeft = barWidth + "px"); - } - } + var nextNum = 1; + function update() { var diff = 20 + Math.max(doc.body.offsetHeight, frame.offsetHeight) - scroller.offsetHeight; for (var n = Math.ceil(diff / 10); n > 0; n--) { @@ -104,11 +90,10 @@ var CodeMirror = (function(){ } nums.scrollTop = doc.body.scrollTop || doc.documentElement.scrollTop || 0; } - sizeBar(); + update(); win.addEventHandler(win, "scroll", update); - win.addEventHandler(win, "resize", update); - var sizeInterval = setInterval(sizeBar, 500); + win.addEventHandler(win, "resize", update); } function CodeMirror(place, options) { diff --git a/platforma/static/js/wiki/loader.js b/platforma/static/js/wiki/loader.js index 62eb25ec..34305d71 100644 --- a/platforma/static/js/wiki/loader.js +++ b/platforma/static/js/wiki/loader.js @@ -110,9 +110,7 @@ $(function() $('#loading-overlay').fadeOut(); alert("FAILURE"); } - }); - - $(window).resize(); + }); }; /* end of initialize() */ var initAll = function(a, f) { diff --git a/platforma/static/js/wiki/view_editor_source.js b/platforma/static/js/wiki/view_editor_source.js index 9dffaf04..0acd2cd9 100644 --- a/platforma/static/js/wiki/view_editor_source.js +++ b/platforma/static/js/wiki/view_editor_source.js @@ -16,13 +16,13 @@ }, iframeClass: 'xml-iframe', textWrapping: true, - lineNumbers: false, + lineNumbers: true, width: "100%", tabMode: 'spaces', indentUnit: 0, initCallback: function(){ - self.codemirror.grabKeys(function(event) { + self.codemirror.grabKeys(function(event) { if (event.button) { $(event.button).trigger('click'); event.button = null; @@ -62,8 +62,10 @@ $('.toolbar select').change(); console.log("Initialized CodeMirror"); + // textarea is no longer needed $('codemirror_placeholder').remove(); + old_callback.call(self); } }); @@ -78,12 +80,23 @@ CodeMirrorPerspective.prototype.freezeState = function() { }; + + CodeMirrorPerspective.prototype.onEnter = function(success, failure) { $.wiki.Perspective.prototype.onEnter.call(this); console.log('Entering', this.doc); this.codemirror.setCode(this.doc.text); + + /* fix line numbers bar */ + var $nums = $('.CodeMirror-line-numbers'); + var barWidth = $nums.width(); + + $(this.codemirror.frame).css('margin-left', barWidth); + $nums.css('left', -barWidth); + + $(this.codemirror.frame.contentWindow).trigger('resize'); if(success) success(); } diff --git a/platforma/static/xsl/wl2html_client.xsl b/platforma/static/xsl/wl2html_client.xsl index a5db5a1c..6dd50806 100644 --- a/platforma/static/xsl/wl2html_client.xsl +++ b/platforma/static/xsl/wl2html_client.xsl @@ -209,15 +209,32 @@ --> +
- + +
+ + +
- + + + + + + + +

@@ -226,7 +243,11 @@

-
+
+ + + +