From efff63c5c04d52abdae7ab1b2fbea8f8e89041dc Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 04:31:42 +0800 Subject: [PATCH 1/7] A more structured look for profile --- nyaa/templates/profile.html | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/nyaa/templates/profile.html b/nyaa/templates/profile.html index f07d0a5..cbabd75 100644 --- a/nyaa/templates/profile.html +++ b/nyaa/templates/profile.html @@ -3,7 +3,20 @@ {% block body %} {% from "_formhelpers.html" import render_field %} -

Edit Profile

+

Profile of {{ name }}

+ +
+ +
+
+
User ID:
{{ g.user.id }}
+
User Class:
{{ level }}
+
User Created on:
{{ g.user.created_time }}
+
+
+
+
@@ -70,16 +81,6 @@
-
-
-
User ID:
-
{{g.user.id}}
-
Account created on:
-
{{g.user.created_time}}
-
User class:
-
{{level}}

-
-
{% endblock %} From 9a4583b87dde75fe305645f040cfbc6f6af73f96 Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 04:33:40 +0800 Subject: [PATCH 2/7] Update profile.html --- nyaa/templates/profile.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nyaa/templates/profile.html b/nyaa/templates/profile.html index cbabd75..cb7b769 100644 --- a/nyaa/templates/profile.html +++ b/nyaa/templates/profile.html @@ -46,13 +46,13 @@ {{ render_field(form.password_confirm, class_='form-control', placeholder='New password (confirm)') }} -
+
@@ -73,7 +73,6 @@ {{ render_field(form.current_password, class_='form-control', placeholder='Current password') }}
-
@@ -83,4 +82,6 @@
+
+ {% endblock %} From a1e90c96d90b201f898c2b8b815a2de69efc65b1 Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 04:33:53 +0800 Subject: [PATCH 3/7] Update profile.html --- nyaa/templates/profile.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nyaa/templates/profile.html b/nyaa/templates/profile.html index cb7b769..b6ba7fe 100644 --- a/nyaa/templates/profile.html +++ b/nyaa/templates/profile.html @@ -7,7 +7,7 @@
From 2ef053dec8bd0cbdd67103067e18fa13ef223016 Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 04:37:22 +0800 Subject: [PATCH 4/7] Update routes.py --- nyaa/routes.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nyaa/routes.py b/nyaa/routes.py index 274e4df..558873d 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -459,7 +459,7 @@ def profile(): return flask.redirect('/profile') user.email = form.email.data flask.flash(flask.Markup( - 'Email successfully changed!'), 'info') + 'Email successfully changed!'), 'success') if new_password: if form.current_password.data != user.password_hash: flask.flash(flask.Markup( @@ -467,7 +467,7 @@ def profile(): return flask.redirect('/profile') user.password_hash = form.new_password.data flask.flash(flask.Markup( - 'Password successfully changed!'), 'info') + 'Password successfully changed!'), 'success') db.session.add(user) db.session.commit() @@ -475,9 +475,11 @@ def profile(): flask.g.user = user return flask.redirect('/profile') - current_email = models.User.by_id(flask.g.user.id).email - - return flask.render_template('profile.html', form=form, email=current_email, level=level) + _user = models.User.by_id(flask.g.user.id) + username = _user.username + current_email = _user.email + + return flask.render_template('profile.html', form=form, name=username, email=current_email, level=level) @app.route('/user/activate/') From 0677b121d66196920174268f9af6aa5f7c147d33 Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 04:45:37 +0800 Subject: [PATCH 5/7] Update profile.html --- nyaa/templates/profile.html | 1 - 1 file changed, 1 deletion(-) diff --git a/nyaa/templates/profile.html b/nyaa/templates/profile.html index b6ba7fe..0fd3c49 100644 --- a/nyaa/templates/profile.html +++ b/nyaa/templates/profile.html @@ -52,7 +52,6 @@
-
From 4bc3abe317c39878bfcf07ad7882fcd7cfa9c197 Mon Sep 17 00:00:00 2001 From: UnKnoWn Date: Thu, 18 May 2017 23:15:17 +0800 Subject: [PATCH 6/7] Left aligning the user info --- nyaa/templates/profile.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nyaa/templates/profile.html b/nyaa/templates/profile.html index 0fd3c49..138ed29 100644 --- a/nyaa/templates/profile.html +++ b/nyaa/templates/profile.html @@ -6,16 +6,16 @@

Profile of {{ name }}

- -
-
-
User ID:
{{ g.user.id }}
-
User Class:
{{ level }}
-
User Created on:
{{ g.user.created_time }}
-
-
+ +
+
+
User ID:
{{ g.user.id }}
+
User Class:
{{ level }}
+
User Created on:
{{ g.user.created_time }}
+
+