Merge branch 'themes', with cyborg theme
This commit is contained in:
commit
a8e4c6877c
4 changed files with 32 additions and 9 deletions
24
Tweeder.py
24
Tweeder.py
|
@ -72,7 +72,8 @@ def profile(name=None):
|
|||
posts = list(timeline.user_posts_by_username(name))
|
||||
return render_template('profile.html',
|
||||
user=accounts.account_details(name),
|
||||
logged_in=logged_in, theme=accounts.get_theme(logged_in),
|
||||
logged_in=logged_in,
|
||||
theme=accounts.get_theme(logged_in),
|
||||
following=accounts.is_following(logged_in, name),
|
||||
posts=posts)
|
||||
|
||||
|
@ -97,13 +98,20 @@ def timeline_view():
|
|||
else:
|
||||
return redirect(url_for('login'))
|
||||
posts = timeline.timeline_for_user(session['username'])
|
||||
return render_template('timeline.html', logged_in=logged_in, posts=posts)
|
||||
return render_template('timeline.html',
|
||||
logged_in=logged_in,
|
||||
posts=posts,
|
||||
theme=accounts.get_theme(logged_in))
|
||||
|
||||
|
||||
@app.route('/global', methods=['GET'])
|
||||
def global_timeline():
|
||||
logged_in = True if 'username' in session.keys() else False
|
||||
return render_template('global.html', logged_in=logged_in, posts=timeline.global_timeline())
|
||||
if 'username' not in session.keys(): logged_in=False
|
||||
else: logged_in = accounts.get_display_name(session['username'])
|
||||
return render_template('global.html',
|
||||
logged_in=logged_in,
|
||||
posts=timeline.global_timeline(),
|
||||
theme=accounts.get_theme(logged_in))
|
||||
|
||||
|
||||
@app.route('/settings', methods=['GET', 'POST'])
|
||||
|
@ -126,10 +134,7 @@ def user_settings():
|
|||
'gender': request.form['gender'],
|
||||
'location': request.form['location']
|
||||
}
|
||||
if request.form['theme'] == "darkly":
|
||||
accounts.set_theme(session['username'].lower(), "darkly")
|
||||
elif request.form['theme'] == "default":
|
||||
accounts.set_theme(session['username'].lower(), "default")
|
||||
accounts.set_theme(session['username'].lower(), request.form['theme'])
|
||||
username = session['username']
|
||||
accounts.update_profile(username, profile)
|
||||
return redirect(request.referrer)
|
||||
|
@ -153,7 +158,8 @@ def reply_to_post(post_id):
|
|||
return render_template('reply.html',
|
||||
logged_in=logged_in,
|
||||
posts=timeline.get_full_replies(post_id)[:-1],
|
||||
reply_to=timeline.post_details(post_id))
|
||||
reply_to=timeline.post_details(post_id),
|
||||
theme=accounts.get_theme(logged_in))
|
||||
elif request.method == "POST":
|
||||
timeline.post_status(logged_in, request.form['status'], replyTo=post_id)
|
||||
return redirect(url_for('profile'))
|
||||
|
|
12
static/cyborg.css
Normal file
12
static/cyborg.css
Normal file
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,7 @@
|
|||
<script src="{{ url_for('static', filename = 'bootstrap4.min.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=="cyborg" %}<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'cyborg.css') }}" />{% endif %}
|
||||
<title>{{ title }} - Tweeder</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
<input type="radio" id="customRadioInline2" name="theme" value="darkly" class="custom-control-input" {% if theme=="darkly" %}checked{% endif %}>
|
||||
<label class="custom-control-label" for="customRadioInline2">Darkly</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
|
|
Loading…
Add table
Reference in a new issue