Added the url page and changed the title to an anchor tag
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ def index():
|
||||
|
||||
# If the form was valid
|
||||
if form.validate_on_submit():
|
||||
return "Valid URL: " + form.url.data
|
||||
return render_template("url.html", url=form.url.data)
|
||||
|
||||
# If the form was invalid or not submitted
|
||||
else:
|
||||
|
||||
+11
-5
@@ -9,7 +9,7 @@ body {
|
||||
|
||||
}
|
||||
|
||||
.header {
|
||||
.headers {
|
||||
position: absolute;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@@ -19,9 +19,15 @@ body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #ffffff;
|
||||
.title:link {
|
||||
color: #bb86fc;
|
||||
text-decoration: none;
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title:hover {
|
||||
color: #7b59a5;
|
||||
}
|
||||
|
||||
.desc {
|
||||
@@ -61,7 +67,7 @@ body {
|
||||
border-color: #7b59a5;
|
||||
}
|
||||
|
||||
.submit {
|
||||
.button {
|
||||
background: #bb86fc;
|
||||
border: 2px solid #bb86fc;
|
||||
border-radius: 3px;
|
||||
@@ -71,7 +77,7 @@ body {
|
||||
margin: 0 3% 0 1%;
|
||||
}
|
||||
|
||||
.submit:hover {
|
||||
.button:hover {
|
||||
background: #7b59a5;
|
||||
border-color: #7b59a5;
|
||||
}
|
||||
|
||||
@@ -3,24 +3,23 @@
|
||||
{% block body %}
|
||||
{% if form.url.errors %}
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1 class="title">tiny0</h1>
|
||||
<div class="headers">
|
||||
<a class="title" href="{{ url_for('index') }}">tiny0</a>
|
||||
<h1 class="desc">Custom URL Shortener</h1>
|
||||
</div>
|
||||
{% else %}
|
||||
<body onload="typeTitle()">
|
||||
<div class="header">
|
||||
<h1 id="title" class="title"></h1>
|
||||
<div class="headers">
|
||||
<a class="title" id="title" href="{{ url_for('index') }}"></a>
|
||||
<h1 id="desc" class="desc"></h1>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="container">
|
||||
<form method="POST" action="">
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="inputs">
|
||||
{{ form.url(placeholder="Enter the URL here", class="url") }}
|
||||
{{ form.submit(class="submit") }}
|
||||
{{ form.submit(class="button") }}
|
||||
</div>
|
||||
</form>
|
||||
{% if form.url.errors %}
|
||||
@@ -30,6 +29,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not form.url.errors %}
|
||||
<script>
|
||||
var i = 0;
|
||||
var title_text = "tiny0";
|
||||
@@ -56,5 +56,6 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
|
||||
<div id="page-container">
|
||||
<div id="content-wrap">
|
||||
|
||||
{% block body %}{% endblock %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<body>
|
||||
<div class="headers">
|
||||
<a class="title" href="{{ url_for('index') }}">tiny0</a>
|
||||
<h1 class="desc">Custom URL Shortener</h1>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="inputs">
|
||||
<input type="text" value="{{ url }}" id="url" class="url" readonly>
|
||||
<button onclick="copyURL()" class="button">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function copyURL() {
|
||||
var url = document.getElementById("url");
|
||||
url.select();
|
||||
url.setSelectionRange(0, 99999)
|
||||
document.execCommand("copy");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user