Add the NSFW filter parameter within the user settings

This commit is contained in:
Rodolphe Breard 2018-11-08 21:09:17 +01:00
parent 428bd941e2
commit 1e894853c8
11 changed files with 181 additions and 105 deletions

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-08 15:03+0100\n"
"POT-Creation-Date: 2018-11-08 21:03+0100\n"
"PO-Revision-Date: 2018-02-04 01:03+0100\n"
"Last-Translator: Khaganat <assoc@khaganat.net>\n"
"Language-Team: Khaganat <assoc@khaganat.net>\n"
@ -12,23 +12,23 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forms.py:16 forms.py:41
#: forms.py:18 forms.py:54
msgid "current_password"
msgstr "Please provide your current password"
#: forms.py:17
#: forms.py:22
msgid "new_password"
msgstr "Please set a new password"
#: forms.py:18
#: forms.py:26
msgid "new_password_confirm"
msgstr "Please confirm the new password"
#: forms.py:31
#: forms.py:41
msgid "The new password does not match its confirmation."
msgstr ""
#: forms.py:37 forms.py:52
#: forms.py:48 forms.py:67
msgid "The current password is incorrect."
msgstr ""
@ -195,10 +195,35 @@ msgid "take_me_home"
msgstr "Take me home"
#: templates/neluser/settings/base.html:8
#: templates/neluser/settings/preferences/base.html:8
msgid "preferences"
msgstr ""
#: templates/neluser/settings/base.html:10
#: templates/neluser/settings/security/base.html:8
msgid "security"
msgstr ""
#: templates/neluser/settings/preferences/base.html:9
msgid "nsfw_filter"
msgstr "NSFW filter"
#: templates/neluser/settings/preferences/nsfw.html:5
msgid "NSFW content"
msgstr ""
#: templates/neluser/settings/preferences/nsfw.html:9
msgid "Safe mode is disabled, you may see not safe for work content."
msgstr ""
#: templates/neluser/settings/preferences/nsfw.html:11
msgid "Enable safe mode"
msgstr ""
#: templates/neluser/settings/preferences/nsfw.html:14
msgid "Safe mode enabled, not safe for work content is hidden."
msgstr ""
#: templates/neluser/settings/security/delete_account.html:5
msgid "delete_account"
msgstr "Delete account"
@ -211,6 +236,6 @@ msgstr ""
msgid "Password"
msgstr ""
#: views.py:70
#: views.py:80
msgid "Your account has been deleted."
msgstr ""

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-08 15:03+0100\n"
"POT-Creation-Date: 2018-11-08 21:03+0100\n"
"PO-Revision-Date: 2018-02-04 01:03+0100\n"
"Last-Translator: Khaganat <assoc@khaganat.net>\n"
"Language-Team: Khaganat <assoc@khaganat.net>\n"
@ -12,23 +12,23 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: forms.py:16 forms.py:41
#: forms.py:18 forms.py:54
msgid "current_password"
msgstr "Veuillez indiquer votre mot de passe actuel"
#: forms.py:17
#: forms.py:22
msgid "new_password"
msgstr "Veuillez indiquer un nouveau mot de passe"
#: forms.py:18
#: forms.py:26
msgid "new_password_confirm"
msgstr "Veuillez confirmer le nouveau mot de passe"
#: forms.py:31
#: forms.py:41
msgid "The new password does not match its confirmation."
msgstr "Le nouveau mot de passe ne correspond pas avec sa confirmation."
#: forms.py:37 forms.py:52
#: forms.py:48 forms.py:67
msgid "The current password is incorrect."
msgstr "Le mot de passe actuel est incorrect."
@ -200,10 +200,36 @@ msgid "take_me_home"
msgstr "Retour à l'accueil"
#: templates/neluser/settings/base.html:8
#: templates/neluser/settings/preferences/base.html:8
msgid "preferences"
msgstr "préférences"
#: templates/neluser/settings/base.html:10
#: templates/neluser/settings/security/base.html:8
msgid "security"
msgstr "sécurité"
#: templates/neluser/settings/preferences/base.html:9
msgid "nsfw_filter"
msgstr "Navigation filtrée"
#: templates/neluser/settings/preferences/nsfw.html:5
msgid "NSFW content"
msgstr "Contenu sensible"
#: templates/neluser/settings/preferences/nsfw.html:9
msgid "Safe mode is disabled, you may see not safe for work content."
msgstr ""
"La navigation filtrée est désactivée, vous pouvez voir le contenu sensible."
#: templates/neluser/settings/preferences/nsfw.html:11
msgid "Enable safe mode"
msgstr "Activer la navigation filtrée"
#: templates/neluser/settings/preferences/nsfw.html:14
msgid "Safe mode enabled, not safe for work content is hidden."
msgstr "La navigation filtrée est activée, le contenu sensible est masqué."
#: templates/neluser/settings/security/delete_account.html:5
msgid "delete_account"
msgstr "Suppression du compte"
@ -216,43 +242,6 @@ msgstr "Définitivement supprimer mon compte"
msgid "Password"
msgstr "Mot de passe"
#: views.py:70
#: views.py:80
msgid "Your account has been deleted."
msgstr "Votre compte a été supprimé."
#~ msgid "NSFW content"
#~ msgstr "Contenu sensible"
#~ msgid ""
#~ "The content you were about to see is flagged as sensitive and therefore "
#~ "cannot be seen while the safe mode is activated."
#~ msgstr ""
#~ "Le contenu que vous vous apprêtiez à consulter est indiqué comme pouvant "
#~ "choquer la sensibilité et ne peut donc pas être affiché tant que la "
#~ "navigation filtrée est activée."
#~ msgid "Permanently disable safe mode"
#~ msgstr "Définitivement désactiver la navigation filtrée"
#~ msgid "Or disable safe mode for:"
#~ msgstr "Ou désactiver la navigation filtrée pour :"
#~ msgid "5 minutes"
#~ msgstr "5 minutes"
#~ msgid "1 hour"
#~ msgstr "1 heure"
#~ msgid "1 day"
#~ msgstr "1 jour"
#~ msgid ""
#~ "This page contains sensitive content which is displayed because you "
#~ "disabled the safe mode."
#~ msgstr ""
#~ "Cette page contient du contenu indiqué comme pouvant heurter la "
#~ "sensibilité. Ce contenu est affiché car vous avez désactivé la navigation "
#~ "filtrée."
#~ msgid "Enable safe mode"
#~ msgstr "Activer la navigation filtrée"

