~muirrum/lost

fb9db4ddaa4c2b6c14638c8f6976415090597750 — Cara Salter 4 months ago e9e97da master
Make "lost.html" page
A Makefile => Makefile +39 -0
@@ 0,0 1,39 @@
SHELL := /bin/bash
all: clean

# Clean up temp files
#------------------------------------------------------------------
clean:
	@echo "Cleaning up temp files"
	@find . -name '*~' -ls -delete
	@find . -name '*.bak' -ls -delete
	@echo "Cleaning up __pycache__ directories"
	@find . -name __pycache__ -type d -not -path "./.venv/*" -ls -exec rm -r {} +
	@echo "Cleaning up logfiles"
	@find ./logs -name '*.log*' -ls -delete
	@echo "Cleaning up flask_session"
	@find . -name flask_session -type d -not -path "./.venv/*" -ls -exec rm -r {} +

init_env:
	python3 -m venv .venv
	source .venv/bin/activate && pip3 install --upgrade pip
	source .venv/bin/activate && pip3 install -r requirements.txt txt

upgrade_env:
	source .venv/bin/activate && pip3 install --upgrade -r requirements.txt

make_migrations:
	source .venv/bin/activate && flask db migrate

run_migrations:
	source .venv/bin/activate && flask db upgrade

daemon:
	@echo "--- STARTING UWSGI DAEMON ---"
	@echo ""
	@echo ""	
	source .venv/bin/activate && flask run --debug
	@echo ""
	@echo ""
	@echo "--- STARTING UWSGI DAEMON ---"	
	

M lost/__init__.py => lost/__init__.py +9 -2
@@ 1,4 1,4 @@
from flask import Flask
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_migrate import Migrate


@@ 23,7 23,7 @@ def create_app():
    scss = Bundle('scss/style.scss', filters='scss', output='gen/style.css')
    env.register('scss', scss)

    from .models import User
    from .models import User, Asset

    from lost import cli



@@ 36,4 36,11 @@ def create_app():
    app.cli.add_command(cli.gr)
    app.cli.add_command(cli.assets)

    @app.route("/<int:asset_number>")
    def lost_asset(asset_number):
        asset = Asset.query.filter_by(asset_number=asset_number).one_or_none()
        return render_template("lost.html", asset=asset)

    return app



M lost/static/gen/style.css => lost/static/gen/style.css +17 -0
@@ 13,6 13,19 @@ a a:active, a:visited {
  width: 60%;
}

.container {
  height: 100vh;
}

.centered {
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
}

button,
input[type=submit] {
  border-radius: 8px;


@@ 32,6 45,10 @@ h1, h2, h3, h4, h5, h6 {
  width: 50%;
}

.no-border {
  border-bottom: none;
}

.navbar {
  list-style-type: none;
  margin: 0;

M lost/static/scss/style.scss => lost/static/scss/style.scss +17 -0
@@ 22,6 22,19 @@ a a:active, a:visited {
    width: 60%;
}

.container {
    height: 100vh;
}
.centered {
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
//  border: 2px dashed #f69c55;
}

button,
input[type=submit]{
    border-radius: 8px;


@@ 41,6 54,10 @@ h1,h2,h3,h4,h5,h6 {
    width:50%;
}

.no-border {
    border-bottom: none;
}

// Navbar

.navbar {

A lost/templates/lost.html => lost/templates/lost.html +13 -0
@@ 0,0 1,13 @@
{% extends 'layout.html' %}

{% block content %}
    <div class="centered" style="display: flex; flex-direction: column;">
        {% if asset != None %}
        <h1 class="no-border" style="justify-content: flex-start;">You found my {{asset.name}}!</h1>
        {% else %}
        <h1 class="no-border">Doesn't look like I have that registered :(</h1>
        {% endif %}
        <br/>
        <h3 class="no-border" style="margin-left: 1rem;">I'd {% if asset == None %}still {% endif %}really appreciate getting it back! Shoot me an email at lost [at] devcara [dot] com</h3>
    </div>
{% endblock content %}
\ No newline at end of file