Skip to content

Commit

Permalink
Improve package_form and resource_form
Browse files Browse the repository at this point in the history
The templates are used for customizing the dataset/resources form in the dataset schema. This addition enhances the flexibility of the extension by allowing users to modify the resource form according to their specific requirements.
  • Loading branch information
mjanez committed May 17, 2024
1 parent 0f39d61 commit 06f9302
Show file tree
Hide file tree
Showing 12 changed files with 1,303 additions and 192 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ With this plugin, you can customize the group, organization, and dataset entitie

Are available to use with this extension a number of custom schema, more info: [`schemas/README.md`](./ckanext/schemingdcat/schemas/README.md)

**Schema Enhancements:**
We've made several improvements to our schema to provide a better metadata and metadata group management. Here are some of the key changes:
- **Form Pages and Form Groups:** We've introduced the use of `form_groups` and improve `form_pages` in our schemas. This allows us to group related fields into the same form, making it easier to navigate and manage metadata.
- **Metadata Management Improvements:** We've improved how we manage metadata in our schema. It's now easier to add, remove, and modify metadata, allowing us to keep our data more organized and accessible.
- **Metadata Group Updates:** We've made changes to how we handle metadata groups (`form_groups`). It's now easier to group related metadata, helping us keep our data more organized and making it easier to find specific information.

For more details on these enhancements, please refer to the schema files in [`ckanext/schemingdcat/schemas`](ckanext/schemingdcat/schemas).


### GeoDCAT-AP (ES)
[`schemas/geodcatp_es`](/ckanext/schemingdcat/schemas/geodcatap_es/geodcatap_es_dataset.yaml) with specific extensions for spatial data and [GeoDCAT-AP](https://github.com/SEMICeu/GeoDCAT-AP)/[INSPIRE](https://github.com/INSPIRE-MIF/technical-guidelines) metadata [profiles](https://en.wikipedia.org/wiki/Geospatial_metadata).

Expand Down
17 changes: 17 additions & 0 deletions ckanext/schemingdcat/assets/css/schemingdcat.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
max-width:250px;
}

.debug {
position: fixed;
top: 0px;
left: 0px;
z-index: 10;
}

body {
font-family: 'Poppins', sans-serif;
background: #fff;
Expand Down Expand Up @@ -1180,10 +1187,20 @@ img.item_image {
}

/* dataset form */
.card-header {
background-color: #ebebeb;
}

.form-actions {
overflow:hidden;
}

.slug-preview {
font-size: 14px;
line-height: 1.5;
margin: -30px 0 30px 20px;
}

/* metadata_info */
.table tr.toggle-separator {
display: table-row;
Expand Down
20 changes: 19 additions & 1 deletion ckanext/schemingdcat/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,4 +1028,22 @@ def schemingdcat_parse_localised_date(date_=None):
if locale == 'es':
return date_.strftime('%d-%m-%Y')
else:
return date_.strftime('%Y-%m-%d')
return date_.strftime('%Y-%m-%d')

@helper
def schemingdcat_get_schema_form_groups(entity_type=None, object_type=None, schema=None):
"""
Return a list of schema metadata groups for this form.
1. return schema['schema_form_groups'] if it is defined
2. get schema from entity_type + object_type then
return schema['schema_form_groups'] if they are defined
"""
if schema and "schema_form_groups" in schema:
return schema["schema_form_groups"]
elif entity_type and object_type:
from ckanext.scheming.helpers import scheming_get_schema
schema = scheming_get_schema(entity_type, object_type)
return schema["schema_form_groups"] if schema and "schema_form_groups" in schema else None
else:
return None
3 changes: 3 additions & 0 deletions ckanext/schemingdcat/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def resource_template(self):
def package_form(self):
return "schemingdcat/package/snippets/package_form.html"

def resource_form(self):
return "schemingdcat/package/snippets/resource_form.html"

def get_actions(self):
return {
"schemingdcat_dataset_schema_name": logic.schemingdcat_dataset_schema_name,
Expand Down
Loading

0 comments on commit 06f9302

Please sign in to comment.