old project, new git. welcome to echo
This commit is contained in:
156
templates/base.html
Normal file
156
templates/base.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="How far does your echo go?">
|
||||
<title>Echo</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" />
|
||||
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<link rel="icon" href="{{ url_for('static', filename='robots.txt') }}">
|
||||
<meta property="og:title" content="Echo" />
|
||||
<meta property="og:description" content="How far does your echo go?" />
|
||||
<meta property="og:url" content="{{ url_for('index') }}" />
|
||||
<meta property="og:image" content="{{ url_for('static', filename='icon.png') }}" />
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="hero is-black is-fullheight">
|
||||
<div class="hero-head">
|
||||
<nav class="navbar is-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="https://echo.bbrunson.com">
|
||||
<img src="/static/icon.png" width="28" height="28">
|
||||
</a>
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarMenuHeroA">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="navbarMenuHeroA" class="navbar-menu">
|
||||
<div class="navbar-end">
|
||||
<a href="{{ url_for('index') }}" class="navbar-item">
|
||||
Home
|
||||
</a>
|
||||
{% if current_user.is_authenticated %}
|
||||
<a href="{{ url_for('profile') }}" class="navbar-item">
|
||||
Profile
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if not current_user.is_authenticated %}
|
||||
<a href="{{ url_for('login') }}" class="navbar-item">
|
||||
Login
|
||||
</a>
|
||||
<div class="buttons navbar-item">
|
||||
<a class="button is-info" href="{{ url_for('signup') }}">
|
||||
<strong>Signup!</strong>
|
||||
</a>
|
||||
</div>
|
||||
<!-- <a href="{{ url_for('signup') }}" class="navbar-item">
|
||||
Sign Up
|
||||
</a> -->
|
||||
{% endif %}
|
||||
{% if current_user.is_authenticated %}
|
||||
<a href="{{ url_for('logout') }}" class="navbar-item">
|
||||
Logout
|
||||
</a>
|
||||
<!-- <div class="buttons navbar-item">
|
||||
<a class="button is-info" href="{{ url_for('profile') }}">
|
||||
<strong>Generate!</strong>
|
||||
</a>
|
||||
</div> -->
|
||||
{% endif %}
|
||||
{% if not current_user.is_authenticated %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
|
||||
// Add a click event on each of them
|
||||
$navbarBurgers.forEach( el => {
|
||||
el.addEventListener('click', () => {
|
||||
|
||||
// Get the target from the "data-target" attribute
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
||||
el.classList.toggle('is-active');
|
||||
$target.classList.toggle('is-active');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Functions to open and close a modal
|
||||
function openModal($el) {
|
||||
$el.classList.add('is-active');
|
||||
}
|
||||
|
||||
function closeModal($el) {
|
||||
$el.classList.remove('is-active');
|
||||
}
|
||||
|
||||
function closeAllModals() {
|
||||
(document.querySelectorAll('.modal') || []).forEach(($modal) => {
|
||||
closeModal($modal);
|
||||
});
|
||||
}
|
||||
|
||||
// Add a click event on buttons to open a specific modal
|
||||
(document.querySelectorAll('.js-modal-trigger') || []).forEach(($trigger) => {
|
||||
const modal = $trigger.dataset.target;
|
||||
const $target = document.getElementById(modal);
|
||||
|
||||
$trigger.addEventListener('click', () => {
|
||||
openModal($target);
|
||||
});
|
||||
});
|
||||
|
||||
// Add a click event on various child elements to close the parent modal
|
||||
(document.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach(($close) => {
|
||||
const $target = $close.closest('.modal');
|
||||
|
||||
$close.addEventListener('click', () => {
|
||||
closeModal($target);
|
||||
});
|
||||
});
|
||||
|
||||
// Add a keyboard event to close all modals
|
||||
document.addEventListener('keydown', (event) => {
|
||||
const e = event || window.event;
|
||||
|
||||
if (e.keyCode === 27) { // Escape key
|
||||
closeAllModals();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
<!-- <footer class="footer">
|
||||
</footer> -->
|
||||
|
||||
</html>
|
||||
112
templates/index.html
Normal file
112
templates/index.html
Normal file
@@ -0,0 +1,112 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1 class="title">
|
||||
Echo
|
||||
</h1>
|
||||
<h2 class="subtitle">
|
||||
How far does your voice go?
|
||||
</h2>
|
||||
<body>
|
||||
{% for echo in echos|reverse %}
|
||||
<br>
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<img src="https://bulma.io/images/placeholders/128x128.png">
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{{echo.name}}</strong> <small>@{{echo.handle}}</small> <small>{{echo.date}}</small>
|
||||
<br>
|
||||
{{echo.echo}}
|
||||
</p>
|
||||
</div>
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<a class="level-item">
|
||||
<button class="js-modal-trigger" data-target="modal-js-example">
|
||||
Reply
|
||||
</button>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-retweet"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-heart"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
{% for reply in replies|reverse %}
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<img src="https://bulma.io/images/placeholders/128x128.png">
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{{reply.name}}</strong> <small>@{{reply.handle}}</small> <small>{{reply.date}}</small>
|
||||
<br>
|
||||
{{reply.reply}}
|
||||
</p>
|
||||
</div>
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<a class="level-item">
|
||||
<button class="js-modal-trigger" data-target="modal-js-example">
|
||||
Reply
|
||||
</button>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-retweet"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-heart"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="media-right">
|
||||
<!-- <button class="delete"></button> -->
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="media-right">
|
||||
<!-- <button class="delete"></button> -->
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
<!-- <div class="columns is-variable is-multiline is-centered is-1-mobile">
|
||||
<img src="/static/images/example1.jpg">
|
||||
<img src="/static/images/example2.jpg">
|
||||
<img src="/static/images/example3.jpg">
|
||||
<img src="/static/images/example4.jpg">
|
||||
</div> -->
|
||||
<div id="modal-js-example" class="modal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-content">
|
||||
<div class="box">
|
||||
<p>Reply</p>
|
||||
<form method="POST" action="/reply">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="text" name="reply" placeholder="Reply" autofocus="">
|
||||
<input type="hidden" name="echo_id" value="">
|
||||
</div>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">Reply</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<button class="modal-close is-large" aria-label="close"></button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
36
templates/login.html
Normal file
36
templates/login.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h3 class="title">Login</h3>
|
||||
<div class="box">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" action="/login">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="email" name="email" placeholder="Your Email" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="password" name="password" placeholder="Your Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="remember">
|
||||
Remember me
|
||||
</label>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
94
templates/profile.html
Normal file
94
templates/profile.html
Normal file
@@ -0,0 +1,94 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<body>
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h1 class="title">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="box">
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
Welcome, {{ name }}!<br>
|
||||
<h4>Upload your profile picture:</h4>
|
||||
<form action="/pp" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="file">
|
||||
<input type="submit" value="Upload">
|
||||
</form>
|
||||
<br><br><br>
|
||||
<form method="POST" action="/echo">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="text" name="echo" placeholder="Echo" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">Echo</button>
|
||||
</form>
|
||||
<br>
|
||||
</h1>
|
||||
{% for echo in echos|reverse %}
|
||||
<br>
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<img src="https://bulma.io/images/placeholders/128x128.png">
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{{echo.name}}</strong> <small>@{{echo.handle}}</small> <small>{{echo.date}}</small>
|
||||
<br>
|
||||
{{echo.echo}}
|
||||
</p>
|
||||
</div>
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-reply"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-retweet"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-heart"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="media-right">
|
||||
<!-- <button class="delete"></button> -->
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $buttons = Array.prototype.slice.call(document.querySelectorAll('.button'), 0);
|
||||
|
||||
// Add a click event on each of them
|
||||
$buttons.forEach( el => {
|
||||
el.addEventListener('click', () => {
|
||||
|
||||
// Get the target from the "data-target" attribute
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
||||
el.classList.toggle('is-loading');
|
||||
$target.classList.toggle('is-loading');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</h1>
|
||||
{% endblock %}
|
||||
43
templates/signup.html
Normal file
43
templates/signup.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h3 class="title">Sign Up</h3>
|
||||
<div class="box">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}. Go to <a href="{{ url_for('login') }}">login page</a>.
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" action="/signup">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="handle" name="handle" placeholder="Handle" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="email" name="email" placeholder="Email" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="text" name="name" placeholder="Name" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="password" name="password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="button is-block is-info is-large is-fullwidth">Sign Up</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
89
templates/user.html
Normal file
89
templates/user.html
Normal file
@@ -0,0 +1,89 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<body>
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h1 class="title">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="box">
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{{ handle }}'s echos!<br><br><br>
|
||||
<!-- <br>
|
||||
<form method="POST" action="/echo">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="text" name="echo" placeholder="Echo" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">Echo</button>
|
||||
</form> -->
|
||||
<br>
|
||||
</h1>
|
||||
{% for echo in echos|reverse %}
|
||||
<br>
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<img src="https://bulma.io/images/placeholders/128x128.png">
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{{echo.name}}</strong> <small>@{{echo.handle}}</small> <small>{{echo.date}}</small>
|
||||
<br>
|
||||
{{echo.echo}}
|
||||
</p>
|
||||
</div>
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-reply"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-retweet"></i></span>
|
||||
</a>
|
||||
<a class="level-item">
|
||||
<span class="icon is-small"><i class="fas fa-heart"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="media-right">
|
||||
<!-- <button class="delete"></button> -->
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $buttons = Array.prototype.slice.call(document.querySelectorAll('.button'), 0);
|
||||
|
||||
// Add a click event on each of them
|
||||
$buttons.forEach( el => {
|
||||
el.addEventListener('click', () => {
|
||||
|
||||
// Get the target from the "data-target" attribute
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
||||
el.classList.toggle('is-loading');
|
||||
$target.classList.toggle('is-loading');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</h1>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user