From 78cde1abb3d778924b4460e2a2173093e9eb0dc4 Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Wed, 31 Jul 2024 22:57:36 -0400 Subject: [PATCH] Update MIVS form for Super 2025 While we couldn't get everything on the list done before opening time, this should improve the MIVS workflow a bit! --- ...c_add_player_count_content_warning_and_.py | 66 +++++++++++++++++++ docs/DEVELOPERS.md | 6 +- uber/models/mivs.py | 5 ++ uber/templates/mivs/game.html | 42 ++++++++++++ uber/templates/mivs/index.html | 11 ++-- 5 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 alembic/versions/983af01225fc_add_player_count_content_warning_and_.py diff --git a/alembic/versions/983af01225fc_add_player_count_content_warning_and_.py b/alembic/versions/983af01225fc_add_player_count_content_warning_and_.py new file mode 100644 index 000000000..0c3f0dd67 --- /dev/null +++ b/alembic/versions/983af01225fc_add_player_count_content_warning_and_.py @@ -0,0 +1,66 @@ +"""Add player count, content warning, and photosensitivity warning to MIVS games + +Revision ID: 983af01225fc +Revises: f1a8794a398f +Create Date: 2024-08-01 02:28:06.735773 + +""" + + +# revision identifiers, used by Alembic. +revision = '983af01225fc' +down_revision = 'f1a8794a398f' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql +import residue + + +try: + is_sqlite = op.get_context().dialect.name == 'sqlite' +except Exception: + is_sqlite = False + +if is_sqlite: + op.get_context().connection.execute('PRAGMA foreign_keys=ON;') + utcnow_server_default = "(datetime('now', 'utc'))" +else: + utcnow_server_default = "timezone('utc', current_timestamp)" + +def sqlite_column_reflect_listener(inspector, table, column_info): + """Adds parenthesis around SQLite datetime defaults for utcnow.""" + if column_info['default'] == "datetime('now', 'utc')": + column_info['default'] = utcnow_server_default + +sqlite_reflect_kwargs = { + 'listeners': [('column_reflect', sqlite_column_reflect_listener)] +} + +# =========================================================================== +# HOWTO: Handle alter statements in SQLite +# +# def upgrade(): +# if is_sqlite: +# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op: +# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False) +# else: +# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False) +# +# =========================================================================== + + +def upgrade(): + op.add_column('indie_game', sa.Column('is_multiplayer', sa.Boolean(), server_default='False', nullable=False)) + op.add_column('indie_game', sa.Column('content_warning', sa.Boolean(), server_default='False', nullable=False)) + op.add_column('indie_game', sa.Column('photosensitive_warning', sa.Boolean(), server_default='False', nullable=False)) + op.add_column('indie_game', sa.Column('warning_desc', sa.Unicode(), server_default='', nullable=False)) + + +def downgrade(): + op.drop_column('indie_game', 'warning_desc') + op.drop_column('indie_game', 'content_warning') + op.drop_column('indie_game', 'photosensitive_warning') + op.drop_column('indie_game', 'is_multiplayer') diff --git a/docs/DEVELOPERS.md b/docs/DEVELOPERS.md index 34a1b1cc9..3f4123ca3 100644 --- a/docs/DEVELOPERS.md +++ b/docs/DEVELOPERS.md @@ -76,7 +76,7 @@ When cloning the repository with Git (`git clone REPOURL`), your repo URL can lo | :exclamation: If cloning a repo with non-alphanumeric characters, like hyphens, you should rename the base repo folder to convert them to underscores. E.g., `mff-rams-plugin` should be renamed to `mff_rams_plugin`. | |---------------------------------------------------------------------------------------------------------------| -To enable your plugin, you'll follow the loading instructions below. First, though, make sure your plugin has a config override file. You can [download the file from a config repo](configuration#generated-configuration) (if applicable) or create a blank text file in the root folder of the plugin. It should be named after the plugin itself, e.g., `/magprime/magprime.ini`. +To enable your plugin, you'll follow the loading instructions below. First, though, make sure your plugin has a config override file. You can [download the file from a config repo](configuration#generated-configuration) (if applicable) or create a blank INI file in the root folder of the plugin. It should be named after the plugin itself, e.g., `/magprime/magprime.ini` for the magprime plugin. ### Loading Custom Config and Plugins The last step for loading custom config or plugins (or both) is to tell Docker Compose to use them. There are a few ways to do this, but here we'll cover how to use environment variables defined in an `.env` file. @@ -88,6 +88,8 @@ Instead, we have an `.env.example` file, located in the root of this repository. - On the line `PLUGIN_NAME=yourplugin`, replace `yourplugin` with your plugin folder's name in its normal case, e.g., `magprime`. - On the line `YOURPLUGIN_CONFIG_FILES=${PLUGIN_NAME}`, change `YOURPLUGIN` to an all-caps version of your plugin folder's name, e.g., `MAGPRIME`. +Alternatively, if you want to load custom config but no plugin, delete or use the `#` character to comment out all lines except `UBER_CONFIG_FILES=uber.ini`. + If you used these instructions to set up your config file(s) (`uber.ini` for this repository, plus `yourplugin.ini` for any custom plugins), that's all you need to change. The next time you use `docker compose up`, your plugin and custom config will be loaded! ## Enabling SAML Login @@ -168,4 +170,4 @@ Once you have an `.env` file, open it and edit the line `COMPOSE_PROFILES=dev`. |---------------------------------------------------------------------------------------------------------------| ### Invalid Cert Bypass -Since the certificate is self-signed, your browser may show a warning screen when you try to browse to https://localhost/. The exact screen varies based on the browser, but there is always a way to bypass this warning to continue to your local server. This may be hidden behind an extra link, like "Advanced options." \ No newline at end of file +Since the certificate is self-signed, your browser may show a warning screen when you try to browse to https://localhost/. The exact screen varies based on the browser, but there is always a way to bypass this warning to continue to your local server. This may be hidden behind an extra link, like "Advanced options." diff --git a/uber/models/mivs.py b/uber/models/mivs.py index e41cf1874..03eac0096 100644 --- a/uber/models/mivs.py +++ b/uber/models/mivs.py @@ -278,8 +278,13 @@ class IndieGame(MagModel, ReviewMixin): title = Column(UnicodeText) brief_description = Column(UnicodeText) # 140 max genres = Column(MultiChoice(c.MIVS_INDIE_GENRE_OPTS)) + is_multiplayer = Column(Boolean, default=False) + player_count = Column(UnicodeText) platforms = Column(MultiChoice(c.MIVS_INDIE_PLATFORM_OPTS)) platforms_text = Column(UnicodeText) + content_warning = Column(Boolean, default=False) + warning_desc = Column(UnicodeText) + photosensitive_warning = Column(Boolean, default=False) description = Column(UnicodeText) # 500 max how_to_play = Column(UnicodeText) # 1000 max link_to_video = Column(UnicodeText) diff --git a/uber/templates/mivs/game.html b/uber/templates/mivs/game.html index 996582b84..e4733a815 100644 --- a/uber/templates/mivs/game.html +++ b/uber/templates/mivs/game.html @@ -44,6 +44,23 @@

{% if game.is_new %}Register a Game{% else %}Edit Game Information{% endif % +
+ +
+ {{ macros.toggle_checkbox( + '.player_count', + 'This is a multiplayer game.', + suffix='_player_count', + name='is_multiplayer', + required_selector='.player_count', + hide_on_checked=False, + checked=game.is_multiplayer) }} +
+
+ +
+
+
@@ -71,6 +88,31 @@

{% if game.is_new %}Register a Game{% else %}Edit Game Information{% endif %

{% endif %} +
+ +
+ {{ macros.toggle_checkbox( + '.warning_desc', + 'I would like to add a content or trigger warning for my game.', + suffix='_warning_desc', + name='content_warning', + required_selector='.warning_desc', + hide_on_checked=False, + checked=game.content_warning) }} +
+
+

Please enter the content/trigger warning below.

+ +
+
+ +
+ +
+ {{ macros.checkbox(game, 'photosensitive_warning', label_class="optional-field", label="My game may trigger photosensitivity issues.") }} +
+
+
diff --git a/uber/templates/mivs/index.html b/uber/templates/mivs/index.html index 32b91d536..d660f83ff 100644 --- a/uber/templates/mivs/index.html +++ b/uber/templates/mivs/index.html @@ -86,7 +86,7 @@

Games

{% set game_edit_link %}[Edit]{% endset %}

{{ game.title }} - {% if c.HAS_MIVS_ADMIN_ACCESS or not game.submitted %}{{ game_edit_link }}{% endif %} + {% if c.HAS_MIVS_ADMIN_ACCESS or c.MIVS_SUBMISSIONS_OPEN %}{{ game_edit_link }}{% endif %}

{% if game.status in c.FINAL_MIVS_GAME_STATUSES %} @@ -95,6 +95,7 @@

{% else %}You have already filled out this game's show information, but you can edit it{% endif %} here.{% endif %} {% else %} + {% if game.submitted %}{% endif %} {% set needs_screenshots = game.screenshots|length < 2 %} {% set can_delete_screenshots = not game.submitted or game.screenshots|length > 2%}
@@ -147,10 +148,10 @@

Game Submission

{% endfor %} {% else %} - You've met all the prerequisites to submit this game for consideration. After submitting you may no longer - edit the game details unless the judges kick the game back to you and requests edits. You will still be able - to manage your game's video, screenshots, and the game build information, such as build status and link, - after submitting. Our judges will not look at your game until you officially submit it by clicking this button: + You've met all the prerequisites to submit this game for consideration. This lets us know that your game + is ready for judging. You must submit your game by {{ c.MIVS_DEADLINE|datetime_local }}. + You may edit your game details after you submit it. +

{{ csrf_token() }}