Skip to content

Commit

Permalink
feat: add intro info data display
Browse files Browse the repository at this point in the history
  • Loading branch information
oscie57 committed Jul 5, 2024
1 parent 21d466e commit c93f1d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
18 changes: 17 additions & 1 deletion templates/intro_info_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<tr>
<th scope="col">Sequence Number</th>
<th scope="col">Content Type</th>
<th scope="col">Thumbnail</th>
<th scope="col">Link Type</th>
<th scope="col">Actions</th>
</tr>
Expand All @@ -18,7 +19,22 @@
<tr>
<td>{{ info.cnt_id }}</td>
<td>{{ info.cnt_type.name }}</td>
<td>{{ info.link_type.name }}</td>

{% if info.cnt_type.name == "Image" %}
<td><img src="{{ url_for('get_info_image', cnt_id=info.cnt_id) }}" width="200"
alt="Thumbnail for {{ 5 }}"/></td>
{% else %}
<td>Not an image</td>
{% endif %}

{% if info.link_type.name == "TheatreMovie" or info.link_type.name == "Shop" or info.link_type.name == "Room" %}
<td>{{ info.link_type.name }}<br>Link ID ・ {{ info.link_id }}</td>
{% elif info.link_type.name == "TheatreCategory" or info.link_type.name == "Category" %}
<td>{{ info.link_type.name }}<br>Link ID ・ {{ info.link_id }}<br>Name ・ {{ info.cat_name }}</td>
{% else %}
<td>{{ info.link_type.name }}</td>
{% endif %}

{% if info.cnt_id != 1 %}
<!-- We will not allow for the first info to be deleted, things will tragically break if it is.-->
<td>
Expand Down
11 changes: 10 additions & 1 deletion theunderground/intro_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from io import BytesIO


from flask import render_template, request, flash, redirect, url_for
from flask import render_template, request, flash, redirect, url_for, send_from_directory
from asset_data import TVScreenAsset
from room import app, s3
from models import IntroInfo, db, ContentTypes
Expand Down Expand Up @@ -98,3 +98,12 @@ def update_intro_info_on_s3():
if s3:
event_xml = event_today()
s3.upload_fileobj(BytesIO(event_xml), config.r2_bucket_name, "event/today.xml")


@app.route("/theunderground/intro_info/<cnt_id>/thumbnail.jpg")
@oidc.require_login
def get_info_image(cnt_id):
if s3:
return redirect(f"{config.url1_cdn_url}/normal-intro/{cnt_id}-1.img")

return send_from_directory("assets/normal-intro/", f"{cnt_id}-1.img")

0 comments on commit c93f1d6

Please sign in to comment.