backoffice: display publication dates in forms page (#58889) #1162
|
@ -510,6 +510,34 @@ def test_forms_edit_publication_date(pub):
|
|||
assert 'invalid value' in resp
|
||||
|
||||
|
||||
def test_forms_list_publication_date(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
|
||||
FormDef.wipe()
|
||||
formdef = FormDef()
|
||||
formdef.name = 'form title'
|
||||
formdef.fields = []
|
||||
formdef.publication_date = '2024-03-06 00:00'
|
||||
formdef.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/forms/')
|
||||
assert resp.pyquery('.publication-dates').text() == 'Published from 2024-03-06 00:00'
|
||||
|
||||
formdef.expiration_date = '2024-03-10 00:00'
|
||||
formdef.store()
|
||||
resp = app.get('/backoffice/forms/')
|
||||
assert (
|
||||
resp.pyquery('.publication-dates').text() == 'Published from 2024-03-06 00:00 until 2024-03-10 00:00'
|
||||
)
|
||||
|
||||
formdef.publication_date = None
|
||||
formdef.store()
|
||||
resp = app.get('/backoffice/forms/')
|
||||
assert resp.pyquery('.publication-dates').text() == 'Published until 2024-03-10 00:00'
|
||||
|
||||
|
||||
def test_form_category(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
|
|
|
@ -3136,3 +3136,10 @@ div[role="tabpanel"] > div.infonotice:first-child {
|
|||
form div.widget[data-widget-name="model_file_mode"] {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.extra-info.publication-dates {
|
||||
&::before {
|
||||
content: "";
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,23 @@
|
|||
<li {% if item.disabled %}class="disabled"{% endif %}><a href="{{ item.get_admin_url }}">
|
||||
{% if not application %}{% include 'wcs/backoffice/includes/application_icons.html' with object=item %}{% endif %}
|
||||
{{ item.name }}
|
||||
{% if item.publication_date or item.expiration_date %}
|
||||
<span class="extra-info publication-dates">
|
||||
{% if item.publication_date and item.expiration_date %}
|
||||
{% blocktrans trimmed with date1=item.publication_date|date:"DATETIME_FORMAT" date2=item.expiration_date|date:"DATETIME_FORMAT" %}
|
||||
Published from {{ date1 }} until {{ date2 }}
|
||||
{% endblocktrans %}
|
||||
{% elif item.publication_date %}
|
||||
{% blocktrans trimmed with date1=item.publication_date|date:"DATETIME_FORMAT" %}
|
||||
Published from {{ date1 }}
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans trimmed with date2=item.expiration_date|date:"DATETIME_FORMAT" %}
|
||||
Published until {{ date2 }}
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if item.disabled and item.disabled_redirection %}
|
||||
<span class="extra-info">- {% trans "redirection" %}</span>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue