Skip to content

Commit 49a3465

Browse files
authored
Merge pull request #46 from ComputerScienceHouse/dev
Dev gamejam
2 parents 84c1f98 + b83a398 commit 49a3465

File tree

7 files changed

+526
-3
lines changed

7 files changed

+526
-3
lines changed

src/app.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def homepage():
1414

1515
@app.route('/catalog')
1616
def catalogpage():
17+
tag = flask.request.args.get("tag")
1718
games = requests.get(app.config["DEVCADE_API_URI"] + "games/").json()
19+
if tag:
20+
games = list(filter(lambda g: tag in map(lambda t: t['name'], g['tags']), games))
1821
return flask.render_template('catalog.html', gamelist=games)
1922

2023
@app.route('/user')
@@ -40,13 +43,14 @@ def uploadgame():
4043
icon = flask.request.files['icon']
4144
title = flask.request.form['title']
4245
description = flask.request.form['description']
46+
tags = flask.request.form['tags']
4347
author = current_user.id
4448
file = {
4549
'game': ("game.zip", game.stream, "application/zip"),
4650
'banner': ("banner", banner.stream, banner.mimetype),
4751
'icon': ("icon", icon.stream, icon.mimetype)
4852
}
49-
fields = {'title': title, 'description': description, 'author':author}
53+
fields = {'title': title, 'description': description, 'author': author, 'tags': tags}
5054
r = requests.post(app.config["DEVCADE_API_URI"] + "games/", files=file, data=fields, headers={"frontend_api_key":app.config["FRONTEND_API_KEY"]})
5155
if r.status_code == 201:
5256
return flask.redirect('/catalog')
@@ -58,12 +62,13 @@ def uploadpage():
5862
usergames = []
5963
try:
6064
games = requests.get(app.config["DEVCADE_API_URI"] + "games/").json()
65+
tags = requests.get(app.config["DEVCADE_API_URI"] + "tags/").json()
6166
for i in games:
6267
if i['author'] == current_user.id:
6368
usergames.append(i)
6469
except(Exception):
6570
print("api offline")
66-
return flask.render_template('upload.html', title='Devcade - Upload', gamelist=usergames)
71+
return flask.render_template('upload.html', title='Devcade - Upload', gamelist=usergames, tags=tags)
6772

6873
@app.route('/download/<id>')
6974
def download(id):

src/init.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
from flask_sqlalchemy import SQLAlchemy
66
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
77
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
8+
from urllib.parse import quote_plus
89

910

1011
app = flask.Flask(__name__)
12+
app.jinja_env.filters['quote_plus'] = lambda u: quote_plus(u)
1113
try:
1214
app.config.from_pyfile(os.path.join(os.getcwd(), "config.py"))
1315
except:

src/static/css/devcade.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,53 @@ a:hover {
479479
width: unset;
480480
}
481481
}
482+
483+
multi-checkbox {
484+
/* Element */
485+
--mc-border: 1px solid #000000;
486+
--mc-border-radius: 2px;
487+
--mc-display: inline-block;
488+
--mc-font: 400 0.9em Arial;
489+
--mc-vertical-align: middle;
490+
/* Dropdown */
491+
--mc-dropdown-background: #efefef;
492+
--mc-dropdown-box-shadow: 3px 3px 5px 1px rgba(0,0,0,0.35);
493+
--mc-dropdown-width: 209px;
494+
/* Input */
495+
--mc-target-background: #efefef;
496+
--mc-target-color: #000000;
497+
--mc-target-cursor: default;
498+
--mc-target-height: 28px;
499+
--mc-target-margin: 0;
500+
--mc-target-max-height: default;
501+
--mc-target-min-height: default;
502+
--mc-target-max-width: default;
503+
--mc-target-min-width: default;
504+
--mc-target-padding: 0px 0px 0px 3px;
505+
--mc-target-outline: none;
506+
--mc-target-width: 175px;
507+
/* Dropdown Line Items */
508+
--mc-dropdown-color: #000000;
509+
--mc-dropdown-line-height: 2em;
510+
--mc-ul-margin: 5px;
511+
--mc-ul-padding: 0;
512+
/* Toggle Button */
513+
--mc-toggle-button-background: #ffffff;
514+
--mc-toggle-button-color: #000000;
515+
--mc-toggle-button-cursor: pointer;
516+
--mc-toggle-button-height: 30px;
517+
--mc-toggle-button-outline: none;
518+
--mc-toggle-button-width: 30px;
519+
/* Close Button */
520+
--mc-close-button-background: #efefef;
521+
--mc-close-button-border: none;
522+
--mc-close-button-border-radius: default;
523+
--mc-close-button-color: #000000;
524+
--mc-close-button-cursor: pointer;
525+
--mc-close-button-display: block;
526+
--mc-close-button-height: 30px;
527+
--mc-close-button-margin: 5px auto;
528+
--mc-close-button-outline: none;
529+
--mc-close-button-width: 30px;
530+
--fg: #000000;
531+
}

0 commit comments

Comments
 (0)