mako template wip

mako
km0 3 years ago
parent ae185baf0c
commit 92d027e9a1

@ -1,6 +1,7 @@
import os
from flask import Flask, send_from_directory
from . import prefix
from flask_mako import MakoTemplates
def create_app(test_config=None):
@ -27,6 +28,8 @@ def create_app(test_config=None):
from . import db
db.init_app(app)
mako = MakoTemplates(app)
@app.route("/favicon.ico")
def favicon():
return send_from_directory(

@ -1,5 +1,6 @@
from flask import (Blueprint, flash, g, redirect,
render_template, request, session, url_for)
request, session, url_for)
from flask_mako import render_template
from exquisite_branch.db import get_db
@ -28,7 +29,7 @@ def display():
streams.append(stream[::-1])
return render_template('display.html', branches=branches, streams=streams)
return render_template('display_mako.html', branches=branches, streams=streams)
def flatten(t):

@ -0,0 +1,49 @@
.streams {
overflow-x: auto;
overflow-y: hidden;
position: relative;
width: 500px;
height: 500px;
display: inline-block;
}
.stream {
white-space: nowrap;
position: absolute;
display: inline-block;
width: 500px;
height: 500px;
position: relative;
top: 5000px;
left: 0px;
}
.svg-container {
position: absolute;
top: 0;
left: 0;
display: inline-block;
}
.author {
position: absolute;
left: 50%;
bottom: 50px;
font-size: 1rem;
background-color: white;
}
.branches {
overflow-x: auto;
overflow-y: hidden;
}
.branch {
white-space: nowrap;
}
.branch svg {
border-top: 1px solid currentColor;
}

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Exquisite Branch</title>
<link rel="stylesheet" href="${url_for('static', filename='css/variables.css')}" />
<link rel="stylesheet" href="${url_for('static', filename='css/global.css')}" />
<%block name='head' %></%block>
</head>
<body>
<nav>
<%block name='nav' >
<a href="{{url_for('home.home')}}">Home</a>
<a href="{{url_for('display.display')}}">Results</a>
</%block>
</nav>
${self.body()}
</body>
</html>

@ -0,0 +1,20 @@
<%inherit file="base_mako.html" />
<%block name="head">
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}">
</%block>
<% from random import random %>
% for stream in streams:
<div class="stream">
<% transform = '' %>
% for branch in stream:
<% transform = transform + ' rotate(' + str(random() * 0.1) + 'turn) translateX(100%)'%>
<div class="svg-container" style="transform: ${transform}">${branch['content']}</div>
% endfor
</div>
% endfor
Loading…
Cancel
Save