Skip to content

Commit 3ba7704

Browse files
committed
feat: Add PTBR to the panel
1 parent 3901e69 commit 3ba7704

File tree

7 files changed

+90
-0
lines changed

7 files changed

+90
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"""Add PTBR to Videos and Banners
2+
3+
Revision ID: 940f189d9623
4+
Revises: 862433351ed0
5+
Create Date: 2026-03-08 13:52:03.381069
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '940f189d9623'
14+
down_revision = '862433351ed0'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
with op.batch_alter_table('banners', schema=None) as batch_op:
22+
batch_op.add_column(sa.Column('name_ptbr', sa.String(length=102), nullable=True))
23+
24+
with op.batch_alter_table('videos', schema=None) as batch_op:
25+
batch_op.add_column(sa.Column('name_ptbr', sa.String(length=102), nullable=True))
26+
27+
op.execute("""
28+
UPDATE banners
29+
SET name_ptbr = 'None';
30+
""")
31+
32+
op.execute("""
33+
UPDATE videos
34+
SET name_ptbr = 'None';
35+
""")
36+
37+
# ### end Alembic commands ###
38+
39+
40+
def downgrade():
41+
# ### commands auto generated by Alembic - please adjust! ###
42+
with op.batch_alter_table('videos', schema=None) as batch_op:
43+
batch_op.drop_column('name_ptbr')
44+
45+
with op.batch_alter_table('banners', schema=None) as batch_op:
46+
batch_op.drop_column('name_ptbr')
47+
48+
# ### end Alembic commands ###

models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Videos(db.Model):
1313
name_spanish = db.Column(db.String(102))
1414
name_italian = db.Column(db.String(102))
1515
name_dutch = db.Column(db.String(102))
16+
name_ptbr = db.Column(db.String(102))
1617
length = db.Column(db.Integer)
1718
video_type = db.Column(db.Integer)
1819
date_added = db.Column(db.DateTime, nullable=False, server_default=func.now())
@@ -47,4 +48,5 @@ class Banners(db.Model):
4748
name_spanish = db.Column(db.String(102))
4849
name_italian = db.Column(db.String(102))
4950
name_dutch = db.Column(db.String(102))
51+
name_ptbr = db.Column(db.String(102))
5052
order = db.Column(db.Integer)

templates/banner_add.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ <h3 class="text-md font-medium text-gray-200 mb-3">European Titles</h3>
134134
focus:border-indigo-500", placeholder="Enter Dutch title") }}
135135
</div>
136136
</div>
137+
138+
<div>
139+
<label for="{{ form.title_ptbr.id }}"
140+
class="block text-sm font-medium text-gray-300 mb-2">Brazilian Portuguese Title:</label>
141+
<div class="relative rounded-md shadow-sm">
142+
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
143+
<img src="/static/icon/type.svg" alt="Icon" class="w-5 h-5 invert opacity-50" />
144+
</div>
145+
{{ form.title_ptbr(class_="bg-gray-700 border border-gray-600 text-white pl-10 w-full
146+
px-4 py-2 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500
147+
focus:border-indigo-500", placeholder="Enter Brazilian Portuguese title") }}
148+
</div>
149+
</div>
137150
</div>
138151
</div>
139152

templates/video_action.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ <h2 class="text-xl font-bold text-white">Video Details</h2>
123123
rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",
124124
placeholder="Title line 2...") }}
125125
</div>
126+
127+
<div>
128+
<label for="{{ form.title_ptbr.id }}"
129+
class="block text-sm font-medium text-gray-300 mb-2">Brazilian Portuguese Title:</label>
130+
{{ form.title_ptbr(class_="bg-gray-700 border border-gray-600 text-white w-full px-4 py-2
131+
rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",
132+
placeholder="Title line 1...") }}
133+
{{ form.title_ptbr_2(class_="bg-gray-700 border border-gray-600 text-white w-full px-4 py-2
134+
rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",
135+
placeholder="Title line 2...") }}
136+
</div>
126137
</div>
127138

128139
<div>

thegateway/banner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def add_banner():
5959
name_spanish=form.title_es.data,
6060
name_italian=form.title_it.data,
6161
name_dutch=form.title_dutch.data,
62+
name_ptbr=form.title_ptbr.data,
6263
order=Banners.query.count() + 1,
6364
)
6465

thegateway/form.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class VideoForm(FlaskForm):
7171
title_nl_2 = StringField(
7272
validators=[Length(max=51)]
7373
)
74+
title_ptbr = StringField(
75+
validators=[DataRequired(), Length(max=51)]
76+
)
77+
title_ptbr_2 = StringField(
78+
validators=[Length(max=51)]
79+
)
7480
video_type = SelectField("Video Type", choices=VideoType.choices())
7581
thumbnail = FileField("Video thumbnail")
7682
upload = SubmitField("Add Video")
@@ -98,6 +104,9 @@ class BannerForm(FlaskForm):
98104
title_dutch = StringField(
99105
"Title (Dutch)", validators=[DataRequired(), Length(max=102)]
100106
)
107+
title_ptbr = StringField(
108+
"Title (Brazilian Portuguese)", validators=[DataRequired(), Length(max=102)]
109+
)
101110
thumbnail = FileField("Image", validators=[FileRequired()])
102111
upload = SubmitField("Add")
103112

thegateway/videos.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def edit_video(movie_id):
8383
movie.name_spanish = form.title_es.data + "\n" + form.title_es_2.data
8484
movie.name_italian = form.title_it.data + "\n" + form.title_it_2.data
8585
movie.name_dutch = form.title_nl.data + "\n" + form.title_nl_2.data
86+
movie.name_ptbr = form.title_ptbr.data + "\n" + form.title_ptbr_2.data
8687
movie.video_type = form.video_type.data
8788
db.session.commit()
8889

@@ -95,6 +96,7 @@ def edit_video(movie_id):
9596
split_es = movie.name_spanish.split("\n")
9697
split_it = movie.name_italian.split("\n")
9798
split_nl = movie.name_dutch.split("\n")
99+
split_ptbr = movie.name_ptbr.split("\n")
98100

99101
form.title_jpn.data = split_jpn[0]
100102
if len(split_jpn) > 1:
@@ -117,6 +119,9 @@ def edit_video(movie_id):
117119
form.title_nl.data = split_nl[0]
118120
if len(split_nl) > 1:
119121
form.title_nl_2.data = split_nl[1]
122+
form.title_ptbr.data = split_ptbr[0]
123+
if len(split_ptbr) > 1:
124+
form.title_ptbr_2.data = split_ptbr[1]
120125

121126
form.video_type.data = movie.video_type
122127

@@ -149,6 +154,7 @@ def add_video():
149154
name_spanish=form.title_es.data + "\n" + form.title_es_2.data,
150155
name_italian=form.title_it.data + "\n" + form.title_it_2.data,
151156
name_dutch=form.title_nl.data + "\n" + form.title_nl_2.data,
157+
name_ptbr=form.title_ptbr.data + "\n" + form.title_ptbr_2.data,
152158
length=length,
153159
video_type=form.video_type.data,
154160
)

0 commit comments

Comments
 (0)