Skip to content

Commit

Permalink
Refactor new_source_form.html to use Bootstrap 5 data attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjanez committed Sep 16, 2024
1 parent 0ffa59e commit c4d131b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ckanext/schemingdcat/templates/source/new_source_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

{{ h.csrf_input() if 'csrf_input' in h }}

{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full'], attrs={'data-module': 'slug-preview-target'}) }}
{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full'], attrs={'data-bs-module': 'slug-preview-target'}) }}

{% set prefix = 'harvest' %}
{% set domain = h.url_for('{0}.read'.format(c.dataset_type), id='', qualified=true) %}
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
{% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<harvest-source>'} %}
{% set attrs = {'data-bs-module': 'slug-preview-slug', 'data-bs-module-prefix': domain, 'data-bs-module-placeholder': '<harvest-source>'} %}

{{ form.prepend('name', id='field-name', label=_('Name'), prepend=prefix, placeholder=_('eg. my-dataset'), value=data.name, error=errors.name, attrs=attrs) }}

Expand All @@ -35,9 +35,9 @@
{% set checked = True %}
{% endif %}
<label class="radio">
<input type="radio" name="source_type" value="{{ harvester['name'] }}" {{ "checked " if checked }} data-module="harvest-type-change">
<input type="radio" name="source_type" value="{{ harvester['name'] }}" {{ "checked " if checked }} data-bs-module="harvest-type-change">
{{ harvester['title'] }}
<i class="fa fa-question-circle icon-question-sign muted" title="{{ harvester['description'] }}" data-bs-toggle="tooltip" data-toggle="tooltip"></i>
<i class="fa fa-question-circle icon-question-sign muted" title="{{ harvester['description'] }}" data-bs-toggle="tooltip" data-bs-toggle="tooltip"></i>
</label>
{% endfor %}
</div>
Expand Down Expand Up @@ -69,7 +69,7 @@
<div class="control-group form-group">
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">
<select id="field-organizations" name="owner_org" data-bs-module="autocomplete">
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option>
{% for organization in organizations_available %}
{# get out first org from users list only if there is not an existing org #}
Expand Down Expand Up @@ -99,18 +99,18 @@
{% set locale_delete = h.dump_json({'content': _('This will flag the source as deleted but keep all its datasets and previous jobs. Are you sure you want to delete this harvest source?')}) %}
{% set locale_clear = h.dump_json({'content': _('Warning: Apart from deleting this source, this command will remove all its datasets, as well as all previous job reports. Are you sure you want to continue?')}) %}
<div class="dropdown btn-group">
<a href="#" class="btn btn-danger dropdown-toggle" data-bs-toggle="dropdown" data-toggle="dropdown">
<a href="#" class="btn btn-danger dropdown-toggle" data-bs-toggle="dropdown" data-bs-toggle="dropdown">
{{ _('Delete') }}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="{% url_for 'harvest_delete', id=data.name %}" data-module="confirm-action" data-module-i18n="{{ locale_delete }}">
<a href="{% url_for 'harvest_delete', id=data.name %}" data-bs-module="confirm-action" data-bs-module-i18n="{{ locale_delete }}">
{{ _('Delete source') }}
</a>
</li>
<li>
<a href="{% url_for 'harvest_delete', id=data.name %}?clear=True" data-module="confirm-action" data-module-i18n="{{ locale_clear }}">
<a href="{% url_for 'harvest_delete', id=data.name %}?clear=True" data-bs-module="confirm-action" data-bs-module-i18n="{{ locale_clear }}">
{{ _('Delete and clear source') }}
</a>
</li>
Expand Down

0 comments on commit c4d131b

Please sign in to comment.