},
}
PIPELINE_JS = {
- 'base': {
+ 'word_detail': {
'source_filenames': (
+ 'js/word_detail.js',
),
- 'output_filename': 'compressed/base.js',
+ 'output_filename': 'compressed/word_detail.js',
},
}
margin-right: .5em;
vertical-align:middle;
}
+
+ &:hover {
+ color: white;
+ text-decoration: underline;
+ }
}
#buy {
background-image: url(/static/img/bg/neutral.png);
background-size: 100%;
- color: #fff;
- a { color: #fff; }
+ color: #555;
+ a { color: #555; }
}
.lawful {
background-image: url(/static/img/bg/lawful.png);
}
}
}
+
+
+%prevnext {
+ display: block;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ background: rgba(64,64,64,.5);
+ z-index:100;
+ opacity: 0;
+ text-align: center;
+
+ span {
+ position: absolute;
+ top: 50%;
+ margin-top: -.5em;
+ left: 0;
+ width: 100%;
+ color: #000;
+ }
+
+ &:hover, &.active {
+ opacity: 1;
+ }
+
+ font-size: 8vw;
+ width: 16vw;
+ @media screen and (min-width: 45em) {
+ width: 8vw;
+ font-size: 4vw;
+ }
+}
+
+#previous-card {
+ @extend %prevnext;
+ left: 0;
+}
+#next-card {
+ @extend %prevnext;
+ right: 0;
+}
--- /dev/null
+document.onkeydown = function(e) {
+ if (!e) e = window.event;
+ var keynum = e.keyCode ? e.keyCode : e.which; // IE vs others
+ switch (keynum) {
+ case 37:
+ var link = document.getElementById('previous-card');
+ link.setAttribute('class', 'active');
+ location.href = link.getAttribute('href');
+ return false;
+ case 39:
+ var link = document.getElementById('next-card');
+ link.setAttribute('class', 'active');
+ location.href = link.getAttribute('href');
+ return false;
+ }
+};
<footer>
{% chunk 'footer' %}
</footer>
- {#% compressed_js 'base' %#}
- {% tracking_code %}
+
+ {% tracking_code %}
</body>
</html>
def get_absolute_url(self):
return reverse('words_word', args=[self.slug])
+
+ def get_next(self):
+ try:
+ return Word.objects.filter(alignment=self.alignment, word__gt=self.word)[0]
+ except IndexError:
+ next_alignment = ALIGNMENTS[([a[0] for a in ALIGNMENTS].index(self.alignment) + 1) % len(ALIGNMENTS)][0]
+ return Word.objects.filter(alignment=next_alignment)[0]
+
+ def get_previous(self):
+ words = Word.objects.order_by('-word')
+ try:
+ return words.filter(alignment=self.alignment, word__lt=self.word)[0]
+ except IndexError:
+ prev_alignment = ALIGNMENTS[([a[0] for a in ALIGNMENTS].index(self.alignment) - 1) % len(ALIGNMENTS)][0]
+ return words.filter(alignment=prev_alignment)[0]
</section>
<section>
-<h1 class="main"><a href="#words" id="words">The words</a></h1>
+<h1 class="main"><a href="#glossary" id="glossary">The glossary</a></h1>
<div class="three-container">
<div class="card-dummy"></div>
{% extends "base.html" %}
{% load static from staticfiles %}
+{% load compressed %}
{% load textile_en from fnp_markup %}
{% block title %}{{ object }}{% endblock %}
{% block body %}
+<div class="a-card" style="position: relative">
+
+{% if previous %}
+<a id="previous-card" href="{{ previous.get_absolute_url }}" title="{{ previous }}"><span>◀</span></a>
+{% endif %}
+
+{% if next %}
+<a id="next-card" href="{{ next.get_absolute_url }}" title="{{ next }}"><span>▶</span></a>
+{% endif %}
+
+
<div class="card-container">
<div class="card-dummy"></div>
<section class="card front {{ object.alignment }}">
</section></div>
-<!--section>
-{% for word in words %}
- <a href="{{ word.get_absolute_url }}">{{ word }}</a>
-{% endfor %}
-</section-->
+</div>
+{% compressed_js 'word_detail' %}
{% endblock %}
return {
'object': object,
'words': Word.objects.all(),
+ 'previous': object.get_previous(),
+ 'next': object.get_next(),
}