Merge branch 'themes'

This commit is contained in:
SecretlyTaco 2018-02-25 16:10:32 +00:00
commit 02a01bdacf
4 changed files with 26 additions and 5 deletions

View file

@ -5,16 +5,20 @@ client = MongoClient()
accounts_db = client.tweeder.accounts accounts_db = client.tweeder.accounts
def get_theme(username):
username = username.lower()
return accounts_db.find_one({"username": username})['theme']
def set_theme(username, value): def set_theme(username, value):
username = username.lower() username = username.lower()
accounts_db.update_one({'username': username}, {"$set": {"theme": value}}) accounts_db.update_one({'username': username}, {"$set": {"theme": value}})
def get_theme(username):
username = username.lower()
if "themes" in accounts_db.find_one({"username": username}).keys():
return accounts_db.find_one({"username": username})['theme']
else:
set_theme(username, "default")
return "default"
def get_display_name(username): def get_display_name(username):
return accounts_db.find_one({'username': username})['displayname'] return accounts_db.find_one({'username': username})['displayname']

12
static/materia.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -8,6 +8,7 @@
<script src="{{ url_for('static', filename ='fontawesome-all.js') }}"></script> <script src="{{ url_for('static', filename ='fontawesome-all.js') }}"></script>
{% if theme=="darkly" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'darkly.css') }}" />{% endif %} {% if theme=="darkly" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'darkly.css') }}" />{% endif %}
{% if theme=="cyborg" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'cyborg.css') }}" />{% endif %} {% if theme=="cyborg" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'cyborg.css') }}" />{% endif %}
{% if theme=="materia" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'materia.css') }}" />{% endif %}
<title>{{ title }} - Tweeder</title> <title>{{ title }} - Tweeder</title>
</head> </head>
<body> <body>

View file

@ -43,6 +43,10 @@
<input type="radio" id="customRadioInline3" name="theme" value="cyborg" class="custom-control-input" {% if theme=="cyborg" %}checked{% endif %}> <input type="radio" id="customRadioInline3" name="theme" value="cyborg" class="custom-control-input" {% if theme=="cyborg" %}checked{% endif %}>
<label class="custom-control-label" for="customRadioInline3">Cyborg</label> <label class="custom-control-label" for="customRadioInline3">Cyborg</label>
</div> </div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="customRadioInline4" name="theme" value="materia" class="custom-control-input" {% if theme=="materia" %}checked{% endif %}>
<label class="custom-control-label" for="customRadioInline4">Materia</label>
</div>
</div> </div>
<button type="submit" class="btn btn-primary">Save</button> <button type="submit" class="btn btn-primary">Save</button>