WIP episode list.
This commit is contained in:
8
app.py
8
app.py
@@ -183,9 +183,13 @@ def season_overview(season_id: int):
|
|||||||
@authorize
|
@authorize
|
||||||
def episode_list(season_id: int):
|
def episode_list(season_id: int):
|
||||||
sql, args = db.load_season(season_id)
|
sql, args = db.load_season(season_id)
|
||||||
db_season = db.query_db(sql, args, one=True, cls=models.Season)
|
season = db.query_db(sql, args, one=True, cls=models.Season)
|
||||||
|
sql, args = db.load_episodes(season_id)
|
||||||
|
episodes = db.query_db(sql, args, cls=models.Episode)
|
||||||
|
|
||||||
model = {"season_id": season_id, "season_code": db_season.code}
|
model = {
|
||||||
|
"season_id": season_id,
|
||||||
|
"season_code": season.code}
|
||||||
return render_template("episode_list.html", model=model)
|
return render_template("episode_list.html", model=model)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
db.py
1
db.py
@@ -4,7 +4,6 @@ from flask import g
|
|||||||
|
|
||||||
import models
|
import models
|
||||||
from config import Config
|
from config import Config
|
||||||
from util import time_to_str
|
|
||||||
|
|
||||||
|
|
||||||
def connect_db():
|
def connect_db():
|
||||||
|
|||||||
@@ -5,36 +5,48 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
{% if g.is_editor %}
|
{% if g.is_editor %}
|
||||||
<div class="btn-toolbar" role="toolbar">
|
<div class="btn-toolbar" role="toolbar">
|
||||||
<a class="btn btn-primary" href="/newepisode" role="button">New Episode</a>
|
<a class="btn btn-primary" href="{{ url_for("episode_new", season_id = model.season_id)}}" role="button">
|
||||||
|
<span class="fas fa-plus"></span>Episode
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not model.player_list %}
|
{% if not model.player_list %}
|
||||||
There are no episodes.
|
<div class="alert alert-info">There are no episodes.</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<table class="table table-hover table-striped table-bordered">
|
<table class="table table-hover table-striped table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{% for prop, caption in model.columns %}
|
<th scope="col" class="col-sm-auto text-center">#</th>
|
||||||
<th scope="col" class="col-sm-auto text-center">{{ caption }}</th>
|
<th scope="col" class="col-sm-auto text-center">Title</th>
|
||||||
{% endfor %}
|
<th scope="col" class="col-sm-auto text-center">Date</th>
|
||||||
|
<th scope="col" class="col-sm-auto text-center">From - To</th>
|
||||||
|
<th scope="col" class="col-sm-auto text-center">Playtime</th>
|
||||||
|
|
||||||
<th scope="col" class="col-sm-auto text-center"></th>
|
<th scope="col" class="col-sm-auto text-center">Stats</th>
|
||||||
{% if g.is_editor %}
|
{% if g.is_editor %}
|
||||||
<th scope="col" class="col-sm-auto text-center"></th>
|
<th scope="col" class="col-sm-auto text-center">Editor</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for ep in model.episodes %}
|
{% for item in model.episodes %}
|
||||||
<tr>
|
<tr>
|
||||||
{% for prop, _ in model.columns %}
|
<td class="col-sm-auto text-center">{{ item.code }}</td>
|
||||||
<td class="col-sm-auto text-center">{{ ep[prop] }}</td>
|
<td class="col-sm-auto text-center">{{ item.title }}</td>
|
||||||
{% endfor %}
|
<td class="col-sm-auto text-center">{{ item.date }}</td>
|
||||||
|
<td class="col-sm-auto text-center">{{ item.start }} - {{ item.end }}</td>
|
||||||
|
<td class="col-sm-auto text-center">{{ item.duration }}</td>
|
||||||
|
|
||||||
<a class="btn btn-default" href="/episodes/{{ ep['id'] }}">Show</a>
|
<td class="col-sm-auto text-center">
|
||||||
|
<a class="btn btn-default" href="{{ url_for("episode_stats", episode_id = item.id) }}">
|
||||||
|
<span class="fas fa-eye"></span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
{% if g.is_editor %}
|
{% if g.is_editor %}
|
||||||
<td class="col-sm-auto text-center">
|
<td class="col-sm-auto text-center">
|
||||||
<a class="btn btn-default" href="/editepisode/{{ ep['id'] }}">Edit</a>
|
<a class="btn btn-default" href="{{ url_for("episode_edit", episode_id = item.id, season_id = model.season_id) }}">
|
||||||
|
<span class="fas fa-pencil-alt"></span>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user