Allow editing users' email address via /u/

Also reloads the user info after a succesful edit.
This commit is contained in:
2017-06-29 10:55:50 +02:00
parent 08cb2b8438
commit e061d6c29d
5 changed files with 24 additions and 3 deletions

View File

@@ -51,7 +51,7 @@
li {{ error }}
| {% endfor %}
| {% endif %}
span.field-description {{ field.description }}
| {% endif %}
@@ -77,7 +77,11 @@ script(type="text/javascript").
//- console.log($(this).serialize());
$.post($(this).attr('action'), $(this).serialize())
.done(function(data){
$('#user-edit-notification').addClass('success').html('Success!');
// This function is defined in index.jade.
displayUser('{{ user._id }}')
.done(function() {
$('#user-edit-notification').addClass('success').html('Success!');
});
})
.fail(function(data){
$('#user-edit-notification').addClass('fail').html('Houston!');

View File

@@ -1,5 +1,12 @@
| {% extends 'layout.html' %}
| {% block page_title %}Users{% endblock %}
| {% block head %}
style.
span.field-description {
font-size: smaller;
color: #999;
}
| {% endblock %}
| {% block body %}
@@ -96,9 +103,10 @@ script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.select
script(type="text/javascript").
// This function is also used in edit_embed.jade.
function displayUser(userId) {
var url = '/u/' + userId + '/edit?embed=1';
$.get(url, function(dataHtml){
return $.get(url, function(dataHtml){
$('#search-hit-container')
.html(dataHtml)
.show();