Updated website to support a snippet archive.
This commit is contained in:
parent
9224212d49
commit
ef7818e10e
12 changed files with 66 additions and 24 deletions
|
|
@ -93,7 +93,7 @@ def mailinglist_archive(page):
|
|||
page=page, threads=threads)
|
||||
|
||||
|
||||
@app.route('/mailinglist/archives/<int:year>/<int:month>/<int:day>/<slug>/')
|
||||
@app.route('/mailinglist/archive/<int:year>/<int:month>/<int:day>/<slug>/')
|
||||
def mailinglist_show_thread(year, month, day, slug):
|
||||
thread = Thread.get(year, month, day, slug)
|
||||
if thread is None:
|
||||
|
|
@ -101,6 +101,11 @@ def mailinglist_show_thread(year, month, day, slug):
|
|||
return render_template('mailinglist/show_thread.html', thread=thread)
|
||||
|
||||
|
||||
@app.route('/snippets/')
|
||||
def snippets():
|
||||
return render_template('snippets/index.html')
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(error):
|
||||
return render_template('404.html'), 404
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ $(function() {
|
|||
$('ul.mailtree div.link').removeClass('selected');
|
||||
$('#link-' + id).addClass('selected').focus();
|
||||
$('div.mail').hide();
|
||||
$('#' + id).show();
|
||||
$('h2:first').text($('h3', $('#' + id).show()).text());
|
||||
if (!(document.location.hash == '' && id == first_mail))
|
||||
document.location.href = '#' + id;
|
||||
window.scrollTo(pos.x, pos.y);
|
||||
|
|
@ -19,6 +19,7 @@ $(function() {
|
|||
.addClass('dynamic-mail')
|
||||
.appendTo($('<div></div>').insertBefore('div.mail:first'))
|
||||
.hide();
|
||||
$('div.mail h3').hide();
|
||||
|
||||
$('div.link').each(function() {
|
||||
var id = $('a', $(this).parent()).attr('href').substr(1);
|
||||
|
|
|
|||
BIN
static/snippets.png
Normal file
BIN
static/snippets.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
|
|
@ -15,22 +15,28 @@ ul { margin: 15px 0 15px 0; padding: 0; list-style: none; line-height: 1
|
|||
ul li:before { content: "\00BB \0020"; color: #888; position: absolute; margin-left: -19px; }
|
||||
blockquote { margin: 0; font-style: italic; color: #444; }
|
||||
.footer { font-size: 13px; color: #888; text-align: right; margin-top: 25px; }
|
||||
.backnav { text-align: center; color: #444; font-style: italic; }
|
||||
.nav { text-align: center; }
|
||||
.nav a { font-style: italic; }
|
||||
.backnav { float: right; color: #444; font-style: italic;
|
||||
margin: 5px 0 0 0; font-size: 0.9em; }
|
||||
|
||||
/* mailinglist */
|
||||
.pagination { text-align: center; font-size: 15px; margin: 20px 0 0 0; }
|
||||
.disabled { color: #888; }
|
||||
.archive .meta { font-size: 0.9em; display: block; margin: 0 0 0.5em 1em; }
|
||||
.mailtree { border-top: 1px solid black; padding: 5px 10px 5px 10px;
|
||||
border-bottom: 1px solid black; font-size: 14px; }
|
||||
.mailtree { border-top: 1px solid black; padding: 5px 12px 5px 12px;
|
||||
border-bottom: 1px solid black; font-size: 14px;
|
||||
max-height: 100px; overflow: auto; }
|
||||
.mailtree ul { margin: 0 0 0 15px; line-height: 1.5; }
|
||||
.mailtree li:before { display: none; }
|
||||
.mailtree .selected:before { content: "\00BB \0020"; color: #888;
|
||||
position: absolute; margin-left: -10px; }
|
||||
.mailtree .selected { background: #fafafa; }
|
||||
.mailtree .selected:before { content: "\00BB\0020"; color: #888;
|
||||
position: relative; margin-left: -12px;
|
||||
width: 12px!important; }
|
||||
.mail { margin: 15px 0; }
|
||||
.children .mail { margin: 15px 0 15px 20px; }
|
||||
.dynamic-mail { margin-left: 0!important; }
|
||||
.mail dl { margin: 0; padding-bottom: 10px;
|
||||
.mail dl { margin: 0; padding-bottom: 15px;
|
||||
border-bottom: 1px solid black; }
|
||||
.mail dl dt { color: #888; width: 70px; float: left; height: 20px; }
|
||||
.mail dl dd { height: 20px; width: 500px; }
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@
|
|||
h1 span, p.tagline { display: none; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h1><span>Flask</span></h1>
|
||||
{% block body_title %}
|
||||
{{ super() }}
|
||||
<p class=tagline>because sometimes a pocket knife is not enough
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<blockquote>
|
||||
Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.
|
||||
And before you ask: It's <a href=docs/license/>BSD licensed</a>!
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
|
||||
{% endblock %}
|
||||
<div class=box>
|
||||
{% block body_title %}
|
||||
<h1><span>{{ self.title() }}</span></h1>
|
||||
{% endblock %}
|
||||
<p class=nav>
|
||||
<a href=/>overview</a> //
|
||||
<a href=/docs/>documentation</a> //
|
||||
<a href=/mailinglist/>mailinglist</a> //
|
||||
<a href=/snippets/>snippets</a>
|
||||
{% block body %}{% endblock %}
|
||||
<p class=footer>© Copyright 2010 by <a href=http://lucumr.pocoo.org/>Armin Ronacher</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "mailinglist/layout.html" %}
|
||||
{% block title %}Mailinglist Archive{% endblock %}
|
||||
{% block mailbody %}
|
||||
{% block body %}
|
||||
<h2>Mailinglist Archive</h2>
|
||||
<ul class=archive>
|
||||
{% for thread in threads %}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "mailinglist/layout.html" %}
|
||||
{% block title %}Mailinglist{% endblock %}
|
||||
{% block mailbody %}
|
||||
{% block body %}
|
||||
<p>
|
||||
There is a mailinglist for Flask hosted on <a
|
||||
href=http://librelist.com/>librelist</a> you can use for both user requests
|
||||
|
|
|
|||
|
|
@ -6,16 +6,6 @@
|
|||
h1 span { display: none; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% block body_title %}
|
||||
<h1><span>Flask Mailinglist</span></h1>
|
||||
<div class=backnav>
|
||||
<a href="{{ url_for('index') }}">back to website</a>
|
||||
{% if request.endpoint != 'mailinglist_index' %}//
|
||||
<a href="{{ url_for('mailinglist_index') }}">list information</a>
|
||||
{% endif %}
|
||||
{% if request.endpoint != 'mailinglist_archive' %}//
|
||||
<a href="{{ url_for('mailinglist_archive') }}">go to the archive</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% block mailbody %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
{{ super() }}
|
||||
<script type=text/javascript src=/static/mailinglist.js></script>
|
||||
{% endblock %}
|
||||
{% block mailbody %}
|
||||
{% block body %}
|
||||
<p class=backnav>
|
||||
<a href=/mailinglist/archive/>« back to archive</a>
|
||||
<h2>{{ thread.title }}</h2>
|
||||
|
||||
<ul class=mailtree>
|
||||
|
|
|
|||
17
templates/snippets/index.html
Normal file
17
templates/snippets/index.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{% extends "snippets/layout.html" %}
|
||||
{% block title %}Snippets Archive{% endblock %}
|
||||
{% block body %}
|
||||
<p>
|
||||
Welcome to the Flask snippet archive. This is the place where anyone
|
||||
can drop helpful pieces of code for others to use.
|
||||
<p>
|
||||
In order to add snippets to this page or to add comments, all you need
|
||||
is an <a href=http://en.wikipedia.org/wiki/OpenID>OpenID</a> account.
|
||||
<form action=/snippets/search/ method=get>
|
||||
<p>
|
||||
Search snippets:
|
||||
<input type=text name=q size=30>
|
||||
<input type=submit value=Search>
|
||||
</form>
|
||||
<h2>Snippets by Category</h2>
|
||||
{% endblock %}
|
||||
11
templates/snippets/layout.html
Normal file
11
templates/snippets/layout.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<style type=text/css>
|
||||
h1 { margin: 0 0 30px 0; background: url(/static/snippets.png) no-repeat center; height: 165px; }
|
||||
h1 span { display: none; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block body_title %}
|
||||
<h1><span>Flask Snippets</span></h1>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue