some ui polish

This commit is contained in:
codl 2017-07-31 20:49:03 +02:00
parent 7301bc8a8b
commit fffb38bc9a
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
4 changed files with 19 additions and 4 deletions

View File

@ -53,6 +53,7 @@ class Account(db.Model, TimestampMixin, RemoteIDMixin):
self.last_fetch = db.func.now()
# backref: tokens
# backref: twitter_archives
def __repr__(self):
return f"<Account({self.id}, {self.remote_screen_name}, {self.remote_display_name})>"
@ -91,8 +92,8 @@ class TwitterArchive(db.Model, TimestampMixin):
id = db.Column(db.Integer, primary_key=True)
account_id = db.Column(db.String, db.ForeignKey('accounts.id'), nullable=False)
account = db.relationship(Account)
body = db.Column(db.LargeBinary, nullable=False)
account = db.relationship(Account, backref=db.backref('twitter_archives', order_by=lambda: db.desc(TwitterArchive.id)))
body = db.deferred(db.Column(db.LargeBinary, nullable=False))
chunks = db.Column(db.Integer)
chunks_successful = db.Column(db.Integer, server_default='0')
chunks_failed = db.Column(db.Integer, server_default='0')

View File

@ -1,3 +1,5 @@
<h1>Forget</h1>
{% if g.viewer %}
<p>Hello,
<img src="{{g.viewer.account.remote_avatar_url}}" style='height:1.5em; border-radius:100%; transform:translateY(25%);'/>
@ -6,7 +8,7 @@
<a href="{{url_for('logout')}}">Log out</a>
</p>
<p>your posts ({{g.viewer.account.post_count()}}):</p>
<h2>Recent posts ({{g.viewer.account.post_count()}} total posts):</h2>
{% for post in posts %}
<p>{{post.body}}</p>

View File

@ -2,6 +2,9 @@
<form method='post' enctype='multipart/form-data'>
<h2>Settings</h2>
{% if request.method == 'POST' %}
<h3>Settings saved successfully</h3>
{% endif %}
<p>Delete posts:
<label><input type=radio name=policy_enabled value=true {{ "checked" if g.viewer.account.policy_enabled }}> Enabled</label>
<label><input type=radio name=policy_enabled value=false {{ "checked" if not g.viewer.account.policy_enabled }}> Disabled</label>
@ -28,9 +31,18 @@
</form>
{% if g.viewer.account.service == 'twitter' %}
<form action='{{url_for('upload_tweet_archive')}}' method='post' enctype='multipart/form-data'>
<h2>Tweet archive import</h2>
Upload your tweet archive:
<input type="file" name='file'><input type="submit">
</form>
<h3>Recent tweet archive imports</h3>
{% for archive in g.viewer.account.twitter_archives %}
<p>{{archive.created_at}} {{archive.chunks_successful}}/{{archive.chunks}} months successfully imported, {{archive.chunks_failed}} failed</p>
{% else %}
<p>No recent archives found</p>
{% endfor %}
{% endif %}

View File

@ -1 +1 @@
<p>Your archive will be processed shortly. <a href="{{url_for('index')}}">Back</a></p>
<p>Your archive will be processed shortly. <a href="{{url_for('settings')}}">Back</a></p>