-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor page tree and add page based statistics #3325
base: develop
Are you sure you want to change the base?
Changes from 56 commits
39de968
63219f4
8eb7279
94fcc30
3c12cc7
b1545cc
9edae89
e3c0d63
8466b66
813b751
04ce650
aed75ed
05c2ad1
7128904
718358e
4fd9720
feb7a64
a41035d
bbfb58c
c375fde
68ccfe1
a9fa6ae
edc3114
0308511
562f952
836506b
bc93bc6
ce301cc
4f4c99d
4f91410
046c9d0
a022d8f
ef21cf8
4801e17
b882d07
5b66426
160d621
89fd0fd
962f0c5
5df5e37
495e71b
7a82550
71c19ab
b0ffcc6
c502c28
b1da1bc
424448f
9305396
b183cc5
4d0ff3e
29809d1
4990aea
7af0938
120f93c
1864936
1223224
9e6374b
70f7f62
d7842be
7d82374
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% load i18n %} | ||
{% load static %} | ||
{% load content_filters %} | ||
{% load page_filters %} | ||
{% load rules %} | ||
{% block content %} | ||
<th class="text-sm text-left uppercase py-3 pl-4 pr-2 min"> | ||
<input type="checkbox" id="bulk-select-all" class="cursor-wait" /> | ||
</th> | ||
{% if not filter_form.is_enabled %} | ||
<th class="text-sm text-left uppercase py-3 pl-2 pr-2 min"> | ||
{% translate "Hierarchy" %} | ||
</th> | ||
{% endif %} | ||
<th class="text-sm text-left uppercase py-3 pl-2 pr-2"> | ||
{% translate "Title in" %} {{ language.translated_name }} | ||
</th> | ||
{% get_current_language as LANGUAGE_CODE %} | ||
{% get_language LANGUAGE_CODE as backend_language %} | ||
{% if backend_language and backend_language != language %} | ||
<th class="text-sm text-left uppercase py-3 px-2"> | ||
{% translate "Title in" %} {{ backend_language.translated_name }} | ||
</th> | ||
{% endif %} | ||
{% endblock content %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{% load i18n %} | ||
{% load content_filters %} | ||
{% load page_filters %} | ||
{% load tree_filters %} | ||
{% load rules %} | ||
{% get_translation page language.slug as page_translation %} | ||
{% block content %} | ||
<td class="pl-4"> | ||
<input type="checkbox" | ||
name="selected_ids[]" | ||
value="{{ page.id }}" | ||
class="bulk-select-item cursor-wait" /> | ||
</td> | ||
{% if not filter_form.is_enabled %} | ||
{% has_perm 'cms.change_page_object' request.user as can_edit_pages %} | ||
<td class="hierarchy single_icon whitespace-nowrap"> | ||
<span data-drag-id="{{ page.id }}" | ||
data-node-descendants="{{ page|get_descendant_ids }}" | ||
class="drag cursor-move text-gray-800 inline-block pl-4 align-middle" | ||
draggable="{% if can_edit_pages and not is_archive and not is_statistics %}true{% else %}false{% endif %}" | ||
title="{% if not is_archive and not is_statistics %}{% translate "Change the order and position of the pages with drag & drop." %}{% else %}{% translate "Drag & drop is disabled for archived pages and statistics." %}{% endif %}"> | ||
{% if can_edit_pages %} | ||
<i icon-name="move"></i> | ||
{% endif %} | ||
</span> | ||
{% if not is_archive %} | ||
{% if not page.parent_id and not page.is_leaf or page.parent_id and page.cached_children|length > 0 %} | ||
<span class="toggle-subpages inline-block align-middle cursor-wait transform" | ||
data-expand-title="{% translate "Expand all subpages" %}" | ||
data-collapse-title="{% translate "Collapse all subpages" %}" | ||
data-page-id="{{ page.id }}" | ||
data-page-children="{{ page|get_children_ids }}" | ||
data-page-tree-id="{{ page.tree_id }}"> | ||
<i icon-name="chevron-right"></i> | ||
</span> | ||
{% endif %} | ||
{% endif %} | ||
</td> | ||
{% endif %} | ||
<td> | ||
<a href="{% url 'edit_page' page_id=page.id region_slug=request.region.slug language_slug=language.slug %}" | ||
class="block py-1.5 px-2 overflow-hidden max-w-xs whitespace-nowrap text-ellipsis text-gray-800" | ||
title="{% if page_translation %} {{ page_translation.title }}{% endif %}"> | ||
{% if page_translation %} | ||
{{ page_translation.title }} | ||
{% else %} | ||
<i>{% translate "Translation not available" %}</i> | ||
{% endif %} | ||
</a> | ||
</td> | ||
{% if not backend_language %} | ||
{% get_current_language as LANGUAGE_CODE %} | ||
{% get_language LANGUAGE_CODE as backend_language %} | ||
{% endif %} | ||
{% if backend_language != language %} | ||
<td> | ||
<a href="{% url 'edit_page' page_id=page.id region_slug=request.region.slug language_slug=backend_language.slug %}" | ||
class="block py-1.5 px-2 overflow-hidden max-w-xs whitespace-nowrap text-ellipsis text-gray-800" | ||
title="{% if page.backend_translation %} {{ page.backend_translation.title }}{% endif %}"> | ||
<div class="translation-title"> | ||
{% if page.backend_translation %} | ||
{{ page.backend_translation.title }} | ||
{% else %} | ||
<i>{% translate "Translation not available" %}</i> | ||
{% endif %} | ||
</div> | ||
</a> | ||
</td> | ||
{% endif %} | ||
{% endblock content %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,11 @@ | |
<table> | ||
<tbody> | ||
{% for page in pages %} | ||
{% include "pages/page_tree_node.html" %} | ||
{% if is_statistics %} | ||
{% include "statistics/statistics_viewed_pages_node.html" %} | ||
{% else %} | ||
{% include "pages/pages_page_tree_node.html" %} | ||
{% endif %} | ||
Comment on lines
+6
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: if we decide to use the page tree for even more things / in more variants, this becomes cumbersome. Maybe we could pass something like (...but since I do not know if we will be extending the usecases of this, it really is a nit. Feel free to ignore without comment 😄) |
||
{% endfor %} | ||
</tbody> | ||
</table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
generic_page_tree_header.html
? From the name I initially thought this was the main "entry point" for the tree