Style LearningUnit in Wagtail
This commit is contained in:
parent
15edbede8f
commit
987eeb9def
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
content: [
|
||||
'./index.html',
|
||||
'./src/**/*.{vue,js,ts,jsx,tsx}',
|
||||
// '../server/vbv_lernwelt/**/*.{html,js}',
|
||||
// '../server/vbv_lernwelt/**/*.{html,js,py}',
|
||||
],
|
||||
theme: {
|
||||
fontFamily: {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,13 @@ class LearningSequence(Page):
|
|||
def get_admin_display_title(self):
|
||||
return f'{self.icon} {self.draft_title}'
|
||||
|
||||
def get_admin_display_title_html(self):
|
||||
return f'''
|
||||
<span style="display: inline-flex; align-items: center; font-size: 1.25rem; font-weight: 700;">
|
||||
<{self.icon} style="height: 32px; width: 32px;"></{self.icon}>
|
||||
<span style="margin-left: 8px;">{self.draft_title}</span>
|
||||
</span>'''
|
||||
|
||||
def full_clean(self, *args, **kwargs):
|
||||
super(LearningSequence, self).full_clean(*args, **kwargs)
|
||||
|
||||
|
|
@ -168,6 +175,9 @@ class LearningUnit(Page):
|
|||
def get_serializer_class(cls):
|
||||
return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'children'])
|
||||
|
||||
def get_admin_display_title_html(self):
|
||||
return f'<span style="font-weight: 700; font-size: 20px;">{self.draft_title}</span>'
|
||||
|
||||
|
||||
class LearningUnitQuestion(Page):
|
||||
parent_page_types = ['learnpath.LearningUnit']
|
||||
|
|
@ -220,6 +230,13 @@ class LearningContent(Page):
|
|||
|
||||
return display_title
|
||||
|
||||
def get_admin_display_title_html(self):
|
||||
return f'''
|
||||
<span style="display: inline-flex; align-items: center;">
|
||||
<it-icon-checkbox-unchecked style="height: 24px; width: 24px;"></it-icon-checkbox-unchecked>
|
||||
<span style="margin-left: 8px;">{self.get_admin_display_title()}</span>
|
||||
</span>'''
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Learning Content"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,28 @@
|
|||
{% load wagtailadmin_tags i18n %}
|
||||
|
||||
{% block extra_js %}
|
||||
{{ block.super }}
|
||||
{{ block.super }}
|
||||
|
||||
<script type="text/javascript">
|
||||
if (document.location.href.endsWith('/')) {
|
||||
// add ?ordering=ord as default ordering
|
||||
console.log('redirect');
|
||||
document.location.replace(document.location.href + '?ordering=ord');
|
||||
}
|
||||
<style>
|
||||
.title_type_learningcontent {
|
||||
border-left: 2px solid #41B5FA;
|
||||
padding-left: 16px !important;
|
||||
}
|
||||
|
||||
.title_type_learningunit {
|
||||
border-left: 2px solid #41B5FA;
|
||||
padding-left: 16px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script defer src="/learnpath/icons/"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
if (document.location.href.endsWith('/')) {
|
||||
// add ?ordering=ord as default ordering
|
||||
console.log('redirect');
|
||||
document.location.replace(document.location.href + '?ordering=ord');
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% load wagtailadmin_tags %}
|
||||
<table class="listing {% if full_width %}full-width{% endif %} {% block table_classname %}{% endblock %}">
|
||||
{% if show_ordering_column or show_bulk_actions %}
|
||||
<col width="10px"/>
|
||||
{% endif %}
|
||||
<col/>
|
||||
{% if show_parent %}
|
||||
<col/>
|
||||
{% endif %}
|
||||
<col width="12%"/>
|
||||
<col width="12%"/>
|
||||
<col width="12%"/>
|
||||
<col width="10%"/>
|
||||
<thead>
|
||||
{% block pre_parent_page_headers %}
|
||||
{% endblock %}
|
||||
|
||||
{% if parent_page %}
|
||||
{% page_permissions parent_page as parent_page_perms %}
|
||||
<tr class="index {% if not parent_page.live %} unpublished{% endif %}
|
||||
{% block parent_page_row_classname %}{% endblock %}">
|
||||
<td class="title"{% if show_ordering_column or show_bulk_actions %} colspan="2"{% endif %}>
|
||||
{% block parent_page_title %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
<td class="updated" valign="bottom">{% if parent_page.latest_revision_created_at %}
|
||||
<div class="human-readable-date" title="{{ parent_page.latest_revision_created_at|date:"DATETIME_FORMAT" }}">
|
||||
{% blocktrans trimmed with time_period=parent_page.latest_revision_created_at|timesince %}{{ time_period }}
|
||||
ago{% endblocktrans %}</div>{% endif %}</td>
|
||||
<td class="type" valign="bottom">
|
||||
{% if not parent_page.is_root %}
|
||||
{{ parent_page.content_type.model_class.get_verbose_name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="status" valign="bottom">
|
||||
{% if not parent_page.is_root %}
|
||||
{% include "wagtailadmin/shared/page_status_tag.html" with page=parent_page %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% block post_parent_page_headers %}
|
||||
{% endblock %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if pages %}
|
||||
{% trans "Select page" as checkbox_aria_label %}
|
||||
{% for page in pages %}
|
||||
{% page_permissions page as page_perms %}
|
||||
<tr {% if ordering == "ord" %}id="page_{{ page.id|unlocalize }}"
|
||||
data-page-title="{{ page.get_admin_display_title }}"{% endif %}
|
||||
class="{% if not page.live %}unpublished{% endif %} {% block page_row_classname %}{% endblock %}">
|
||||
{% if show_ordering_column %}
|
||||
<td class="ord">{% if orderable and ordering == "ord" %}
|
||||
<div class="handle icon icon-grip text-replace">{% trans 'Drag' %}</div>{% endif %}</td>
|
||||
{% elif show_bulk_actions %}
|
||||
{% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="page" obj=page aria_labelledby_prefix="page_" aria_labelledby=page.pk|unlocalize aria_labelledby_suffix="_title" %}
|
||||
{% endif %}
|
||||
<td id="page_{{ page.pk|unlocalize }}_title" class="title title_type_{{ page.content_type.model }}" valign="top" data-listing-page-title>
|
||||
{{ page.type }}
|
||||
{% block page_title %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{% if show_parent %}
|
||||
<td class="parent" valign="top">
|
||||
{% block page_parent_page_title %}
|
||||
{% with page.get_parent as parent %}
|
||||
{% if parent %}
|
||||
<a
|
||||
href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.specific_deferred.get_admin_display_title }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="updated" valign="top">{% if page.latest_revision_created_at %}
|
||||
<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"DATETIME_FORMAT" }}">
|
||||
{% blocktrans trimmed with time_period=page.latest_revision_created_at|timesince %}{{ time_period }}
|
||||
ago{% endblocktrans %}</div>{% endif %}</td>
|
||||
<td class="type" valign="top">{{ page.content_type.model_class.get_verbose_name }}</td>
|
||||
<td class="status" valign="top">
|
||||
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
|
||||
</td>
|
||||
{% block page_navigation %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% block no_results %}{% endblock %}
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "wagtailadmin/pages/listing/_list_explore.html" %}
|
||||
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
|
||||
{% block page_title %}
|
||||
{% include "wagtailadmin/pages/listing/_page_title_explore.html" %}
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{# The title field for a page in the page listing, when in 'explore' mode #}
|
||||
|
||||
<div class="title-wrapper">
|
||||
{% if page.is_site_root %}
|
||||
{% if perms.wagtailcore.add_site or perms.wagtailcore.change_site or perms.wagtailcore.delete_site %}
|
||||
<a href="{% url 'wagtailsites:index' %}" class="icon icon-site" title="{% trans 'Sites menu' %}"></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page_perms.can_edit %}
|
||||
<a href="{% url 'wagtailadmin_pages:edit' page.id %}"
|
||||
title="{% trans 'Edit this page' %}">
|
||||
{% if page.get_admin_display_title_html %}
|
||||
{% autoescape off %}{{ page.get_admin_display_title_html }}{% endautoescape %}
|
||||
{% else %}
|
||||
{{ page.get_admin_display_title }}
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
<a href="/cms/pages/124/edit/"
|
||||
title="Edit this page">
|
||||
</a>
|
||||
{% else %}
|
||||
{{ page.get_admin_display_title }}
|
||||
{% endif %}
|
||||
|
||||
{% if show_locale_labels %}
|
||||
<span class="status-tag status-tag--label">{{ page.locale.get_display_name }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% block pages_listing_title_extra %}{% endblock pages_listing_title_extra %}
|
||||
|
||||
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
|
||||
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
|
||||
</div>
|
||||
|
||||
<ul class="actions">
|
||||
{% page_listing_buttons page page_perms %}
|
||||
</ul>
|
||||
Loading…
Reference in New Issue