forked from OpenDataGIS/ckanext-facet_scheming
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve deleted packages lists in trash
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% ckan_extends %} | ||
|
||
{% block primary_content_inner %} | ||
<form method="POST" action="{{ h.url_for('admin.trash') }}" id="form-purge-all"> | ||
{{ h.csrf_input() }} | ||
<div class="form-actions"> | ||
<input type="hidden" name="action" value="all"> | ||
<a class="btn btn-danger purge-all" | ||
type="submit" | ||
href="{{ h.url_for('admin.trash', name='all') }}" | ||
data-module="confirm-action" | ||
data-module-with-data=true | ||
data-module-content="{{ _('Are you sure you want to purge everything?') }}"> | ||
{{ _('Purge all') }} | ||
</a> | ||
</div> | ||
</form> | ||
|
||
{% for ent_type, entities in data.items() %} | ||
{% snippet "scheming_dcat/snippets/data_type.html", ent_type=ent_type, entities=entities, messages=messages %} | ||
{% endfor %} | ||
{% endblock %} | ||
|
||
{% block secondary_content %} | ||
<div class="module module-narrow module-shallow"> | ||
<h2 class="module-heading"> | ||
<i class="fa fa-info-circle"></i> | ||
{{ _("Trash") }} | ||
</h2> | ||
<div class="module-content"> | ||
<p> | ||
{% trans %} | ||
Purge deleted datasets, organizations or groups forever and irreversibly. | ||
{% endtrans %} | ||
</p> | ||
</div> | ||
</div> | ||
{% endblock %} |
63 changes: 63 additions & 0 deletions
63
ckanext/scheming_dcat/templates/scheming_dcat/snippets/data_type.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<button class="accordion-item" data-toggle="collapse" data-target="#{{ ent_type }}"> | ||
{% if ent_type == "package" %} <i class='fa fa-sitemap'></i> | ||
{% elif ent_type == 'group' %} <i class='fa fa-group'></i> | ||
{% else %} <i class="fa fa-building-o"></i> | ||
{% endif %} | ||
{% if ent_type == 'package' %} | ||
{{ _('Deleted datasets') }} | ||
{% elif ent_type == 'organization' %} | ||
{{ _('Deleted organizations') }} | ||
{% elif ent_type == 'group' %} | ||
{{ _('Deleted groups') }} | ||
{% endif %} | ||
</button> | ||
|
||
<!-- expanded by default to prevent problems with disabled js --> | ||
<div id="{{ ent_type }}" class="entities collapse in"> | ||
{% set truncate = truncate or 180 %} | ||
{% set truncate_title = truncate_title or 80 %} | ||
<ul class="{{ ent_type }}-list"> | ||
{% for entity in entities %} | ||
{% set title = entity.title or entity.name %} | ||
{% set url = h.url_for(entity.type + '.read', id=entity.name) %} | ||
|
||
<li> | ||
<div class="trash-dataset-badges"> | ||
{{ h.link_to(h.truncate(title, truncate_title), url) }} | ||
{% if entity.private %} | ||
<span class="dataset-private badge pull-left"> | ||
<i class="fa fa-lock"></i> | ||
{{ _('Private') }} | ||
</span> | ||
{% endif %} | ||
</div> | ||
<ul class="trash-li-info"> | ||
{% if entity.metadata_created %} | ||
<li>{{ _('Created') }}: {{ entity.metadata_created | datetimeformat }}</li> | ||
{% endif %} | ||
{% if entity.notes %} | ||
<li>{{ _('Description') }}: {{ h.markdown_extract(entity.notes, extract_length=100) }}</li> | ||
{% endif %} | ||
</ul> | ||
</li> | ||
{% else %} | ||
<p> | ||
{{ _(messages.empty[ent_type]) }} | ||
</p> | ||
{% endfor %} | ||
</ul> | ||
|
||
<!-- show button only if there is entity to purge --> | ||
{% if entities.first() %} | ||
<form method="POST" action="{{ h.url_for('admin.trash') }}" id="form-purge-{{ ent_type }}"> | ||
<input type="hidden" name="action" value="{{ent_type}}"> | ||
<a href="{{ h.url_for('admin.trash', name=ent_type) }}" | ||
class="btn btn-danger purge-all" | ||
data-module="confirm-action" | ||
data-module-with-data=true | ||
data-module-content="{{ _(messages.confirm[ent_type]) }}"> | ||
{{ _('Purge') }} | ||
</a> | ||
</form> | ||
{% endif %} | ||
</div> |