Commit 34797a0d authored by svilayphiou's avatar svilayphiou

A specific template for "read", "print" and "slide" so that we can

directly share those versions.
Print mode also benefits from the polyfill so that it works on (almost)
all browsers).
parent 2196a730
body {
font-family: News Cycle;
src: url("/static/fonts/NewsCycle-Regular.ttf") format("truetype");
letter-spacing: 1px;
background-color: black;
color: white;
font-size: 21pt !important;
//max-width: 30em;
margin: auto;
}
header, nav, .left-side, .right-side, .screen-only, .metadata {
display: none;
}
p, pre, ul, ol, blockquote, h2, h3, h4, h5, h6,dl, table {
margin-left: 0;
margin-right: 0;
}
h2 {
margin-top: 0;
font-size: 36pt;
text-transform: none;
line-height: 1.2em !important;
}
h2.title {
margin-top: 25%;
}
h3 {
font-size: 18pt;
}
.slide {
line-height: 1.5em !important;
}
img {
max-width: 100%;
}
li {
list-style-type: none !important;
}
div.slidy_toc {
background-color: black;
}
div.toolbar {
height: auto;
}
a, a:visited {
color: inherit !important;
}
p + p {
text-indent: 0;
margin-top: 1.2em;
}
.comment {
display: none;
}
pre {
background-color: white;
color: inherit;
font-weight: normal;
border: 0;
width: 100%;
font-family: NotCourierSans;
padding: 1em;
}
code {
font-family: NotCourierSans;
}
......@@ -17,11 +17,6 @@ $(document).ready(function() {
// ORPHANS AND WIDOWS
remy($("#content"));
// DIV WRAPPER AROUND EACH H2
$("#content h2").each(function(){
h2 = $(this).attr('id');
$(this).nextUntil('h2').andSelf().wrapAll('<div class="slide ' + h2 + '"></div>');
});
// OFFSET ANCHOR BECAUSE OF FIXED MENU
$('a.footnote-ref, a.footnote-backref').click(function(e){
......@@ -91,15 +86,6 @@ $(".logged-out a.write-button").click(function(e) {
$(".popup-wrapper").removeClass("hidden");
});
$(".slide-button").click(function(e) {
e.preventDefault();
$.getScript( "/static/js/slidy.js", function( data, textStatus, jqxhr ) {
w3c_slidy.init();
$("body").append("<link rel='stylesheet' href='/static/js/slidy.css' type='text/css' media='all' />");
$("body").append("<link rel='stylesheet' href='/css-slide/' type='text/css' media='all' />");
});
});
$(".popup-wrapper").click(function(e) {
$(this).addClass("hidden");
});
......
{% extends "base.html" %}
{% load wikify relearn_tags %}
{% block extra_styles %}
<link rel="stylesheet/less" href="{{ STATIC_URL }}less/print.less" type="text/css" media="all">
<link rel="stylesheet/less" href="/offset-print/" type="text/css" media="all">
{% endblock %}
{% block head_meta %}
<meta property="og:type" content="article"/>
{% if meta %}
{% if meta.authors %}
{% for author in meta.authors %}
<meta property="dc:creator" content="{{ author }}" />
{% endfor %}
{% endif %}
{% if meta.language %}{% for language in meta.language %}<meta property="dc:language" content="{{ language|lower }}" />{% endfor %}{% endif %}
<meta property="dc:identifier" content="{{ meta.id.0 }}" />
{% if meta.type %}<meta property="dc:type" content="{{ meta.type.0 }}" />{% endif %}
{% endif %}
{% endblock %}
{% block data_article %}{{ meta.authors|natural_join:'&'|markdown_filter|no_p }}, {{ meta.title.0 }}{% endblock %}
{% block bodyclasses%}{% if meta.host %}{{ meta.host.0|lower }}{% endif %} {% if meta.type %}{{ meta.type.0|lower }}{% endif %}{% endblock %}
{% block contentclasses%}{% if meta.host %}{{ meta.host.0|lower }}{% endif %} {% if meta.type %}{{ meta.type.0|lower }}{% endif %}{% endblock %}
{% block title_left %}
{% if prev_page %}<div id="previous">
<a href="{{ prev_page.href }}" title="{{ prev_page.authors|natural_join:'&' }}, {{ prev_page.title }}">&larr;<br/>
<span>{{ prev_page.authors|natural_join:'&' }}<br/>
{{ prev_page.title|safe }}</span></a>
</div>{% endif %}
{% endblock %}
{% block content %}
{% include "partials/metadata.html" %}
<header class="{% if meta.type %}{{ meta.type.0|lower }}{% endif %}">
{% if meta.authors %}
<p class="authors">{{ meta.authors|natural_join:'&' }}</p>
{% endif %}
<h2 property="dc:title">
{{ meta.title.0|default:pad.display_slug|markdown_filter|no_p }}
</h2>
</header>
{{ text|safe }}
{% endblock %}
{% block extraui %}
{% if not user.is_authenticated %}
<div class="popup-wrapper hidden">
<div class="popup">
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
<label for="id_username">Username</label>
<input id="id_username" maxlength="254" name="username" type="text" />
<label for="id_password">Password</label>
<input id="id_password" name="password" type="password" />
<input class="submit" type="submit" value="Login" />
<input type="hidden" name="next" value="{% if next %}{{ next }}{% else %}{% url 'home' %}{% endif %}" />
</form>
</div>
</div>
{% else %}
<div id="print-interface">
<button id="debug">Debug</button>
<button id="spread">Spread</button>
<button id="hi-res">Hi-res</button>
<div id="toc" class="dropdown">
<button id="goto">Go to</button>
<ul id="toc-pages"> </ul>
</div>
<div class="dropdown">
<button id="zoom">Zoom</button>
<ul id="zoom-list">
<li><a href="#" title="25">25&thinsp;%</a></li>
<li><a href="#" title="33">33&thinsp;%</a></li>
<li><a href="#" title="50">50&thinsp;%</a></li>
<li><a href="#" title="75">75&thinsp;%</a></li>
<li><a href="#" title="100">100&thinsp;%</a></li>
<li><a href="#" title="150">150&thinsp;%</a></li>
<li><a href="#" title="200">200&thinsp;%</a></li>
<li><a href="#" title="300">300&thinsp;%</a></li>
</ul>
</div>
</div>
{% endif %}
{% endblock %}
{% block scripts %}
<script src="{{ STATIC_URL }}js/print.js" type="text/javascript" charset="utf-8"> </script>
{% endblock %}
......@@ -2,13 +2,8 @@
{% load wikify relearn_tags %}
{% block extra_styles %}
{% ifequal mode "p" %}
<link rel="stylesheet/less" href="{{ STATIC_URL }}less/print.less" type="text/css" media="all">
<link rel="stylesheet/less" href="/offset-print/" type="text/css" media="all">
{% else %}
<link rel="stylesheet/less" href="{% url 'css' %}" type="text/css" media="screen">
<link rel="stylesheet/less" href="/css-print/" type="text/css" media="print">
{% endifequal %}
{% endblock %}
......@@ -44,7 +39,6 @@
{% block title %}
{% ifequal mode "r" %}
<header class="{% if meta.type %}{{ meta.type.0|lower }}{% endif %}">
{% if meta.authors %}
<p class="authors">{{ meta.authors|natural_join:'&' }}</p>
......@@ -53,7 +47,6 @@
{{ meta.title.0|default:pad.display_slug|markdown_filter|no_p }}
</h2>
</header>
{% endifequal %}
{% endblock %}
......@@ -67,46 +60,30 @@
{% block content %}
{% include "partials/metadata.html" %}
{% ifequal mode "p" %}
<header class="{% if meta.type %}{{ meta.type.0|lower }}{% endif %}">
{% if meta.authors %}
<p class="authors">{{ meta.authors|natural_join:'&' }}</p>
{% endif %}
<h2 property="dc:title">
{{ meta.title.0|default:pad.display_slug|markdown_filter|no_p }}
</h2>
</header>
{% endifequal %}
{% include "partials/metadata.html" %}
{{ text|safe }}
{% ifequal mode "r" %}
<div id="go-up">
<a class="screen-only" href="#">&uarr;</a>
</div>
{% endifequal %}
<div id="go-up">
<a class="screen-only" href="#">&uarr;</a>
</div>
{% endblock %}
{% block rightside %}
{% ifequal mode "r" %}
{% if author and meta %}
<dl class="meta private">
{% for key, values in meta_list reversed %}
<dt>{{ key|title }}</dt>
{% for value in values %}<dd>{{ value|markdown_filter }}</dd>{% endfor %}
{% endfor %}
<dt>Editors</dt>
<dd>
<p>{{ authors|natural_join:'et' }}</p>
</dd>
</dl>
{% endif %}
{% endifequal %}
{% if author and meta %}
<dl class="meta private">
{% for key, values in meta_list reversed %}
<dt>{{ key|title }}</dt>
{% for value in values %}<dd>{{ value|markdown_filter }}</dd>{% endfor %}
{% endfor %}
<dt>Editors</dt>
<dd>
<p>{{ authors|natural_join:'et' }}</p>
</dd>
</dl>
{% endif %}
{% endblock %}
{% block extraui %}
......@@ -125,37 +102,6 @@
</form>
</div>
</div>
{% else %}
{% ifequal mode "p" %}
<div id="print-interface">
<button id="debug">Debug</button>
<button id="spread">Spread</button>
<button id="hi-res">Hi-res</button>
<div id="toc" class="dropdown">
<button id="goto">Go to</button>
<ul id="toc-pages"> </ul>
</div>
<div class="dropdown">
<button id="zoom">Zoom</button>
<ul id="zoom-list">
<li><a href="#" title="25">25&thinsp;%</a></li>
<li><a href="#" title="33">33&thinsp;%</a></li>
<li><a href="#" title="50">50&thinsp;%</a></li>
<li><a href="#" title="75">75&thinsp;%</a></li>
<li><a href="#" title="100">100&thinsp;%</a></li>
<li><a href="#" title="150">150&thinsp;%</a></li>
<li><a href="#" title="200">200&thinsp;%</a></li>
<li><a href="#" title="300">300&thinsp;%</a></li>
</ul>
</div>
</div>
{% endifequal %}
{% endif %}
{% endblock %}
{% block scripts %}
{% ifequal mode "p" %}
<script src="{{ STATIC_URL }}js/print.js" type="text/javascript" charset="utf-8"> </script>
<!--<script src="{{ STATIC_URL }}js/css-regions-polyfill.js" type="text/javascript" charset="utf-8"> </script>-->
{% endifequal %}
{% endblock %}
{% extends "base.html" %}
{% load wikify relearn_tags %}
{% block extra_styles %}
<link rel='stylesheet' href='/static/js/slidy.css' type='text/css' media='all' />
<link rel='stylesheet' href='/css-slide/' type='text/css' media='all' />
<link rel="stylesheet/less" href="{% url 'css' %}" type="text/css" media="screen">
<link rel="stylesheet/less" href="/css-slide/" type="text/css" media="all">
{% endblock %}
{% block head_meta %}
<meta property="og:type" content="article"/>
{% if meta %}
{% if meta.authors %}
{% for author in meta.authors %}
<meta property="dc:creator" content="{{ author }}" />
{% endfor %}
{% endif %}
{% if meta.language %}{% for language in meta.language %}<meta property="dc:language" content="{{ language|lower }}" />{% endfor %}{% endif %}
<meta property="dc:identifier" content="{{ meta.id.0 }}" />
{% if meta.type %}<meta property="dc:type" content="{{ meta.type.0 }}" />{% endif %}
{% endif %}
{% endblock %}
{% block data_article %}{{ meta.authors|natural_join:'&'|markdown_filter|no_p }}, {{ meta.title.0 }}{% endblock %}
{% block bodyclasses%}{% if meta.host %}{{ meta.host.0|lower }}{% endif %} {% if meta.type %}{{ meta.type.0|lower }}{% endif %}{% endblock %}
{% block contentclasses%}{% if meta.host %}{{ meta.host.0|lower }}{% endif %} {% if meta.type %}{{ meta.type.0|lower }}{% endif %}{% endblock %}
{% block content %}
{{ text|safe }}
{% endblock %}
{% block scripts %}
<script src="/static/js/slidy.js"> </script>
<script>
$(document).ready(function(){
// DIV WRAPPER AROUND EACH H2
$("#content h2").each(function(){
h2 = $(this).attr('id');
$(this).nextUntil('h2').andSelf().wrapAll('<div class="slide ' + h2 + '"></div>');
});
});
</script>
{% endblock %}
......@@ -36,7 +36,10 @@ base_urlpatterns = patterns(
url(r'^accounts/logout$', 'django.contrib.auth.views.logout',
{'template_name': 'logout.html'}, name='logout'),
url(r'^create/$', 'relearn.views.padCreate', name='pad-create'),
url(r'(?P<mode>[r|p])/(?P<slug>[^/]+)$', 'relearn.views.pad_read', name='pad-read'),
url(r'(?P<mode>[r|s|p])/(?P<slug>[^/]+)$', 'relearn.views.pad_read', name='pad-read'),
#url(r'r/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-read'),
#url(r's/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-slide'),
#url(r'p/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-print'),
url(r'w/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-write'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......
......@@ -312,7 +312,12 @@ def pad_read(request, mode="r", slug=None):
request.session.set_test_cookie()
tpl_params['next'] = reverse('pad-write', args=(slug,) )
return render_to_response("pad-read.html", tpl_params, context_instance = RequestContext(request))
if mode == "r":
return render_to_response("pad-read.html", tpl_params, context_instance = RequestContext(request))
elif mode == "s":
return render_to_response("pad-slide.html", tpl_params, context_instance = RequestContext(request))
elif mode == "p":
return render_to_response("pad-print.html", tpl_params, context_instance = RequestContext(request))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment