From 956dbadabda879df43714da042a5c81b6883e384 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 7 Apr 2017 13:20:59 +0100 Subject: [PATCH] switch layout to use tabs --- sourcing/templates/edit.html | 34 +++++++++++++++++++++++++++------- sourcing/templates/view.html | 28 ++++++++++++++++++++-------- sourcing/view.py | 16 +++++++++------- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/sourcing/templates/edit.html b/sourcing/templates/edit.html index 98ad51c..7359322 100644 --- a/sourcing/templates/edit.html +++ b/sourcing/templates/edit.html @@ -1,17 +1,37 @@ +{% extends "base.html" %} {% from "form/controls.html" import render_field %} -{% set title="edit " + doc.title() %} +{% block title %}edit {{ doc.title() }}{% endblock %} +{% block content %} {% set action=doc.edit_url %} {% set label="save" %} {% set fields %} -{# -{{ render_field(form.filename) }} -{{ render_field(form.db_price_per_character) }} -{{ render_field(form.db_document_price) }} -#} {{ render_field(form.text, rows=20) }} {% endset %} -{% include "form/simple.html" %} + + +

{{ doc.title() }}

+ +{% include "form/main.html" %} +{% endblock %} diff --git a/sourcing/templates/view.html b/sourcing/templates/view.html index eb326c8..47f4ff4 100644 --- a/sourcing/templates/view.html +++ b/sourcing/templates/view.html @@ -3,16 +3,28 @@ {% block title %}{{ doc.title() }}{% endblock %} {% block content %} -

{{ self.title() }} - {# {% if doc.user == current_user %} #} - edit - {# {% endif %} #} + +

-

back to index

+ + + + + +

{{ self.title() }}

{% if span_length %} diff --git a/sourcing/view.py b/sourcing/view.py index c251112..882925f 100644 --- a/sourcing/view.py +++ b/sourcing/view.py @@ -174,11 +174,6 @@ def get_item(username, hashid): doc = None return doc if doc else abort(404) -def view_xanadoc(item): - return render_template('view/xanadoc.html', - item=item, - doc=fulfil_edl_with_sources(item.text)) - @bp.route('///edl') def view_edl(username, hashid): item = get_item(username, hashid) @@ -194,6 +189,15 @@ def view_edl(username, hashid): def view_item_raw(username, hashid): return view_item(username, hashid, raw=True) +@bp.route('///fulfil') +def fulfil(username, hashid): + item = get_item(username, hashid) + if item.type != 'xanadoc': + return abort(404) + return render_template('view/xanadoc.html', + item=item, + doc=fulfil_edl_with_sources(item.text)) + @bp.route('//') def view_item(username, hashid, raw=False): if ',' in hashid: @@ -207,8 +211,6 @@ def view_item(username, hashid, raw=False): item = get_item(username, hashid) if raw: return Response(item.text, mimetype='text/plain') - if item.type == 'xanadoc': - return view_xanadoc(item) return render_template('view.html', doc=item,