Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
Changed default values
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Souhei committed Oct 2, 2024
1 parent 7bf45ae commit 0351125
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set value = data[field.field_name] %}
{% if value == 'approved' %}
{% if value == '1' %}
<strong>{{ _('Yes') }}</strong>
{% else %}
<strong style="color: red">{{ _('No') }}</strong>
Expand Down
6 changes: 3 additions & 3 deletions ckanext/zarr/templates/scheming/form_snippets/confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
<label for="approved-{{ field.field_name }}">
<input id="checkbox-for-{{ field.field_name }}"
type="checkbox"
{{"checked " if data[field.field_name] == 'approved'}}
{{"checked " if data[field.field_name] == '1'}}
name="approved-{{ field.field_name }}"
onchange="
var hiddenInput = document.getElementById('approval-status-{{ field.field_name }}');
hiddenInput.value = this.checked ? 'approved' : 'rejected';
hiddenInput.value = this.checked ? '1' : '0';
"
/>
{{ placeholder }}
</label>
<input type="hidden" id="approval-status-{{ field.field_name }}" name="{{ field.field_name }}" value="rejected"/>
<input type="hidden" id="approval-status-{{ field.field_name }}" name="{{ field.field_name }}" value="0"/>
</fieldset>

{%- snippet 'scheming/form_snippets/help_text.html', field=field -%}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/zarr/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ def validator(key, data, errors, context):
def approval_required(field, schema):
def validator(key, data, errors, context):
value = data.get(key)
if value != "approved":
if value != "1":
errors[key].append(_(f"This field is mandatory."))
return validator

0 comments on commit 0351125

Please sign in to comment.