Awesome UI templates full of color and joy
This commit is contained in:
@@ -18,40 +18,41 @@ def codeValidation(code):
|
||||
def codeLink(code):
|
||||
global links
|
||||
if code not in links:
|
||||
return None
|
||||
return False
|
||||
if len(links[code]['url'])==0:
|
||||
return None
|
||||
return links[code]['url']
|
||||
|
||||
@app.route("/create", methods=['GET', 'POST'])
|
||||
def create():
|
||||
code = request.args.get("code")
|
||||
@app.route("/edit", methods=['GET', 'POST'])
|
||||
def edit():
|
||||
code = request.form.get("code")
|
||||
print ("code: {}".format(code))
|
||||
if codeLink(code) is False:
|
||||
return render_template('invalid.html', code=code)
|
||||
if codeLink(code) is not None:
|
||||
return 'This link already points here: <a href="{0}"{0}</a>.'.format(codeLink(code))
|
||||
return "Creating a link for {}".format(request.args.get(""))
|
||||
return render_template('cantedit.html', url=codeLink(code))
|
||||
url = request.form.get("url")
|
||||
if url is None:
|
||||
return render_template('editlink.html', code=code)
|
||||
return render_template('success.html')
|
||||
|
||||
@app.route("/list", methods=['GET', 'POST'])
|
||||
@app.route("/admin", methods=['GET', 'POST'])
|
||||
def admin():
|
||||
return render_template('admin.html')
|
||||
|
||||
@app.route("/list")
|
||||
def list():
|
||||
return 'Look at all my codes:'
|
||||
return render_template('message.html', message='Comming soon!™')
|
||||
|
||||
@app.route('/', defaults={'path': ''})
|
||||
@app.route('/<path:path>')
|
||||
def catch_all(path):
|
||||
if len(path)==0:
|
||||
return landing_page(path)
|
||||
return render_template('welcome.html')
|
||||
if path in links:
|
||||
if codeLink(path) is not None:
|
||||
return redirect(links[path]['url'], code=302)
|
||||
else:
|
||||
return notfound(path)
|
||||
return render_template('newcode.html', code=path)
|
||||
else:
|
||||
return invalid(path)
|
||||
|
||||
def landing_page(path):
|
||||
return 'Hello, QR! You are here: {}'.format(path)
|
||||
|
||||
def notfound(path):
|
||||
return 'This is a new QR code. <a href="/create?code={}">Click here to create a link for it</a>'.format(path)
|
||||
|
||||
def invalid(path):
|
||||
return "Your code: {} is not valid. Please go away.".format(path)
|
||||
return render_template('invalid.html', code=path)
|
||||
@@ -0,0 +1,75 @@
|
||||
body {
|
||||
background-color: #C5C5C3;
|
||||
font-size: larger;
|
||||
font-family: "Helvetica Neue", "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
.outer-div
|
||||
{
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.floater
|
||||
{
|
||||
margin: 0 auto;
|
||||
width: 30rem;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content
|
||||
{
|
||||
min-height: 8em;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.graybar /* Girl! I want to take you to a gray bar! */
|
||||
{
|
||||
background-color: #4B4B4B;
|
||||
color: white!important;
|
||||
font-size: x-large;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.code{
|
||||
color: #4B4B4B;
|
||||
font-family: "Lucida Console", Monaco, monospace;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input{
|
||||
font-size: larger;
|
||||
font-family: "Helvetica Neue", "Segoe UI", sans-serif;
|
||||
background-color: white;
|
||||
margin-bottom: 1em;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button{
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
a{
|
||||
color: #202222;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p>Welcome Mr. admin person.</p>
|
||||
<p>This funcionality has not been implemented yet. Please return later</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>QR labels</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="outer-div">
|
||||
<div class="floater graybar">
|
||||
QR-Labels
|
||||
</div>
|
||||
<div class="floater content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p>This label already has this link attached to it:</p>
|
||||
<p><a href="{{url}}">{{url}}</a></p>
|
||||
<p>Configured labels can not be modified.</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form action=/edit method="post">
|
||||
<input type="hidden" name="code" value="{{code}}" />
|
||||
QR-code:<br />
|
||||
<input type="text" value="{{code}}" disabled /><br />
|
||||
URL:<br />
|
||||
<input type="text" name="url" value=""/><br />
|
||||
<button type="submit" class="graybar" >Save </button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p>This label <span class="code">{{code}}</span> is invalid!</p>
|
||||
<p>Please go away!</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{{message}}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
This is a new QR-Label. You can attach a link to it.<br />
|
||||
<form action=/edit method="post">
|
||||
<input type="hidden" name="code" value="{{code}}" />
|
||||
<button type="submit" class="graybar">Attach link</button>
|
||||
<form>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p>Your link has successfully been attached!</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p>Welcome to the QR-Label system.</p>
|
||||
<p>Scan any label using a standart QR reading app to follow the link attached to it. To create a new label, find a printed "blank" QR code from this system and scan it.</p>
|
||||
<p>Note that once created, a label can not be modified. Unless you are an <a href="/admin">admin</a>.</p>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user