-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#56] Common preset for DCAT date-based fields
Support at the validator level for year, year-month, date and datetime values, which are correctly typed in the RDF serialization. At the UI level a date input is used by default as it was difficult to provide one that supported all inputs.
- Loading branch information
Showing
7 changed files
with
189 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
scheming_presets_version: 1 | ||
about: Presets for the ckanext-dcat extension | ||
about_url": "http://github.com/ckan/ckanext-dcat" | ||
|
||
presets: | ||
|
||
- preset_name: dcat_date | ||
values: | ||
# Note: use datetime.html or datetime_tz.html if you want to inclue an input for time | ||
form_snippet: date.html | ||
display_snippet: dcat_date.html | ||
validators: ignore_missing dcat_date convert_to_json_if_datetime |
4 changes: 4 additions & 0 deletions
4
ckanext/dcat/templates/scheming/display_snippets/dcat_date.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,4 @@ | ||
{{ h.render_datetime(data[field.field_name]) }} | ||
|
||
{# Use the following if you want to include the time as well #} | ||
{# h.render_datetime(data[field.field_name], with_hours=True) #} |
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