Fixed language and locale preset for new users

pull/102/head
OzzieIsaacs 8 years ago
parent 93b020b77c
commit a2a48515d4

@ -27,14 +27,14 @@
<label for="locale">{{_('Language')}}</label> <label for="locale">{{_('Language')}}</label>
<select name="locale" id="locale" class="form-control"> <select name="locale" id="locale" class="form-control">
{% for translation in translations %} {% for translation in translations %}
<option value="{{translation}}" {% if translation|string == content.locale %}selected{% endif %}>{{ translation.display_name }}</option> <option value="{{translation.language}}" {% if translation.language == content.locale %}selected{% endif %} {% if new_user == 1 and loop.first %}selected{% endif %}>{{ translation.display_name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="default_language">{{_('Show books with language')}}</label> <label for="default_language">{{_('Show books with language')}}</label>
<select name="default_language" id="default_language" class="form-control"> <select name="default_language" id="default_language" class="form-control">
<option value="all" >{{ _('Show all') }}</option> <option value="all" {% if new_user == 1 %}selected{% endif %}>{{ _('Show all') }}</option>
{% for language in languages %} {% for language in languages %}
<option value="{{ language.lang_code }}" {% if content.default_language == language.lang_code %}selected{% endif %}>{{ language.name }}</option> <option value="{{ language.lang_code }}" {% if content.default_language == language.lang_code %}selected{% endif %}>{{ language.name }}</option>
{% endfor %} {% endfor %}

@ -1513,7 +1513,7 @@ def new_user():
content.nickname = to_save["nickname"] content.nickname = to_save["nickname"]
content.email = to_save["email"] content.email = to_save["email"]
content.default_language = to_save["default_language"] content.default_language = to_save["default_language"]
content.locale = to_save["locale"] content.locale = to_save["locale"]
content.random_books = 0 content.random_books = 0
content.language_books = 0 content.language_books = 0
content.series_books = 0 content.series_books = 0
@ -1547,7 +1547,7 @@ def new_user():
ub.session.rollback() ub.session.rollback()
flash(_(u"Found an existing account for this email address or nickname."), category="error") flash(_(u"Found an existing account for this email address or nickname."), category="error")
return render_template("user_edit.html", new_user=1, content=content, translations=translations, return render_template("user_edit.html", new_user=1, content=content, translations=translations,
languages=languages, title="Add new user") languages=languages, title=_("Add new user"))
@app.route("/admin/mailsettings", methods=["GET", "POST"]) @app.route("/admin/mailsettings", methods=["GET", "POST"])

Loading…
Cancel
Save