nicer, more compact mastodon login buttons

This commit is contained in:
codl 2017-08-23 23:32:21 +02:00
parent fac2a0e9b3
commit 5b047e4b94
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
3 changed files with 18 additions and 15 deletions

View File

@ -229,5 +229,6 @@ a.btn:hover {
} }
.btn-content { .btn-content {
margin: 0 .5em 0 .1em; margin: 0 .5em;
line-height: 2em;
} }

View File

@ -60,7 +60,7 @@ def index():
settings_error = 'settings_error' in request.args settings_error = 'settings_error' in request.args
) )
else: else:
instances = MastodonInstance.query.filter(MastodonInstance.popularity > 1).order_by(db.desc(MastodonInstance.popularity)).limit(3) instances = MastodonInstance.query.filter(MastodonInstance.popularity > 5).order_by(db.desc(MastodonInstance.popularity)).limit(5)
return render_template('index.html', return render_template('index.html',
mastodon_instances = instances, mastodon_instances = instances,
twitter_login_error = 'twitter_login_error' in request.args) twitter_login_error = 'twitter_login_error' in request.args)
@ -219,7 +219,7 @@ def api_viewer_timers():
@app.route('/login/mastodon', methods=('GET', 'POST')) @app.route('/login/mastodon', methods=('GET', 'POST'))
def mastodon_login_step1(instance=None): def mastodon_login_step1(instance=None):
instances = MastodonInstance.query.filter(MastodonInstance.popularity > 1).order_by(db.desc(MastodonInstance.popularity)).limit(16) instances = MastodonInstance.query.filter(MastodonInstance.popularity > 5).order_by(db.desc(MastodonInstance.popularity)).limit(16)
instance_url = request.args.get('instance_url', None) or request.form.get('instance_url', None) instance_url = request.args.get('instance_url', None) or request.form.get('instance_url', None)

View File

@ -30,28 +30,30 @@
<p> <p>
<a style='background-color:#1da1f2' class='btn' href="/login/twitter"> <a style='background-color:#1da1f2' class='btn' href="/login/twitter">
<span class='btn-header'> <span class='btn-header'>
<img src='{{ st('twitter.png') }}'></span> <img src='{{ st('twitter.png') }}'>
<span class='btn-content'>Log in with Twitter</span> </span><span class='btn-content'>Log in with Twitter</span>
</a> </a>
</p> </p>
{% for instance in mastodon_instances %}
<p> <p>
{% for instance in mastodon_instances %}
<a style='background-color:#282c37' class='btn' href="{{ url_for('mastodon_login_step1', instance_url=instance.instance) }}"> <a style='background-color:#282c37' class='btn' href="{{ url_for('mastodon_login_step1', instance_url=instance.instance) }}">
{% if loop.first %}
<span class='btn-header'> <span class='btn-header'>
<img src='{{ st('mastodon.png') }}'></span> <img src='{{ st('mastodon.png') }}'>
<span class='btn-content'>Log in with {{instance.instance}}</span> </span><span class='btn-content'>Log in with
{% else %}
<span class='btn-content'>
{% endif %}
{{instance.instance}}</span>
</a> </a>
</p>
{% endfor %} {% endfor %}
<p> <a style='background-color:#ddd; color:inherit;' class='btn' href="{{ url_for('mastodon_login_step1') }}">
<a style='background-color:#282c37' class='btn' href="{{ url_for('mastodon_login_step1') }}"> <span class='btn-content'>Another Mastodon instance</span>
<span class='btn-header'>
<img src='{{ st('mastodon.png') }}'></span>
<span class='btn-content'>Log in with another Mastodon instance</span>
</a> </a>
</p> </p>
</section> </section>