mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-15 00:13:23 -06:00
remove all server sided form/page processing - now obsolete
This commit is contained in:
@@ -24,20 +24,11 @@ def create_app(env=None):
|
||||
"""
|
||||
app = Flask(__name__)
|
||||
|
||||
# Add Sass middleware (black magic)
|
||||
app.wsgi_app = SassMiddleware(app.wsgi_app, {
|
||||
'server': ('static/sass', 'static/css', '/static/css', False)
|
||||
})
|
||||
|
||||
# Load configuration values
|
||||
if not env:
|
||||
env = app.config['ENV']
|
||||
app.config.from_object(configs[env])
|
||||
|
||||
# Fixes poor whitespace rendering in templates
|
||||
app.jinja_env.trim_blocks = True
|
||||
app.jinja_env.lstrip_blocks = True
|
||||
|
||||
# Initialize Flask extensions
|
||||
csrf.init_app(app)
|
||||
cors.init_app(app)
|
||||
@@ -49,29 +40,7 @@ def create_app(env=None):
|
||||
"""Provides specific Flask components to the shell."""
|
||||
return {'app': app}
|
||||
|
||||
# Custom error handler page (all errors)
|
||||
@app.errorhandler(HTTPException)
|
||||
def handle_exception(e):
|
||||
"""Error handler, sends users to a custom error page template."""
|
||||
return render_template('error.html', exception=e), e.code
|
||||
|
||||
@app.context_processor
|
||||
def inject_debug():
|
||||
"""
|
||||
Allows for testing for debug mode in jinja2 templates.
|
||||
"""
|
||||
return dict(debug=app.debug)
|
||||
|
||||
@app.context_processor
|
||||
def inject_data():
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
with open(os.path.join(BASE_DIR, 'data', 'data.json'), 'r', encoding='utf-8') as file:
|
||||
return dict(data=json.load(file))
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
with app.app_context():
|
||||
# noinspection PyUnresolvedReferences
|
||||
from server import routes
|
||||
# noinspection PyUnresolvedReferences
|
||||
from server import api
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
from flask import current_app, render_template, abort
|
||||
|
||||
from server.helpers import check_validity
|
||||
|
||||
|
||||
@current_app.route('/')
|
||||
def index():
|
||||
"""Index page."""
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
@current_app.route('/<int:season>')
|
||||
def view_season(season):
|
||||
if not check_validity(season, 1):
|
||||
abort(404)
|
||||
return render_template('season.html', season=season)
|
||||
|
||||
|
||||
@current_app.route('/<int:season>/<int:episode>')
|
||||
def view_episode(season, episode):
|
||||
if not check_validity(season, episode):
|
||||
abort(404)
|
||||
return render_template('episode.html', season=season, episode=episode)
|
||||
@@ -1,43 +0,0 @@
|
||||
.accordion .list-group-item {
|
||||
border-radius: 0;
|
||||
border-width: 0 0 0 0;
|
||||
border-bottom-width: 1px;
|
||||
.list-group-item:first-child { border-top-width: 1px; }
|
||||
.list-group-item:last-child { border-bottom-width: 0; }
|
||||
|
||||
padding-left: 30px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.accordion .list-group-item a {
|
||||
//color: #61656b;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.accordion .list-group-item .badge {
|
||||
float: right;
|
||||
min-width: 36px;
|
||||
}
|
||||
|
||||
.accordion .card-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .125);
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid rgba(0, 0, 0, .125);
|
||||
border-bottom-color: rgba(0, 0, 0, 0.125);
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.no-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.no-link:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta charset="UTF-8">
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.ico') }}" type="image/x-icon">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{# Site scripts #}
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
|
||||
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
||||
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
|
||||
crossorigin="anonymous">
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
|
||||
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://kit.fontawesome.com/52acc1d37a.js" crossorigin="anonymous"></script>
|
||||
{# CSRF Tokens #}
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
{# Stylesheets #}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.scss.css') }}">
|
||||
<script>window.jQuery || document.write('<script src="{{ url_for('static', filename='js/jquery.js') }}">\x3C/script>')</script>
|
||||
<title>OfficeQuotes{{ ' | ' ~ title if title }}</title>
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}
|
||||
<div class="container-fluid my-5 mx-5">
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xl-2 col-md-12">
|
||||
<div class="accordion" id="season-accordion" role="tablist" aria-multiselectable="true">
|
||||
{% for season in data %}
|
||||
<div class="card">
|
||||
<div class="card-header" id="season-heading-{{ season.season_id }}">
|
||||
<a class="collapsed no-link" data-toggle="collapse" data-parent="#season-accordion"
|
||||
href="#collapse-season-{{ season.season_id }}"
|
||||
aria-expanded="false" aria-controls="collapse-season-{{ season.season_id }}">
|
||||
<h5 class="mb-0 pu-0 mu-0">
|
||||
Season {{ season.season_id }}
|
||||
<i class="fas fa-chevron-down float-right"></i>
|
||||
</h5>
|
||||
</a>
|
||||
</div>
|
||||
<div id="collapse-season-{{ season.season_id }}" class="collapse"
|
||||
aria-labelledby="season-heading-{{ season.season_id }}"
|
||||
data-parent="#season-accordion">
|
||||
<div class="card-body h-100 px-0">
|
||||
<ul class="list-group">
|
||||
{% for episode in season.episodes %}
|
||||
<li class="list-group-item">
|
||||
<a class="no-link"
|
||||
href="{{ url_for('view_episode', season=season.season_id, episode=episode.episode_id) }}">
|
||||
Ep. {{ episode.episode_id }} - {{ episode.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% block page %}
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="my-0">
|
||||
Season {{ season }} Episode {{ episode }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% set episode_data = data[season - 1]['episodes'][episode - 1] %}
|
||||
{% block page %}
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="my-0">
|
||||
Season {{ season }}, Episode {{ episode }} - {{ episode_data.title }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ episode_data.description }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page %}
|
||||
@@ -1 +0,0 @@
|
||||
{# Provide a basic error page understandable to every user. #}
|
||||
@@ -1,14 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block page %}
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="my-0">
|
||||
The Office Quotes
|
||||
</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page %}
|
||||
@@ -1,15 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block page %}
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="my-0">
|
||||
Season {{ season }}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page %}
|
||||
Reference in New Issue
Block a user