View file

@ -5,6 +5,8 @@
{% block content %}
<div class="tabs">
<ul>
<!-- {% trans "preferences" %} -->
{% include "neluser/settings/tab.html" with tabname="preferences" lnk="set_nsfw" %}
<!-- {% trans "security" %} -->
{% include "neluser/settings/tab.html" with tabname="security" lnk="password_change" %}
</ul>

View file

@ -0,0 +1,17 @@
{% extends "neluser/settings/base.html" %}
{% load i18n %}
{% block panel %}
<div class="columns">
<div class="column is-one-quarter">
<nav class="panel">
<p class="panel-heading">{% trans "preferences"|capfirst %}</p>
<!-- {% trans "nsfw_filter" %} -->
{% include "neluser/settings/block.html" with blockname="nsfw_filter" lnk="nsfw" %}
</nav>
</div>
<div class="column">
{% block inner_panel %}{% endblock %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,17 @@
{% extends "neluser/settings/preferences/base.html" %}
{% load bulma_tags %}
{% load i18n %}
{% block title %}{% trans "NSFW content" %}{% endblock %}
{% block inner_panel %}
{% if nsfw_allowed %}
<p>{% trans "Safe mode is disabled, you may see not safe for work content." %}</p>
<p>
<a href="{% url 'disable_nsfw' %}?next={{ current_url }}">{% trans "Enable safe mode" %}</a>.
</p>
{% else %}
<p>{% trans "Safe mode enabled, not safe for work content is hidden." %}</p>
{% include "nsfw/duration.html" with not_current="true" next_url=current_url %}
{% endif %}
{% endblock %}

View file

@ -58,6 +58,9 @@ urlpatterns = [
# --------
path('settings/', views.settings_default, name='settings'),
# Preferences
path('settings/preferences/nsfw/', views.set_nsfw, name='set_nsfw'),
# Security
path(
'settings/security/password/',

View file

@ -20,10 +20,21 @@ from .models import NelUser
@login_required
def settings_default(request):
next_page = reverse_lazy('password_change')
next_page = reverse_lazy('set_nsfw')
return redirect(next_page)
@login_required
def set_nsfw(request):
ctx = {
'nsfw_allowed': request.user.nsfw_allowed,
'current_url': reverse_lazy('set_nsfw'),
'tab': 'preferences',
'active_block': 'nsfw_filter'
}
return render(request, 'neluser/settings/preferences/nsfw.html', ctx)
class ChangePasswordView(LoginRequiredMixin, FormView):
template_name = 'neluser/settings/security/password.html'
form_class = ChangePasswordForm

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-03 23:12+0200\n"
"POT-Creation-Date: 2018-11-08 21:03+0100\n"
"PO-Revision-Date: 2018-06-03 23:12+0200\n"
"Last-Translator: Khaganat <assoc@khaganat.net>\n"
"Language-Team: Khaganat <assoc@khaganat.net>\n"
@ -12,38 +12,22 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: templates/nsfw/alert.html:3 templates/nsfw/redirect_page.html:4
#: templates/nsfw/alert.html:4 templates/nsfw/redirect_page.html:4
msgid "NSFW content"
msgstr ""
#: templates/nsfw/alert.html:6
#: templates/nsfw/alert.html:7
msgid ""
"The content you were about to see is flagged as sensitive and therefore "
"cannot be seen while the safe mode is activated."
msgstr ""
#: templates/nsfw/alert.html:9
msgid "Go back home"
msgstr ""
#: templates/nsfw/alert.html:10
msgid "Permanently disable safe mode"
#: templates/nsfw/alert.html:11
msgid "Go back"
msgstr ""
#: templates/nsfw/alert.html:13
msgid "Or disable safe mode for:"
msgstr ""
#: templates/nsfw/alert.html:14
msgid "5 minutes"
msgstr ""
#: templates/nsfw/alert.html:15
msgid "1 hour"
msgstr ""
#: templates/nsfw/alert.html:16
msgid "1 day"
msgid "Go back home"
msgstr ""
#: templates/nsfw/disabled_alert.html:2
@ -55,3 +39,23 @@ msgstr ""
#: templates/nsfw/disabled_alert.html:3
msgid "Enable safe mode"
msgstr ""
#: templates/nsfw/duration.html:3
msgid "Disable safe mode until further notice"
msgstr ""
#: templates/nsfw/duration.html:6
msgid "Or disable safe mode for:"
msgstr ""
#: templates/nsfw/duration.html:7
msgid "5 minutes"
msgstr ""
#: templates/nsfw/duration.html:8
msgid "1 hour"
msgstr ""
#: templates/nsfw/duration.html:9
msgid "1 day"
msgstr ""

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-03 23:12+0200\n"
"POT-Creation-Date: 2018-11-08 21:03+0100\n"
"PO-Revision-Date: 2018-06-03 23:12+0200\n"
"Last-Translator: Khaganat <assoc@khaganat.net>\n"
"Language-Team: Khaganat <assoc@khaganat.net>\n"
@ -12,11 +12,11 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: templates/nsfw/alert.html:3 templates/nsfw/redirect_page.html:4
#: templates/nsfw/alert.html:4 templates/nsfw/redirect_page.html:4
msgid "NSFW content"
msgstr "Contenu sensible"
#: templates/nsfw/alert.html:6
#: templates/nsfw/alert.html:7
msgid ""
"The content you were about to see is flagged as sensitive and therefore "
"cannot be seen while the safe mode is activated."
@ -25,29 +25,13 @@ msgstr ""
"choquer la sensibilité et ne peut donc pas être affiché tant que la "
"navigation filtrée est activée."
#: templates/nsfw/alert.html:9
msgid "Go back home"
msgstr "Retourner à l'accueil"
#: templates/nsfw/alert.html:10
msgid "Permanently disable safe mode"
msgstr "Définitivement désactiver la navigation filtrée"
#: templates/nsfw/alert.html:11
msgid "Go back"
msgstr "Retour"
#: templates/nsfw/alert.html:13
msgid "Or disable safe mode for:"
msgstr "Ou désactiver la navigation filtrée pour :"
#: templates/nsfw/alert.html:14
msgid "5 minutes"
msgstr "5 minutes"
#: templates/nsfw/alert.html:15
msgid "1 hour"
msgstr "1 heure"
#: templates/nsfw/alert.html:16
msgid "1 day"
msgstr "1 jour"
msgid "Go back home"
msgstr "Retourner à l'accueil"
#: templates/nsfw/disabled_alert.html:2
msgid ""
@ -60,3 +44,23 @@ msgstr ""
#: templates/nsfw/disabled_alert.html:3
msgid "Enable safe mode"
msgstr "Activer la navigation filtrée"
#: templates/nsfw/duration.html:3
msgid "Disable safe mode until further notice"
msgstr "Désactiver la navigation filtrée jusqu'à nouvel ordre"
#: templates/nsfw/duration.html:6
msgid "Or disable safe mode for:"
msgstr "Ou désactiver la navigation filtrée pour :"
#: templates/nsfw/duration.html:7
msgid "5 minutes"
msgstr "5 minutes"
#: templates/nsfw/duration.html:8
msgid "1 hour"
msgstr "1 heure"
#: templates/nsfw/duration.html:9
msgid "1 day"
msgstr "1 jour"

View file

@ -12,14 +12,8 @@
{% elif go_home %}
<a class="button is-link" href="{% url "index" %}" role="button">{% trans "Go back home" %}</a>
{% endif %}
<a class="button is-danger" href="{% url "enable_nsfw" "0" %}?next={{ next_url }}" role="button">{% trans "Permanently disable safe mode" %}</a>
</p>
<p>
{% trans "Or disable safe mode for:" %}<br>
<a class="button is-warning" href="{% url "enable_nsfw" "300" %}?next={{ next_url }}">{% trans "5 minutes" %}</a>
<a class="button is-warning" href="{% url "enable_nsfw" "3600" %}?next={{ next_url }}">{% trans "1 hour" %}</a>
<a class="button is-warning" href="{% url "enable_nsfw" "86400" %}?next={{ next_url }}">{% trans "1 day" %}</a>
</p>
{% include "nsfw/duration.html" %}
</div>
</div>
</article>

View file

@ -0,0 +1,10 @@
{% load i18n %}
<p>
<a class="button is-danger" href="{% url "enable_nsfw" "0" %}?next={{ next_url }}" role="button">{% trans "Disable safe mode until further notice" %}</a>
</p>
<p>
{% trans "Or disable safe mode for:" %}<br>
<a class="button is-warning" href="{% url "enable_nsfw" "300" %}?next={{ next_url }}">{% trans "5 minutes" %}</a>
<a class="button is-warning" href="{% url "enable_nsfw" "3600" %}?next={{ next_url }}">{% trans "1 hour" %}</a>
<a class="button is-warning" href="{% url "enable_nsfw" "86400" %}?next={{ next_url }}">{% trans "1 day" %}</a>
</p>