From 47ac009622537789c2953ef1214f5ac9cfbef822 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Avil=C3=A9s?= Date: Wed, 8 Jul 2015 23:48:41 +0200 Subject: [PATCH] Make protection messages more user friendly --- indico/modules/attachments/forms.py | 11 ++----- .../attachments/templates/_protection_message.html | 35 ++++++++++++---------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/indico/modules/attachments/forms.py b/indico/modules/attachments/forms.py index a0249d396..ddb854b97 100644 --- a/indico/modules/attachments/forms.py +++ b/indico/modules/attachments/forms.py @@ -34,11 +34,7 @@ from indico.web.forms.widgets import SwitchWidget class AttachmentFormBase(IndicoForm): - protected = BooleanField(_("Protected"), widget=SwitchWidget(), - description=_("By default, the materials will inherit the protection of the parent. " - "Checking this field will restrict all access. The protection can be " - "modified later on from the material settings.")) - + protected = BooleanField(_("Protected"), widget=SwitchWidget()) folder = QuerySelectField(_("Folder"), allow_blank=True, blank_text=_("No folder selected"), get_label='title', description=_("Adding materials to folders allow grouping and easier permission " "management.")) @@ -87,10 +83,7 @@ class EditAttachmentLinkForm(AttachmentLinkFormMixin, EditAttachmentFormBase): class AttachmentFolderForm(IndicoForm): title = StringField(_("Name"), [DataRequired()], description=_("The name of the folder.")) description = TextAreaField(_("Description"), description=_("Description of the folder and its content")) - protected = BooleanField(_("Protected"), widget=SwitchWidget(), - description=_("By default, the folder will inherit the protection of the event. " - "Checking this field will restrict all access. The protection can be " - "modified later on from the folder settings.")) + protected = BooleanField(_("Protected"), widget=SwitchWidget()) acl = PrincipalListField(_("Grant Access To"), [UsedIf(lambda form, field: form.protected.data)], groups=True, serializable=False, allow_external=True, description=_("The list of users and groups with access to the folder")) diff --git a/indico/modules/attachments/templates/_protection_message.html b/indico/modules/attachments/templates/_protection_message.html index 38ed701e3..66d73f08a 100644 --- a/indico/modules/attachments/templates/_protection_message.html +++ b/indico/modules/attachments/templates/_protection_message.html @@ -1,57 +1,60 @@
-
-
+
+
-
+
- {% trans %}Custom protection: Protected{% endtrans %} + {% trans %}Protected{% endtrans %}
- {% trans %}The access to this object is restricted, regardless of the protection scheme of the - parent.{% endtrans %} + {% trans -%} + This object is not publicly accessible since it is set as protected. + {%- endtrans %}
+
-
+
{% if parent.is_protected %}
- {% trans %}Inherited protection: Protected{% endtrans %} + {% trans %}Protected{% endtrans %}
{% trans parent_type=parent.type, parent_title = parent.title -%} - The access to this object is restricted, inheriting the protection scheme from - {{ parent_title }} ({{ parent_type }}) + This object is not publicly accessible since {{ parent_title }} ({{ parent_type }}) is protected. {%- endtrans %}
{% else %}
- {% trans %}Inherited protection: Public{% endtrans %} + {% trans %}Public{% endtrans %}
- {% trans %}The access to this material is public.{% endtrans %} + {% trans parent_type=parent.type, parent_title=parent.title -%} + This object is publicly accessible since {{ parent_title }} ({{ parent_type }}) is not protected. + {%- endtrans %}
{% endif %}
+
-
+
- {% trans %}Inherited protection: Protected{% endtrans %} + {% trans %}Protected{% endtrans %}
{% trans -%} - The access to this object is restricted, inheriting the protection scheme from - (Folder) + This object is not publicly accessible since (Folder) is protected. {%- endtrans %}
-- 2.11.4.GIT