Skip to content

Commit

Permalink
Make the dataset title field required
Browse files Browse the repository at this point in the history
  • Loading branch information
taleksovska committed Aug 26, 2024
1 parent 70f5f19 commit d04052e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ckanext/bulkupload/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def get_auth_functions(self):

def get_blueprint(self):

return bulkupload
return bulkupload
43 changes: 24 additions & 19 deletions ckanext/bulkupload/templates/package/package_busoperator.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@

<p> </p>
{% if request.args.get('errors') %}
<p class="text-danger">Please fill the dataset title</title></p>
<p class="text-danger">A dataset with this title already exists.</title></p>
{% endif %}
<form id="bulk_upload_form" method="post" enctype="multipart/form-data">
{{ form.input('title', id='field-dataset-title', label=_('Dataset Title'), value="", error="", placeholder='e.g. TransX data') }}
<div style="margin:-20px 0px 20px 0px;"><small>{{ form.info('The name of the dataset') }}</small></div>
<label for="field-dataset-title">{{ _('Dataset Title') }}</label>
<input type="text" name="title" id="field-dataset-title"
placeholder="{{ _('e.g. TransX data') }}"
class="form-control" required>
<br>
<div style="margin: -20px 0px 20px 0px;">
<small>{{ form.info('The name of the dataset') }}</small>
</div>
{{ form.input('date-start', type='date', id='field-date-start', label=_('Date start'), value='', error='') }}
<div style="margin:-20px 0px 20px 0px;"><small>{{ form.info('Date start') }}</small></div>
{{ form.input('date-end', type='date', id='field-date-end', label=_('Date end'), value='', error='') }}
Expand All @@ -34,22 +40,22 @@
</div>
</form>

<script>
// Get the start and end date input elements
const startDateInput = document.getElementById('field-date-start');
const endDateInput = document.getElementById('field-date-end');

// Function to update the min attribute of the end date input
function updateEndDateMin() {
if (startDateInput.value) {
endDateInput.min = startDateInput.value;
} else {
endDateInput.min = '';
<script>
// Get the start and end date input elements
const startDateInput = document.getElementById('field-date-start');
const endDateInput = document.getElementById('field-date-end');

// Function to update the min attribute of the end date input
function updateEndDateMin() {
if (startDateInput.value) {
endDateInput.min = startDateInput.value;
} else {
endDateInput.min = '';
}
}
}

startDateInput.addEventListener('change', updateEndDateMin);
</script>

startDateInput.addEventListener('change', updateEndDateMin);
</script>

{% endblock %}
{% endblock %}
Expand All @@ -70,4 +76,3 @@ <h2 class="module-heading"><i class="fa fa-info-circle"></i> {{ _('What are data
</section>
{% endblock %}
{% endblock %}

0 comments on commit d04052e

Please sign in to comment.