Skip to content

Commit

Permalink
Add new fields in to create new collection
Browse files Browse the repository at this point in the history
  • Loading branch information
NTaherifar committed Jul 10, 2024
1 parent 2db898e commit ed346b8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,27 @@ fields:
required: true
validators: not_empty unicode_safe name_validator group_name_validator

- field_name: is_culturally_sensitive
label: Is culturally sensitive?
required: true
default: non-sensitive
preset: radio
choices:
- value: non-sensitive
label: "No"
- value: sensitive
label: "Yes"
- field_name: related_dataset_title
label: Related Dataset Title
help_text: Enter the short title that represents the related dataset

- field_name: related_dataset_url
label: Related Dataset URL
required: true
display_snippet: URL
help_text: Associated dataset related to the collection

- field_name: related_dataset_title
label: Related Dataset Title
required: true
help_text: Enter the short title that represents the related dataset

- field_name: description
label: Description
preset: markdown
required: true

- field_name: image_url
label: Image
preset: organization_url_upload
- field_name: is_culturally_sensitive
label: Is culturally sensitive?
required: true
default: non-sensitive
preset: radio
choices:
- value: non-sensitive
label: "No"
- value: sensitive
label: "Yes"
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,21 @@
{{ form.input('collection_short_name', label=short_name_label, id='field-collection_short_name',
value=data.collection_short_name, error=errors.collection_short_name, classes=['control-medium'],
is_required=true) }}


{{ form.input('related_dataset_title', label='Related Dataset Title', id='field-related_dataset_title',
value=data.related_dataset_title, error=errors.related_dataset_title, classes=['control-medium'],
is_required=true) }}

{{ form.input('related_dataset_url', label='Related Dataset URL', id='field-related_dataset_url',
value=data.related_dataset_url, error=errors.related_dataset_url, classes=['control-medium'],
is_required=true) }}

{{ form.input('is_culturally_sensitive', label='Is culturally sensitive?', id='field-is_culturally_sensitive',
value=data.is_culturally_sensitive, error=errors.is_culturally_sensitive,
is_required=true) }}

{{ form.textarea('description', label=description_label, id='field-description',
value=data.description, error=errors.description,
placeholder=_('Brief description?'), is_required=true) }}
placeholder=_('Brief description'), is_required=true) }}

{% endblock %}
22 changes: 18 additions & 4 deletions ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,23 +812,33 @@ def generate_new_collection_email_body(request):
'email': request.values.get('email'),
'collection_full_name': request.values.get('collection_full_name'),
'collection_short_name': request.values.get('collection_short_name'),
'is_culturally_sensitive': request.values.get('is_culturally_sensitive'),
'related_dataset_title': request.values.get('related_dataset_title'),
'related_dataset_url': request.values.get('related_dataset_url'),
'description': request.values.get('description')
}
email_body_template = """
Hello,
Dear AuScope Sample Repository admin,
A new collection request has been submitted. Here are the details:
A new collection request has been submitted. Below are the details of the request:
Contact Name: {{ data.name }}
Contact Email: {{ data.email }}
Collection Details:
- Full Name: {{ data.collection_full_name }}
- Short Name: {{ data.collection_short_name }}
- Culturally Sensitive: {{ data.is_culturally_sensitive}}
- Related Dataset Title: {{ data.related_dataset_title }}
- Related Dataset URL: {{ data.related_dataset_url }}
Description of the Collection:
{{ data.description }}
Please take the necessary steps to process this request.
Thank you.
"""
return render_template_string(email_body_template, data=data)

Expand All @@ -842,9 +852,9 @@ def generate_join_collection_email_body(request,org_id,org_name):
}

email_body_template = """
Hello,
Dear AuScope Sample Repository admin,
You have received a new request to join the collection. Below are the details of the request:
A new request to join the collection has been submitted. Below are the details of the request:
Contact Name: {{ data.name }}
Contact Email: {{ data.email }}
Expand All @@ -856,6 +866,10 @@ def generate_join_collection_email_body(request,org_id,org_name):
- Collection ID: {{ data.collection_id }}
- Collection Name: {{ data.collection_name }}
Please take the necessary steps to process this request.
Thank you.
"""
return render_template_string(email_body_template, data=data)

Expand Down

0 comments on commit ed346b8

Please sign in to comment.