Skip to content

Commit

Permalink
Merge pull request #1569 from digitalfabrik/develop
Browse files Browse the repository at this point in the history
Release `2022.6.3`
  • Loading branch information
timobrembeck authored Jun 20, 2022
2 parents 63e1131 + 596efbd commit 956b216
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 150 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
UNRELEASED
----------

* [ [#1561](https://github.com/digitalfabrik/integreat-cms/issues/1561) ] Rename location contact labels
* [ [#1567](https://github.com/digitalfabrik/integreat-cms/issues/1567) ] Hide organization field in user form
* [ [#1563](https://github.com/digitalfabrik/integreat-cms/issues/1563) ] Fix permission checks in side-by-side view


2022.6.2
--------

* [ [#1445](https://github.com/digitalfabrik/integreat-cms/issues/1445) ] Allow only users with publish permission to unpublish page
* [ [#1497](https://github.com/digitalfabrik/integreat-cms/issues/1516) ] Set older versions to draft when saved as draft
* [ [#1497](https://github.com/digitalfabrik/integreat-cms/issues/1497) ] Set older versions to draft when saved as draft
* [ [#1550](https://github.com/digitalfabrik/integreat-cms/issues/1550) ] Fix status change when restoring revisions
* [ [#1509](https://github.com/digitalfabrik/integreat-cms/issues/1509) ] Support legacy sitemap URL patterns
* [ [#742](https://github.com/digitalfabrik/integreat-cms/issues/742) ] Make bounding box configurable per region
Expand Down
8 changes: 5 additions & 3 deletions integreat_cms/cms/templates/imprint/imprint_revisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="mb-6">
<h1 class="heading">{% trans 'Imprint versions' %}</h1>
<a href="{% url 'edit_imprint' region_slug=request.region.slug language_slug=language.slug %}" class="btn btn-gray">
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Go back to imprint editor' %}
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Back to the imprint form' %}
</a>
</div>

Expand Down Expand Up @@ -74,9 +74,11 @@ <h1>{{ imprint_translation.title }}</h1>
<label>{% trans 'Content' %}</label>
</div>
</div>
<div class="w-full p-4 flex justify-end gap-4">
{% if perms.cms.change_imprintpage %}
<div class="w-full p-4 flex justify-end gap-4">
<button name="submit_draft" class="btn btn-gray">{% trans 'Restore this version as draft' %}</button>
<button name="submit_public" class="btn">{% trans 'Restore and publish this version' %}</button>
</div>
</div>
{% endif %}
</form>
{% endblock %}
30 changes: 14 additions & 16 deletions integreat_cms/cms/templates/imprint/imprint_sbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@
{% block content %}
<form method="post" id="content_form" data-unsaved-warning>
<div>
<div class="flex flex-wrap mb-4">
<div class="w-3/5 flex flex-wrap flex-col justify-center mb-6">
<h1 class="heading">
{% with source_language=source_imprint_translation.language.translated_name target_language_name=target_language.translated_name %}
{% blocktrans %}Translate the imprint from {{ source_language }} to {{ target_language_name }}{% endblocktrans %}
{% endwith %}
</h1>
</div>
<div class="w-2/5 flex justify-end mb-6 gap-2">
<a href="{% url 'edit_imprint' region_slug=request.region.slug language_slug=target_language.slug %}"
class="bg-gray-400 hover:bg-gray-500 cursor-pointer text-white font-bold py-3 px-4 rounded">
{% trans 'Go back to imprint editor' %}
</a>
{% if perms.cms.change_imprintpage %}
<h1 class="heading">
{% with source_language=source_imprint_translation.language.translated_name target_language_name=target_language.translated_name %}
{% blocktrans %}Translate the imprint from {{ source_language }} to {{ target_language_name }}{% endblocktrans %}
{% endwith %}
</h1>
<div class="flex flex-wrap grow justify-between gap-2 mb-4">
<a href="{% url 'edit_imprint' region_slug=request.region.slug language_slug=target_language.slug %}"
class="bg-gray-400 hover:bg-gray-500 text-center cursor-pointer text-white font-bold py-3 px-4 rounded">
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Back to the imprint form' %}
</a>
{% if perms.cms.change_imprintpage %}
<div class="flex flex-wrap gap-2">
<button name="submit_draft" class="btn btn-gray">{% trans 'Save as draft' %}</button>
<button name="submit_public" class="btn">
{% if imprint_translation_form.instance.status == PUBLIC %}
Expand All @@ -29,8 +27,8 @@ <h1 class="heading">
{% trans 'Publish' %}
{% endif %}
</button>
{% endif %}
</div>
</div>
{% endif %}
</div>
<div class="grid grid-cols-2 gap-4">
<div class="border border-blue-500 rounded shadow-2xl bg-white">
Expand Down
8 changes: 4 additions & 4 deletions integreat_cms/cms/templates/pages/page_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
id="content_form"
data-unsaved-warning>
{% csrf_token %}
<div class="w-full flex flex-wrap justify-between mb-6">
<h1 class="heading overflow-hidden text-ellipsis">
<div class="w-full flex flex-wrap justify-between mb-6 gap-2">
<h1 class="heading">
{% if page %}
{% if page_translation_form.instance.id %}
{% with page_translation_form.instance.title as page_title %}
Expand All @@ -46,7 +46,7 @@ <h1 class="heading overflow-hidden text-ellipsis">
{% endif %}
</h1>
{% if not page_form.instance.id or not page_form.instance.archived %}
<div class="flex flex-wrap gap-4 ml-auto mr-0">
<div class="flex flex-wrap grow justify-end gap-2">
<button
name="preview_page"
type="button"
Expand All @@ -66,7 +66,7 @@ <h1 class="heading overflow-hidden text-ellipsis">
{% trans 'Publish' %}
{% endif %}
</button>
{% else %}
{% elif can_edit_page %}
<button name="submit_review" class="btn">{% trans 'Submit for review' %}</button>
{% endif %}
</div>
Expand Down
5 changes: 3 additions & 2 deletions integreat_cms/cms/templates/pages/page_revisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="heading">
{% endwith %}
</h1>
<a href="{% url 'edit_page' page_id=page.id region_slug=request.region.slug language_slug=language.slug %}" class="btn btn-gray">
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Go Back to Page Editor' %}
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Back to the page form' %}
</a>
</div>

Expand Down Expand Up @@ -83,11 +83,12 @@ <h1>{{ page_translation.title }}</h1>
</div>
<div class="w-full p-4 flex justify-end gap-4">
{% if not page.archived %}
{% has_perm 'cms.change_page_object' request.user page as can_edit_page %}
{% has_perm 'cms.publish_page_object' request.user page as can_publish_page %}
{% if can_publish_page %}
<button name="submit_draft" class="btn btn-gray">{% trans 'Restore this version as draft' %}</button>
<button name="submit_public" class="btn">{% trans 'Restore and publish this version' %}</button>
{% else %}
{% elif can_edit_page %}
<button name="submit_review" class="btn">{% trans 'Restore this version and submit for review' %}</button>
{% endif %}
{% endif %}
Expand Down
31 changes: 15 additions & 16 deletions integreat_cms/cms/templates/pages/page_sbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
{% block content %}
<form method="post" id="content_form" data-unsaved-warning>
<div>
<div class="flex flex-wrap mb-4">
<div class="w-3/5 flex flex-wrap flex-col justify-center mb-6">
<h1 class="heading">
{% with page_title=source_page_translation.title source_language=source_page_translation.language.translated_name target_language_name=target_language.translated_name %}
{% blocktrans %}Translate "{{ page_title }}" from {{ source_language }} to {{ target_language_name }}{% endblocktrans %}
{% endwith %}
</h1>
</div>
<div class="w-2/5 flex justify-end mb-6 gap-2">
<a href="{% url 'edit_page' page_id=source_page_translation.page.id region_slug=request.region.slug language_slug=target_language.slug %}"
class="bg-gray-400 hover:bg-gray-500 cursor-pointer text-white font-bold py-3 px-4 rounded">
{% trans 'Go Back to Page Editor' %}
</a>
<h1 class="heading">
{% with page_title=source_page_translation.title source_language=source_page_translation.language.translated_name target_language_name=target_language.translated_name %}
{% blocktrans %}Translate "{{ page_title }}" from {{ source_language }} to {{ target_language_name }}{% endblocktrans %}
{% endwith %}
</h1>
<div class="flex flex-wrap grow justify-between gap-2 mb-4">
<a href="{% url 'edit_page' page_id=source_page_translation.page.id region_slug=request.region.slug language_slug=target_language.slug %}"
class="bg-gray-400 hover:bg-gray-500 text-center cursor-pointer text-white font-bold py-3 px-4 rounded">
<i data-feather="arrow-left-circle" class="align-top"></i> {% trans 'Back to the page form' %}
</a>
<div class="flex flex-wrap gap-2">
{% has_perm 'cms.change_page_object' request.user source_page_translation.page as can_edit_page %}
{% if not source_page_translation.page.archived %}
{% has_perm 'cms.publish_page_object' request.user source_page_translation.page as can_publish_page %}
{% if can_publish_page %}
Expand All @@ -30,8 +29,8 @@ <h1 class="heading">
{% else %}
{% trans 'Publish' %}
{% endif %}
</button>
{% else %}
</button>
{% elif can_edit_page %}
<button name="submit_review" class="btn">{% trans 'Submit for review' %}</button>
{% endif %}
{% endif %}
Expand Down Expand Up @@ -146,7 +145,7 @@ <h1 class="heading">
</div>
</div>
</form>
{% if not can_change_page_object or page_translation_form.instance.id and page_translation_form.instance.page.archived %}
{% if not can_edit_page or page_translation_form.instance.id and page_translation_form.instance.page.archived %}
{% include '../_tinymce_config.html' with readonly=1 language=target_language %}
{% else %}
{% include '../_tinymce_config.html' with language=target_language %}
Expand Down
3 changes: 2 additions & 1 deletion integreat_cms/cms/templates/pois/poi_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ <h3 class="heading font-bold text-black">
<div class="rounded p-4 bg-water-500">
<h3 class="heading font-bold text-black">
<i data-feather="phone" class="pb-1"></i>
{% trans 'Contact' %}
{% trans 'Contact details' %}
</h3>
({% trans 'currently not publicly visible' %})
</div>
<div class="px-4 pb-4 divide-y divide-gray-200 space-y-2">
<div>
Expand Down
12 changes: 7 additions & 5 deletions integreat_cms/cms/templates/users/region_user_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ <h3 class="heading font-bold text-black"><i data-feather="key" class="mr-2"></i>
{% render_field user_form.role|add_error_class:"border-red-500" required="required" %}
<div class="help-text">{{ user_form.role.help_text }}</div>
</div>
<div>
<label for="{{ user_form.organization.id_for_label }}">{{ user_form.organization.label }}</label>
{% render_field user_form.organization|add_error_class:"border-red-500" %}
<div class="help-text">{{ user_form.organization.help_text }}</div>
</div>
{% if user_form.organization.field.queryset.exists %}
<div>
<label for="{{ user_form.organization.id_for_label }}">{{ user_form.organization.label }}</label>
{% render_field user_form.organization|add_error_class:"border-red-500" %}
<div class="help-text">{{ user_form.organization.help_text }}</div>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions integreat_cms/cms/views/imprint/imprint_revision_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def get(self, request, *args, **kwargs):
}
)

# Show warning if user has no permission to manage the imprint
if not request.user.has_perm("cms.change_imprintpage"):
messages.warning(
request,
_("You don't have the permission restore revisions of the imprint."),
)

return render(
request,
self.template_name,
Expand Down
2 changes: 1 addition & 1 deletion integreat_cms/cms/views/pages/page_form_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def get(self, request, *args, **kwargs):
_("You don't have the permission to edit this page."),
)
# Show warning if user has no permission to publish the page
if not request.user.has_perm("cms.publish_page_object", page):
elif not request.user.has_perm("cms.publish_page_object", page):
messages.warning(
request,
_(
Expand Down
10 changes: 10 additions & 0 deletions integreat_cms/cms/views/pages/page_sbs_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,18 @@ def get(self, request, *args, **kwargs):
},
)

disabled = False
# Make form disabled if user has no permission to edit the page
if not request.user.has_perm("cms.change_page_object", page):
disabled = True
messages.warning(
request,
_("You don't have the permission to edit this page."),
)

page_translation_form = PageTranslationForm(
instance=target_page_translation,
disabled=disabled,
)

return render(
Expand Down
Loading

0 comments on commit 956b216

Please sign in to comment.