Experiments with new reader.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Tue, 19 Nov 2013 08:17:05 +0000 (09:17 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Tue, 19 Nov 2013 08:17:05 +0000 (09:17 +0100)
26 files changed:
apps/catalogue/templates/catalogue/book_text_new.html [new file with mode: 0644]
apps/catalogue/urls.py
apps/catalogue/views.py
apps/wolnelektury_core/static/css/new.book.css [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/box.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/info.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/menu.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/note.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/other.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/settings.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/themes.js [new file with mode: 0644]
apps/wolnelektury_core/static/js/book_text/toc.js [new file with mode: 0644]
apps/wolnelektury_core/static/scss/all.scss [deleted file]
apps/wolnelektury_core/static/scss/book_text.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/body.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/box.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/info.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/menu.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/note.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/numbering.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/other.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/settings.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/themes.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/book_text/toc.scss [new file with mode: 0644]
apps/wolnelektury_core/static/scss/main.scss [new file with mode: 0644]
wolnelektury/settings/static.py

diff --git a/apps/catalogue/templates/catalogue/book_text_new.html b/apps/catalogue/templates/catalogue/book_text_new.html
new file mode 100644 (file)
index 0000000..a993656
--- /dev/null
@@ -0,0 +1,115 @@
+<!DOCTYPE html>
+{% load i18n %}
+{% load static from staticfiles %}
+{% load chunks compressed catalogue_tags %}
+{% load thumbnail %}
+<html class="no-js">
+    <head>
+        <meta charset="utf-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+        <title>{{ book.pretty_title }} :: {% trans "Wolne Lektury" %}</title>
+        <link rel="icon" href="{% static "img/favicon.png" %}" type="image/x-icon" />
+        {% compressed_css "book_text" %}
+    </head>
+    <body>
+        <a href="#" id="menu-toggle-on">
+            >
+        </a>
+        <nav id="menu"><ul>
+            <li><a href="#" id="menu-toggle-off">
+                &lt;
+            </a></li>
+
+            <li><a href="/">
+                <img src="{% static 'img/favicon.png' %}"
+                    alt="Wolne Lektury"
+                    title="Wolne Lektury">
+                <span class="label">Wolne Lektury</span>
+            </a></li>
+
+            <li><a href="{{ book.get_absolute_url }}" id="menu-book">
+                <img src="{% thumbnail book.cover "46x64" as thumb %}{{ thumb.url }}{% empty %}{{ book.cover.url }}{% endthumbnail %}"
+                    alt="Książka"
+                    title="Książka">
+            </a></li>
+
+            {% if book.other_versions.exists %}
+                <li id="menu-other"><a href="#" data-box="other">
+                    <span class="label">Inne wersje</span>
+                </a>
+                </li>
+            {% endif %}
+
+            <li id="menu-toc"><a href="#" data-box="toc">
+                <span class="label">Spis treści</span>
+            </a></li>
+
+            <li id="menu-themes"><a href="#" data-box="themes">
+                <span class="label">Motywy</span>
+            </a></li>
+
+            <li><a href="#footnotes">
+                <span class="label">Przypisy</span>
+            </a></li>
+
+            <li id="menu-settings"><a href="#" data-box="settings">
+                <span class="label">Ustawienia</span>
+            </a></li>
+
+            <li id="menu-nota_red"><a href="#" data-box="nota_red">
+                <span class="label">Nota red.</span>
+            </a></li>
+
+            <li id="menu-info"><a href="#info" data-box="info">
+                <span class="label">Informacje</span>
+            </a></li>
+
+        </ul></nav>
+        <div id="big-pane">
+
+        <article id="main-text">
+            {{ book.html_file.read|safe }}
+        </article>
+
+
+        <article id="other-text">
+            <a id="other-text-close" href="#" style="position: absolute; top: 0;">(zamknij)</a>
+            <div id="other-text-waiter">wait...</div>
+            <div id="other-text-body" style="display: none;"></div>
+        </article>
+
+
+        <footer>
+
+            <div id="info" class="box">
+                {% book_info book %}
+            </div>
+
+            {% if book.other_versions.exists %}
+            <div class="box" id="other">
+                <h2>Inne wersje utworu</h2>
+                <ul>
+                {% for other_version in book.other_versions %}
+                    <li>{{ other_version.pretty_title }}
+                        <a class="display-other" data-other="{{ other_version.html_file.url }}" href="#">Porównaj</a>
+                    </li>
+                {% endfor %}
+                </ul>
+            </div>
+            {% endif %}
+
+            <div class="box" id="settings">
+                <h2>Ustawienia</h2>
+                <a href="#" class="settings-switch" id="settings-line-numbers" data-setting="always-hide-line-numbers">Wyświetlanie numerów linii</a><br/>
+                <a href="#" class="settings-switch" id="settings-themes" data-setting="always-hide-themes">Wyświetlanie motywów</a><br/>
+                <a href="#" class="settings-switch" id="settings-annotations" data-setting="no-annotations">Wyświetlanie przypisów</a><br/>
+            </div>
+
+        </footer>
+
+        </div>
+
+        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+        {% compressed_js "book_text" %}
+    </body>
+</html>
index 4320919..e9f6383 100644 (file)
@@ -57,6 +57,7 @@ urlpatterns += patterns('catalogue.views',
 
     # Public interface. Do not change this URLs.
     url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, 'book_text', name='book_text'),
+    url(r'^lektura/(?P<slug>%s)\.html2$' % SLUG, 'book_text2'),
     url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, 'player', name='book_player'),
     url(r'^lektura/(?P<slug>%s)/$' % SLUG, 'book_detail', name='book_detail'),
     url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
index e9b1465..50b6e3e 100644 (file)
@@ -289,6 +289,14 @@ def book_text(request, slug):
     related = book.related_info()
     return render_to_response('catalogue/book_text.html', locals(),
         context_instance=RequestContext(request))
+def book_text2(request, slug):
+    book = get_object_or_404(models.Book, slug=slug)
+
+    if not book.has_html_file():
+        raise Http404
+    related = book.related_info()
+    return render_to_response('catalogue/book_text_new.html', locals(),
+        context_instance=RequestContext(request))
 
 
 # ==========
diff --git a/apps/wolnelektury_core/static/css/new.book.css b/apps/wolnelektury_core/static/css/new.book.css
new file mode 100644 (file)
index 0000000..b148020
--- /dev/null
@@ -0,0 +1,269 @@
+body {
+    font-size: 16px;
+    font: Georgia, "Times New Roman", serif;
+    line-height: 1.5em;
+    margin: 0;
+}
+
+a {
+    color: blue;
+    text-decoration: none;
+}
+
+/* ================================== */
+/* = Header with logo and menu      = */
+/* ================================== */
+#toc ol, #themes ol {
+    list-style: none;
+    padding: 0;
+    margin: 0;
+}
+
+#toc ol li {
+    font-weight: bold;
+}
+
+#toc ol ol {
+    padding: 0 0 1.5em 1.5em;
+    margin: 0;
+}
+
+#toc ol ol li {
+    font-weight: normal;
+}
+
+#toc h2 {
+    display: none;
+}
+
+#toc .anchor {
+    float: none;
+    margin: 0;
+    color: blue;
+    font-size: 16px;
+    position: inherit;
+}
+
+#info p {
+    text-align: justify;
+    margin: 1.5em 0 0;
+}
+
+/* =================================================== */
+/* = Common elements: headings, paragraphs and lines = */
+/* =================================================== */
+h1 {
+    font-size: 3em;
+    margin: 1.5em 0;
+    text-align: center;
+    line-height: 1.5em;
+    font-weight: bold;
+}
+
+h2 {
+    font-size: 2em;
+    margin: 1.5em 0 0;
+    font-weight: bold;
+    line-height: 1.5em;
+}
+
+h3 {
+    font-size: 1.5em;
+    margin: 1.5em 0 0;
+    font-weight: normal;
+    line-height: 1.5em;
+}
+
+h4 {
+    font-size: 1em;
+    margin: 1.5em 0 0;
+    line-height: 1.5em;
+}
+
+p {
+    margin: 0;
+}
+
+/* ======================== */
+/* = Footnotes and themes = */
+/* ======================== */
+
+.annotation {
+    font-style: normal;
+    font-weight: normal;
+    font-size: 12px;
+    padding-left: 2px;
+    position: relative;
+    top: -4px;
+}
+
+#footnotes {
+    margin-top: 3em;
+}
+
+#footnotes .annotation {
+    display: block;
+    float: left;
+    width: 2.5em;
+    clear: both;
+}
+
+#footnotes div {
+    margin: 1.5em 0 0 0;
+}
+
+#footnotes p, #footnotes ul {
+    margin-left: 2.5em;
+    font-size: 0.875em;
+}
+
+#footnotes .permalink {
+    font-size: .75em;
+}
+
+blockquote {
+    font-size: 0.875em;
+}
+
+/* ============= */
+/* = Numbering = */
+/* ============= */
+.verse, .paragraph {
+    position:relative;
+}
+/*.anchor {
+    position: absolute;
+    margin: -0.25em -0.5em;
+    color: #777;
+    font-size: 12px;
+    text-align: center;
+    padding: 0.25em 0.5em;
+    line-height: 1.5em;
+}*/
+
+
+/* =================== */
+/* = Custom elements = */
+/* =================== */
+span.author {
+    font-size: 0.5em;
+    display: block;
+    line-height: 1.5em;
+    margin-bottom: 0.25em;
+}
+
+span.collection {
+    font-size: 0.375em;
+    display: block;
+    line-height: 1.5em;
+    margin-bottom: -0.25em;
+}
+
+span.subtitle {
+    font-size: 0.5em;
+    display: block;
+    line-height: 1.5em;
+    margin-top: -0.25em;
+}
+
+span.translator {
+    font-size: 0.375em;
+    display: block;
+    line-height: 1.5em;
+    margin-top: 0.25em;
+}
+
+div.didaskalia {
+    font-style: italic;
+    margin: 0.5em 0 0 1.5em;
+}
+
+div.kwestia {
+    margin: 0.5em 0 0;
+}
+
+div.stanza {
+    margin: 1.5em 0 0;
+}
+
+div.kwestia div.stanza {
+    margin: 0;
+}
+
+p.paragraph {
+    text-align: justify;
+    margin: 1.5em 0 0;
+}
+
+p.motto {
+    text-align: justify;
+    font-style: italic;
+    margin: 1.5em 0 0;
+}
+
+p.motto_podpis {
+    font-size: 0.875em;
+    text-align: right;
+}
+
+div.fragment {
+    border-bottom: 0.1em solid #999;
+    padding-bottom: 1.5em;
+}
+
+div.note p, div.dedication p, div.note p.paragraph, div.dedication p.paragraph {
+    text-align: right;
+    font-style: italic;
+}
+
+hr.spacer {
+    height: 3em;
+    visibility: hidden;
+}
+
+hr.spacer-line {
+    margin: 1.5em 0;
+    border: none;
+    border-bottom: 0.1em solid #000;
+}
+
+p.spacer-asterisk {
+    padding: 0;
+    margin: 1.5em 0;
+    text-align: center;
+}
+
+div.person-list ol {
+    list-style: none;
+    padding: 0 0 0 1.5em;
+}
+
+p.place-and-time {
+    font-style: italic;
+}
+
+em.math, em.foreign-word, em.book-title, em.didaskalia {
+    font-style: italic;
+}
+
+em.author-emphasis {
+    letter-spacing: 0.1em;
+}
+
+em.person {
+    font-style: normal;
+    font-variant: small-caps;
+}
+
+.verse:after {
+    content: "\feff";
+}
+
+
+/* =================================== */
+/* = Hide some elements for printing = */
+/* =================================== */
+
+@media print {
+    #menu {display: none;}
+}
diff --git a/apps/wolnelektury_core/static/js/book_text/box.js b/apps/wolnelektury_core/static/js/book_text/box.js
new file mode 100644 (file)
index 0000000..e26762c
--- /dev/null
@@ -0,0 +1,19 @@
+$(function() {
+    /* Toggle hidden box on click. */
+    $("nav a[data-box]").each(function() {
+        $("#" + $(this).attr("data-box")).hide();
+
+        $(this).click(function(e) {
+            e.preventDefault();
+            var showing = $(this).hasClass("active");
+            $("nav .active").each(function() {
+                $(this).removeClass("active");
+                $("#" + $(this).attr("data-box")).hide();
+            });
+            if (!showing) {
+                $(this).addClass("active");
+                $("#" + $(this).attr("data-box")).show();
+            }
+        });
+    });
+});
diff --git a/apps/wolnelektury_core/static/js/book_text/info.js b/apps/wolnelektury_core/static/js/book_text/info.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/wolnelektury_core/static/js/book_text/menu.js b/apps/wolnelektury_core/static/js/book_text/menu.js
new file mode 100644 (file)
index 0000000..3c7f57c
--- /dev/null
@@ -0,0 +1,24 @@
+(function($){$(function(){
+
+
+$('#menu-toggle-on').click(function(e) {
+    e.preventDefault();
+    var body = $("body");
+    body.removeClass("menu-hidden");
+    if (!$("#menu").is(":visible")) {
+        body.addClass("menu-showed");
+    }
+});
+
+$('#menu-toggle-off').click(function(e) {
+    e.preventDefault();
+    var body = $("body");
+    body.removeClass("menu-showed");
+    if ($("#menu").is(":visible")) {
+        body.addClass("menu-hidden");
+    }
+});
+
+
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/js/book_text/note.js b/apps/wolnelektury_core/static/js/book_text/note.js
new file mode 100644 (file)
index 0000000..2f0feaa
--- /dev/null
@@ -0,0 +1,10 @@
+(function($){$(function(){
+
+
+if ($('#nota_red li').length > 0) {
+    $("#menu-nota_red").show();
+}
+
+
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/js/book_text/other.js b/apps/wolnelektury_core/static/js/book_text/other.js
new file mode 100644 (file)
index 0000000..1956aa8
--- /dev/null
@@ -0,0 +1,36 @@
+(function($){$(function(){
+
+
+$("#menu-other").show();
+
+
+$(".display-other").click(function(e) {
+    e.preventDefault();
+
+    if ($('#big-pane').length == 0)
+        $("#other-text").show();
+    $("#other-versions").slideUp('fast');
+    $(".menu").removeClass('selected');
+
+    $("#other").hide();
+    $("nav .active").removeClass('active');
+    $("body").addClass('with-other-text');
+
+    $.ajax($(this).attr('data-other'), {
+        success: function(text) {
+            $("#other-text-body").html(text);
+            $("#other-text-waiter").hide();
+            $("#other-text-body").show();
+        }
+    });
+});
+
+
+$("#other-text-close").click(function(e) {
+    e.preventDefault();
+    if ($('#big-pane').length == 0)
+        $("#other-text").hide();
+    $("body").removeClass('with-other-text');
+});
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/js/book_text/settings.js b/apps/wolnelektury_core/static/js/book_text/settings.js
new file mode 100644 (file)
index 0000000..e398ba3
--- /dev/null
@@ -0,0 +1,12 @@
+(function($){$(function(){
+
+
+$("#menu-settings").show();
+
+$(".settings-switch").click(function(e) {
+    e.preventDefault();
+    $("body").toggleClass($(this).attr("data-setting"));
+});
+
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/js/book_text/themes.js b/apps/wolnelektury_core/static/js/book_text/themes.js
new file mode 100644 (file)
index 0000000..32e2e81
--- /dev/null
@@ -0,0 +1,16 @@
+(function($){$(function(){
+
+
+if ($('#themes li').length > 0) {
+    $("#menu-themes").show();
+}
+
+
+$(".theme-begin").click(function(e) {
+    e.preventDefault();
+    if ($(this).css("overflow") == "hidden" || $(this).hasClass('showing')) {
+        $(this).toggleClass("showing");
+    }
+});
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/js/book_text/toc.js b/apps/wolnelektury_core/static/js/book_text/toc.js
new file mode 100644 (file)
index 0000000..31f4e9f
--- /dev/null
@@ -0,0 +1,9 @@
+(function($){$(function(){
+
+
+if ($('#toc li').length > 0) {
+    $('#menu-toc').show();
+}
+
+
+})})(jQuery);
diff --git a/apps/wolnelektury_core/static/scss/all.scss b/apps/wolnelektury_core/static/scss/all.scss
deleted file mode 100644 (file)
index 8d6e0d3..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-@import "tools";
-
-@import "main/auth";
-@import "main/base";
-@import "main/book_box";
-@import "main/book_list";
-@import "main/catalogue";
-@import "main/cite";
-@import "main/dialogs";
-@import "main/footer";
-@import "main/form";
-@import "main/fragment";
-@import "main/header";
-@import "main/hidden";
-@import "main/main_content";
-@import "main/main_page";
-@import "main/menu";
-@import "main/search";
-@import "main/tag";
-
-@import "funding/funding";
-
-@import "polls/polls";
diff --git a/apps/wolnelektury_core/static/scss/book_text.scss b/apps/wolnelektury_core/static/scss/book_text.scss
new file mode 100644 (file)
index 0000000..8e91f5f
--- /dev/null
@@ -0,0 +1,13 @@
+@import "tools";
+
+@import "book_text/body";
+@import "book_text/box";
+@import "book_text/info";
+@import "book_text/menu";
+@import "book_text/note";
+@import "book_text/numbering";
+@import "book_text/other";
+@import "book_text/settings";
+@import "book_text/themes";
+@import "book_text/toc";
+
diff --git a/apps/wolnelektury_core/static/scss/book_text/body.scss b/apps/wolnelektury_core/static/scss/book_text/body.scss
new file mode 100644 (file)
index 0000000..99867c3
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * #big-pane
+ * Everything besides the menu.
+ */
+@include min-screen(640px) {
+    #big-pane {
+        margin-left: 80px;
+    }
+    .menu-hidden {
+        #big-pane {
+            margin-left: 0;
+        }
+    }
+}
+
+
+
+/*
+ * #main-text
+ *
+ * This is where the text lives
+ * together with line numbers, themes and stuff.
+ */
+
+@mixin left-without-numbers {
+    padding-left: 20px;
+    @include min-screen(240px) {
+        padding-left: 30px;
+    }
+}
+
+@mixin right-without-themes {
+    padding-right: 20px;
+    @include min-screen(240px) {
+        padding-right: 30px;
+    }
+    @include min-screen(320px) {
+        padding-right: 44px;
+    }
+}
+
+#main-text {
+    @include left-without-numbers;
+    @include right-without-themes;
+
+    /* make room for line numbers */
+    @include min-screen(320px) {
+        padding-left: 50px;
+    }
+
+    /* make room for themes */
+    @include min-screen(600px) {
+        padding-right: 160px;
+    }
+}
+
+.always-hide-line-numbers {
+    /* Cancel making room for line numbers. */
+    #main-text {
+        @include left-without-numbers;
+    }
+}
+
+.always-hide-themes {
+    /* Cancel making room for themes. */
+    #main-text {
+        @include right-without-themes;
+    }
+}
+
+
+
+
+
+
+
+#book-text {
+    max-width: 600px;
+    margin: 20px auto;
+    
+    h1 {
+        margin-top: 0px;
+    }
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/box.scss b/apps/wolnelektury_core/static/scss/book_text/box.scss
new file mode 100644 (file)
index 0000000..4762e45
--- /dev/null
@@ -0,0 +1,27 @@
+/* TODO:
+There should be a JS-less way of seeing at least some of
+the hidden boxes (TOC and Themes).
+*/
+
+.box, #toc, #themes, #nota_red {
+    display: none;
+
+    position: fixed;
+    left: 80px;
+    top: 0;
+    bottom: 0;
+    max-width: 380px;
+    padding: 10px;
+    margin: 0;
+    overflow-x: hidden;
+    overflow-y: auto;
+    z-index: 100000;
+
+    color: black;
+    background: white;
+    opacity: .9;
+
+    border-width: 0 2px 2px 0;
+    border-style: solid;
+    border-color: #191919;
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/info.scss b/apps/wolnelektury_core/static/scss/book_text/info.scss
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/apps/wolnelektury_core/static/scss/book_text/menu.scss b/apps/wolnelektury_core/static/scss/book_text/menu.scss
new file mode 100644 (file)
index 0000000..e2879b4
--- /dev/null
@@ -0,0 +1,78 @@
+/* Button for showing menu */
+#menu-toggle-on {
+    width: 20px;
+    height: 20px;
+    position: fixed;
+    top: 0;
+    left: 0;
+    background: #191919;
+    color: white;
+    text-align: center;
+    z-index: 500;
+
+    @include min-screen(240px) {
+        width: 30px;
+        height: 30px;
+    }
+
+    @include min-screen(320px) {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+#menu {
+    display: none;
+    z-index: 1000;
+
+    width: 80px;
+    position: fixed;
+    top: 0;
+    left: 0;
+    text-align: center;
+    background: #191919;
+    height: 100%;
+
+    ul {
+        list-style: none;
+        margin: 0;
+        padding: 0;
+
+        li {
+
+            a {
+                padding: 10px 0;
+                color: white;
+                display: block;
+                text-decoration: none;
+
+                &.active {
+                    background: white;
+                    color: black;
+                }
+
+                .label {
+                    display: block;
+                    font-size: 12px;
+                }
+            }
+        }
+
+    }
+}
+
+/* body class for showing menu */
+.menu-showed #menu {
+    display: block;
+}
+
+/* menu showing by default */
+@include min-screen(640px) {
+    #menu {
+        display: block;
+    }
+    /* body class for hiding menu */
+    .menu-hidden #menu {
+        display: none;
+    }
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/note.scss b/apps/wolnelektury_core/static/scss/book_text/note.scss
new file mode 100644 (file)
index 0000000..55dd765
--- /dev/null
@@ -0,0 +1,3 @@
+#menu-nota_red {
+    display: none;
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/numbering.scss b/apps/wolnelektury_core/static/scss/book_text/numbering.scss
new file mode 100644 (file)
index 0000000..fc611df
--- /dev/null
@@ -0,0 +1,64 @@
+@mixin hide-line-numbers {
+    float: left;
+    margin-left: -20px;
+
+    width: 20px;
+    height: 100%;
+    padding: 0;
+    overflow: hidden;
+
+    color: white;
+    text-align: right;
+
+    &:hover, &:active {
+        color: #ccc;
+        background-color: #CCC;
+    }
+
+    &:before {
+        content: "#";
+        display: block;
+        float: left;
+        width: 9px;
+        height: 100%;
+        overflow: hidden;
+        border-right: 1px solid #ccc;
+    }
+
+    @include min-screen(240px) {
+        width: 30px;
+        margin-left: -30px;
+
+        &:before {
+            width: 14px;
+        }
+    }
+}
+
+
+.anchor {
+    @include hide-line-numbers;
+
+    @include min-screen(320px) {
+        /* Show line numbers. */
+        margin-left: -50px;
+        width: 44px;
+        height: auto;
+        padding: 2px;
+        text-align: center;
+        color: #ccc;
+
+        &:before {
+            display: none;
+        }
+    }
+}
+
+@include min-screen(320px) {
+    .always-hide-line-numbers {
+        /* Cancel showing line numbers. */
+        .anchor {
+            @include hide-line-numbers;
+        }
+    }
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/other.scss b/apps/wolnelektury_core/static/scss/book_text/other.scss
new file mode 100644 (file)
index 0000000..ca2aebb
--- /dev/null
@@ -0,0 +1,35 @@
+nav #menu-other {
+    display: none;
+}
+
+
+#other-text {
+    display: none;
+}
+
+#main-pane.with-other-text {
+
+    #main-text {
+        display: table-cell;
+        padding-left: 40px;
+        @include min-screen(1px) {
+            width: 300px;
+        }
+
+        @include min-screen(1000px) {
+            width: 400px;
+        }
+    }
+
+    #other-text {
+        display: table-cell;
+        padding-left: 40px;
+        @include min-screen(1px) {
+            width: 300px;
+        }
+
+        @include min-screen(1000px) {
+            width: 400px;
+        }
+    }
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/settings.scss b/apps/wolnelektury_core/static/scss/book_text/settings.scss
new file mode 100644 (file)
index 0000000..b8ac6a6
--- /dev/null
@@ -0,0 +1,35 @@
+@mixin switch-on {
+    background: #aaa;
+}
+@mixin switch-off {
+    background: none;
+}
+.settings-switch {
+    display: block;
+    padding: .5em;
+    margin: .5em;
+    border: 1px solid #aaa;
+    border-radius: 1em;
+}
+
+nav #menu-settings {
+    display: none;
+}
+
+#settings-annotations {@include switch-on;}
+.no-annotations {
+    #settings-annotations {@include switch-off;}
+    .annotation {display: none;}
+}
+
+#settings-themes {@include switch-on;}
+.always-hide-themes {
+    #settings-themes {@include switch-off;}
+}
+
+#settings-line-numbers {@include switch-on;}
+.always-hide-line-numbers {
+    #settings-line-numbers {@include switch-off;}
+}
+
+
diff --git a/apps/wolnelektury_core/static/scss/book_text/themes.scss b/apps/wolnelektury_core/static/scss/book_text/themes.scss
new file mode 100644 (file)
index 0000000..899db5e
--- /dev/null
@@ -0,0 +1,101 @@
+nav #menu-themes {
+    display: none;
+}
+
+/* Add a missing header. */
+#themes:before {
+    content: "Motywy";
+}
+
+
+
+
+@mixin theme-hidden {
+    width: 20px;
+    height: 20px;
+    overflow: hidden;
+    margin-right: -20px;
+    border: none;
+    padding: 0;
+
+    &:before {
+        content: "▲";
+        color: #ccc;
+        text-align:  center;
+        display: block;
+    }
+
+    @include min-screen(240px) {
+        width: 30px;
+        margin-right: -30px;
+        &:before {
+            font-size: 2em;
+        }
+    }
+
+    @include min-screen(320px) {
+        width: 44px;
+        margin-right: -44px;
+        &:before {
+            font-size: 3em;
+        }
+    }
+
+    &.showing {
+        @include theme-showing;
+    }
+
+}
+
+@mixin theme-showing {
+    @include size(width, 120px);
+    height: auto;
+    overflow: visible;
+    margin-left: 30px;
+
+    border-left: 1px solid #DDDDDD;
+    color: #777;
+    padding: 0 0 0 8px;
+
+    &:before {
+        display: none;
+    }
+}
+
+.theme-begin {
+    @include theme-hidden;
+
+    position: relative;
+    float: right;
+    margin-bottom: 8px;
+    clear: both;
+    line-height: 1.5em;
+    text-align: left;
+    z-index: 60000;
+
+    font-size: 16px;
+    font-style: normal;
+    font-weight: normal;
+    font-variant: normal;
+    letter-spacing: 0;
+    text-transform: none;
+    text-decoration: none;
+
+    @include min-screen(600px) {
+        @include theme-showing;
+        margin-right: -160px;
+    }
+
+    &.showing {
+        @include theme-showing;
+    }
+}
+
+
+@include min-screen(600px) {
+    .always-hide-themes {
+        .theme-begin {
+            @include theme-hidden;
+        }
+    }
+}
diff --git a/apps/wolnelektury_core/static/scss/book_text/toc.scss b/apps/wolnelektury_core/static/scss/book_text/toc.scss
new file mode 100644 (file)
index 0000000..18975c7
--- /dev/null
@@ -0,0 +1,3 @@
+nav #menu-toc {
+    display: none;
+}
diff --git a/apps/wolnelektury_core/static/scss/main.scss b/apps/wolnelektury_core/static/scss/main.scss
new file mode 100644 (file)
index 0000000..8d6e0d3
--- /dev/null
@@ -0,0 +1,23 @@
+@import "tools";
+
+@import "main/auth";
+@import "main/base";
+@import "main/book_box";
+@import "main/book_list";
+@import "main/catalogue";
+@import "main/cite";
+@import "main/dialogs";
+@import "main/footer";
+@import "main/form";
+@import "main/fragment";
+@import "main/header";
+@import "main/hidden";
+@import "main/main_content";
+@import "main/main_page";
+@import "main/menu";
+@import "main/search";
+@import "main/tag";
+
+@import "funding/funding";
+
+@import "polls/polls";
index 9cdc60b..3d6ee43 100644 (file)
@@ -30,7 +30,7 @@ PIPELINE_CSS = {
 
             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
 
-            'scss/all.scss',
+            'scss/main.scss',
         ],
         'output_filename': 'css/compressed/main.css',
     },
@@ -40,6 +40,13 @@ PIPELINE_CSS = {
         ],
         'output_filename': 'css/compressed/book.css',
     },
+    'book_text': {
+        'source_filenames': [
+            'scss/book_text.scss',
+            'css/new.book.css',
+        ],
+        'output_filename': 'css/compressed/book_text.css',
+    },
     'player': {
         'source_filenames': [
             'jplayer/jplayer.blue.monday.css', 
@@ -97,6 +104,12 @@ PIPELINE_JS = {
         ],
         'output_filename': 'js/book.min.js',
     },
+    'book_text': {
+        'source_filenames': [
+            'js/book_text/*.js',
+        ],
+        'output_filename': 'js/book_text.js',
+    },
     'book_ie': {
         'source_filenames': ('js/ierange-m2.js',),
         'output_filename': 'js/book_ie.min.js',
@@ -109,7 +122,12 @@ PIPELINE_CSS_COMPRESSOR = None
 PIPELINE_JS_COMPRESSOR = None
 
 PIPELINE_COMPILERS = (
-    'pyscss_compiler.PySCSSCompiler',
+    'pipeline.compilers.sass.SASSCompiler',
+    # We could probably use PySCSS instead,
+    # but they have some serious problems, like:
+    # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax)
+    # https://github.com/Kronuz/pyScss/issues/258 (bad @media order)
+    #'pyscss_compiler.PySCSSCompiler',
 )
-PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
-PIPELINE_PYSCSS_ARGUMENTS = ''
+#PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
+#PIPELINE_PYSCSS_ARGUMENTS = ''