diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2011-12-05 22:38:43 -0500 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2011-12-05 22:38:43 -0500 |
commit | 803d20968fea1e25a298aa3b4e670d5670995e0d (patch) | |
tree | 2f90c6b8403e85576d0109a672dccb46598ce115 /templates | |
download | stackbin-803d20968fea1e25a298aa3b4e670d5670995e0d.tar.gz stackbin-803d20968fea1e25a298aa3b4e670d5670995e0d.tar.bz2 stackbin-803d20968fea1e25a298aa3b4e670d5670995e0d.zip |
Added as example app
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_pagination.html | 19 | ||||
-rw-r--r-- | templates/delete_paste.html | 11 | ||||
-rw-r--r-- | templates/layout.html | 28 | ||||
-rw-r--r-- | templates/my_pastes.html | 13 | ||||
-rw-r--r-- | templates/new_paste.html | 9 | ||||
-rw-r--r-- | templates/show_paste.html | 35 |
6 files changed, 115 insertions, 0 deletions
diff --git a/templates/_pagination.html b/templates/_pagination.html new file mode 100644 index 0000000..cb0d13e --- /dev/null +++ b/templates/_pagination.html @@ -0,0 +1,19 @@ +{% macro render_pagination(pagination) %} + <div class=pagination> + {%- for page in pagination.iter_pages() %} + {% if page %} + {% if page != pagination.page %} + <a href="{{ url_for_other_page(page) }}">{{ page }}</a> + {% else %} + <strong>{{ page }}</strong> + {% endif %} + {% else %} + <span class=ellipsis>…</span> + {% endif %} + {%- endfor %} + {% if pagination.has_next %} + <a href="{{ url_for_other_page(pagination.page + 1) + }}">Next »</a> + {% endif %} + </div> +{% endmacro %} diff --git a/templates/delete_paste.html b/templates/delete_paste.html new file mode 100644 index 0000000..e258dae --- /dev/null +++ b/templates/delete_paste.html @@ -0,0 +1,11 @@ +{% extends "layout.html" %} +{% block title %}Delete Paste #{{ paste.id }}{% endblock %} +{% block body %} + <h2>Delete Paste #{{ paste.id }}</h2> + <form action="" method=post> + <p>Are you sure you want to delete the paste? You cannot undo this. + <p> + <input type=submit name=yes value=Yes> + <input type=submit name=no value=No> + </form> +{% endblock %} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..206f750 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,28 @@ +<!doctype html> +<title>{% block title %}{% endblock %} | Flask Pastebin</title> +<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"> +<script type=text/javascript src="{{ config.JUGGERNAUT_DRIVER }}"></script> +<script type=text/javascript src="{{ url_for('static', filename='jquery.js') }}"></script> +<script type=text/javascript src="{{ url_for('static', filename='pastebin.js') }}"></script> +<script type=text/javascript> + pastebin.urlRoot = {{ request.url_root|tojson|safe }}; +{%- if g.user %} + pastebin.subscribeUser({{ g.user.id }}); +{%- endif %} +</script> +<div class=page> + <h1>Flask Pastebin</h1> + <ul class=nav> + <li><a href="{{ url_for('new_paste') }}">New Paste</a> + {% if g.user %} + <li><a href="{{ url_for('my_pastes') }}">My Pastes</a> + <li><a href="{{ url_for('logout') }}">Sign out ({{ g.user.display_name }})</a> + {% else %} + <li><a href="{{ url_for('login') }}">Sign in with Facebook</a> + {% endif %} + </ul> + {% for message in get_flashed_messages() %} + <p class=flash>{{ message }} + {% endfor %} + {% block body %}{% endblock %} +</div> diff --git a/templates/my_pastes.html b/templates/my_pastes.html new file mode 100644 index 0000000..64967ad --- /dev/null +++ b/templates/my_pastes.html @@ -0,0 +1,13 @@ +{% extends "layout.html" %} +{% block title %}My Pastes{% endblock %} +{% from '_pagination.html' import render_pagination %} +{% block body %} + <h2>My Pastes</h2> + <ul> + {% for paste in pagination.items %} + <li><a href="{{ url_for('show_paste', paste_id=paste.id) }}">#{{ paste.id }}</a> + from {{ paste.pub_date.strftime('%Y-%m-%d @ %H:%M') }} + {% endfor %} + </ul> + {{ render_pagination(pagination) }} +{% endblock %} diff --git a/templates/new_paste.html b/templates/new_paste.html new file mode 100644 index 0000000..31bf41a --- /dev/null +++ b/templates/new_paste.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% block title %}New Paste{% endblock %} +{% block body %} + <h2>New Paste</h2> + <form action="" method=post> + <div class=code><textarea name=code cols=60 rows=18>{{ parent.code }}</textarea></div> + <p><input type=submit value="New Paste"> + </form> +{% endblock %} diff --git a/templates/show_paste.html b/templates/show_paste.html new file mode 100644 index 0000000..7eeaa4b --- /dev/null +++ b/templates/show_paste.html @@ -0,0 +1,35 @@ +{% extends "layout.html" %} +{% block title %}Paste #{{ paste.id }}{% endblock %} +{% block body %} + <h2>Paste #{{ paste.id }}</h2> + <dl> + {% if paste.user %} + <dt>Author + <dd>{{ paste.user.display_name }} + {% endif %} + <dt>Date + <dd>{{ paste.pub_date.strftime('%Y-%m-%d @ %H:%M') }} + <dt>Actions + <dd> + <a href="{{ url_for('new_paste', reply_to=paste.id) }}">Reply</a> + {%- if g.user and paste.user == g.user -%} + , <a href="{{ url_for('delete_paste', paste_id=paste.id) }}">Delete</a> + {% endif %} + {% if paste.parent_id %} + <dt>In reply to + <dd><a href="{{ url_for('show_paste', paste_id=paste.parent_id) }}">#{{ paste.parent_id }}</a> + {% endif %} + {% if paste.children %} + <dt>Replies + <dd> + {% for child in paste.children -%} + {%- if not loop.first %},{% endif %} + <a href="{{ url_for('show_paste', paste_id=child.id) }}">#{{ child.id }}</a> + {%- endfor %} + {% endif %} + </dl> + <div class=code><pre>{{ paste.code }}</pre></div> + <script type=text/javascript> + pastebin.subscribePaste({{ paste.id }}); + </script> +{% endblock %} |