Skip to content

Commit

Permalink
[#607] Allow to reactivate deleted datasets
Browse files Browse the repository at this point in the history
Currently if a dataset is deleted and users navigate to the edit form,
there is no state field and the delete button is still shown.

After this change, the state dropdown is shown if the dataset state is
not active, and the delete button is not shown.
  • Loading branch information
amercader committed Dec 4, 2013
1 parent 82cdbb8 commit bf11648
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ckan/templates/package/snippets/package_basic_fields.html
Expand Up @@ -99,4 +99,17 @@
</div>
{% endif %}


{% if data.id and h.check_access('package_delete', {'id': data.id}) and data.state != 'active' %}
<div class="control-group">
<label for="field-state" class="control-label">{{ _('State') }}</label>
<div class="controls">
<select id="field-state" name="state">
<option value="active" {% if data.get('state', 'none') == 'active' %} selected="selected" {% endif %}>{{ _('Active') }}</option>
<option value="deleted" {% if data.get('state', 'none') == 'deleted' %} selected="selected" {% endif %}>{{ _('Deleted') }}</option>
</select>
</div>
</div>
{% endif %}

{% endblock %}
2 changes: 1 addition & 1 deletion ckan/templates/package/snippets/package_form.html
Expand Up @@ -33,7 +33,7 @@
</p>
{% endblock %}
{% block delete_button %}
{% if h.check_access('package_delete', {'id': data.id}) %}
{% if h.check_access('package_delete', {'id': data.id}) and not data.state == 'deleted' %}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this dataset?')}) %}
<a class="btn btn-danger pull-left" href="{% url_for controller='package', action='delete', id=data.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
Expand Down

0 comments on commit bf11648

Please sign in to comment.