multi tree mode
parent
1ade6436b6
commit
e2657452ac
@ -1,9 +1,18 @@
|
||||
DROP TABLE IF EXISTS branches;
|
||||
DROP TABLE IF EXISTS trees;
|
||||
|
||||
CREATE TABLE branches (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
branch TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
parent TEXT NOT NULL,
|
||||
username TEXT
|
||||
);
|
||||
username TEXT,
|
||||
tree TEXT NOT NULL,
|
||||
FOREIGN KEY (tree) REFERENCES trees(slug)
|
||||
);
|
||||
|
||||
CREATE TABLE trees (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
slug TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
@ -1,9 +1,9 @@
|
||||
from flask import (Blueprint, flash, g, redirect,
|
||||
render_template, request, session, url_for)
|
||||
from flask import (Blueprint, render_template)
|
||||
|
||||
|
||||
bp = Blueprint('share', __name__, url_prefix='/share')
|
||||
|
||||
@bp.route('/<branch>/')
|
||||
def share(branch=None):
|
||||
return render_template('share.html', branch=branch)
|
||||
|
||||
@bp.route('/<tree>/<branch>/')
|
||||
def share(tree=None, branch=None):
|
||||
return render_template('share.html', tree=tree, branch=branch)
|
||||
|
@ -0,0 +1,28 @@
|
||||
<%inherit file="base_mako.html" />
|
||||
|
||||
|
||||
<%block name="head">
|
||||
<link rel="stylesheet" href="${url_for('static', filename='css/display.css')}">
|
||||
</%block>
|
||||
|
||||
<header>
|
||||
<h1>Exquisite Excerpts</h1>
|
||||
<p>Here is a list of all the writings trees</p>
|
||||
</header>
|
||||
|
||||
|
||||
<main class="container">
|
||||
<ul>
|
||||
% for tree in trees:
|
||||
<li class="tree">
|
||||
|
||||
<a href="${url_for('display.display', tree=tree['slug'])}">
|
||||
${tree['name']}
|
||||
</a>
|
||||
|
||||
|
||||
</li>
|
||||
% endfor
|
||||
</ul>
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue