actions restaurer/exporter sur les pages des snapshot (#74803) #471

Merged
fpeters merged 3 commits from wip/74803-snapshot-sidebar-export-restore into main 2023-07-14 09:06:02 +02:00
4 changed files with 20 additions and 7 deletions

View File

@ -766,6 +766,11 @@ def test_workflow_snapshot_browse(pub):
assert 'This workflow is readonly' in resp.text
assert '<p>%s</p>' % localstrftime(snapshot.timestamp) in resp.text
# check restore/export links of sidebar
resp.click('Restore version')
resp_export = resp.click('Export version')
assert 'snapshot-workflow' in resp_export.headers['Content-Disposition']
# check actions are displayed
resp = resp.click('Action')
resp = resp.click('Global Action: Action')

View File

@ -89,6 +89,17 @@ def snapshot_info_block(snapshot, url_prefix='../../', url_suffix=''):
r += htmltext(' <a class="button disabled" href="#">&GT;</a>')
r += htmltext(' <a class="button disabled" href="#">&Gt;</a>')
r += htmltext('</p>')
r += htmltext('<div>')
r += htmltext(
'<a class="button button-paragraph" href="%s%s/restore" role="button" rel="popup">%s</a>'
) % (url_prefix, snapshot.id, _('Restore version'))
r += htmltext('<a class="button button-paragraph" href="%s%s/export" role="button">%s</a>') % (
url_prefix,
snapshot.id,
_('Export version'),
)
r += htmltext('</div>')
return r.getvalue()

View File

@ -74,12 +74,9 @@
{% block sidebar-content %}
{% if formdef.is_readonly %}
<div class="infonotice">
{% block sidebar-content-readonly-message %}
{% trans "This form is readonly." %}
{% endblock %}
{{ view.snapshot_info_block|safe }}
<p>{% block sidebar-content-readonly-message %}{% trans "This form is readonly." %}{% endblock %}</p>
</div>
{{ view.snapshot_info_block|safe }}
{% else %}
<h3>{% trans "Actions" %}</h2>
<ul class="sidebar--buttons">

View File

@ -221,8 +221,8 @@
{% endblocktrans %}
</p>
{% elif workflow.is_readonly %}
<div class="infonotice"><p>{% trans "This workflow is readonly." %}</div>
{{ view.snapshot_info_block|safe }}
<div class="infonotice"><p>{% trans "This workflow is readonly." %}</p></div>
{{ view.snapshot_info_block|safe }}
{% endif %}
{% if not workflow.is_readonly or workflow.is_default %}
<h3>{% trans "Actions" %}</h2>