-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(logic): added
strip_extra_white
info field;
- Added `strip_extra_white` info field and form fields. - Added validator for `strip_extra_white`. - Used `strip_extra_white` to control stripping white space.
- Loading branch information
1 parent
a6ab0a0
commit 54f87e0
Showing
6 changed files
with
87 additions
and
42 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
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
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
11 changes: 11 additions & 0 deletions
11
ckanext/xloader/templates/datastore/snippets/dictionary_form.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,11 @@ | ||
{% ckan_extends %} | ||
{% import 'macros/form.html' as form %} | ||
|
||
{% block additional_fields %} | ||
{{ super() }} | ||
{{ form.select('info__' ~ position ~ '__strip_extra_white', | ||
label=_('Strip Extra Leading and Trailing White Space'), options=[ | ||
{'text': 'Yes', 'value': true}, | ||
{'text': 'No', 'value': false}, | ||
], selected=field.get('info', {}).get('strip_extra_white')) }} | ||
{% endblock %} |
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
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,12 @@ | ||
from ckan.plugins.toolkit import asbool | ||
|
||
|
||
def datastore_fields_validator(value, context): | ||
if 'strip_extra_white' not in value: | ||
# default to True | ||
value['strip_extra_white'] = True | ||
|
||
# bool value for strip_extra_white | ||
value['strip_extra_white'] = asbool(value['strip_extra_white']) | ||
|
||
return value |