Skip to content

Commit

Permalink
[update][l]: consent option updated for access data form
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-sharma12 committed Mar 4, 2024
1 parent 604104b commit 706e989
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ckanext/ubdc/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7131,7 +7131,7 @@ button.close {
overflow: hidden;
}

input[type=checkbox][name=contactConsent]:focus,
input[type=checkbox][name=contact_consent]:focus,
input[type=checkbox][name=consentName]:focus {
outline: 1px solid lightblue;
}
Expand Down
6 changes: 3 additions & 3 deletions ckanext/ubdc/assets/js/access_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ ckan.module("data-service-request-form", function (jQuery) {
// used in the backend.

var consent = this.el.find('input[name="consent"]')
var contactConsent = this.el.find('input[name="contactConsent"]')
var contactConsent = this.el.find('input[name="contact_consent"]')
if (!consent.prop('checked')) {
consent.focus();
this.el.preventDefault()
}

if (!contactConsent.prop('checked')) {
contactConsent.focus();
this.el.preventDefault()
// contactConsent.focus();
// this.el.preventDefault()
}

setTimeout(function () {
Expand Down
1 change: 1 addition & 0 deletions ckanext/ubdc/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ def get_field_to_question(value):
"wish_to_use_data": "Please select all data from the UBDC collections you wish to use.",
"document_url": "Optional supporting documentation upload (PDF or DOC only).",
"created": "Date of submission",
"contact_consent": "Contact Consent",
}
return get_field_to_question.get(value, value)
1 change: 1 addition & 0 deletions ckanext/ubdc/logic/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def request_data_access_create(context, data_dict):
:param funding_information: additional funding information
:param wish_to_use_data: wish to use data
:param supporting_doc: supporting doc file upload
:param newsletter_consent: Consent for Newsletter/Events
"""

if not context.get("for_view", False):
Expand Down
1 change: 1 addition & 0 deletions ckanext/ubdc/logic/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def request_data_access_base_schema():
"funding_information": [ignore_missing, unicode_safe],
"wish_to_use_data": [ignore_missing, list_of_strings],
"document_url": [ignore_missing, unicode_safe],
"contact_consent": [ignore_missing, boolean_validator],
"deleted": [ignore_missing],
}
return schema
Expand Down
1 change: 1 addition & 0 deletions ckanext/ubdc/model/access_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def setup():
Column("document_url", types.UnicodeText),
Column("created", types.DateTime, default=datetime.datetime.utcnow),
Column("updated", types.DateTime, default=datetime.datetime.utcnow),
Column("contact_consent", types.Boolean, default=False),
Column("deleted", types.Boolean, default=False),
)

Expand Down
2 changes: 1 addition & 1 deletion ckanext/ubdc/public/base/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
overflow: hidden;
}

input[type=checkbox][name="contactConsent"]:focus,
input[type=checkbox][name="contact_consent"]:focus,
input[type=checkbox][name="consentName"]:focus {
outline: 1px solid lightblue;
}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/ubdc/templates/access_form/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h2 class="page-heading">
upload_label=_('Optional supporting documentation upload (PDF or DOC only)'),
url_label=_('Optional supporting documentation URL')) }}

{{ form.checkbox('contactConsent', label=_('By ticking this box, I consent to being contacted about events and news from the Urban Big Data Centre'), id='field-event-consent', value="true", attrs={'required': 'true'} ) }}
{{ form.checkbox('contact_consent', label=_('By ticking this box, I consent to being contacted about events and news from the Urban Big Data Centre'), id='field-event-consent', value="true" ) }}
{{ form.checkbox('consent', label=_('By ticking this box, I confirm that I have read the <a
href="https://www.ubdc.ac.uk/privacy-and-cookies/" target="_blank">Privacy Notice</a>'), id='field-consent', value="true", attrs={'required': 'true'} ) }}
<div class="form-actions">
Expand Down
7 changes: 7 additions & 0 deletions ckanext/ubdc/templates/access_form/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h2 class="page-heading">
<th>{{ _('Email') }}</th>
<th>{{ _('Organization ') }}</th>
<th> {{ _('Submitted on') }}</th>
<th> {{ _('Contact Consent') }}</th>
<th></th>
</tr>
</thead>
Expand All @@ -31,6 +32,12 @@ <h2 class="page-heading">
<td>{{ item.email }}</td>
<td>{{ item.organization }}</td>
<td>{{ h.time_ago_from_timestamp(item.created) }}</td>
<td> {% if item.contact_consent is defined and item.contact_consent %}
Yes
{% else %}
No
{% endif %}
</td>
<td>
<a href='{{ url_for("ubdc.access_request_view", id=item.id ) }}' class="btn-success btn-sm">View</a>
<a href='{{ url_for("ubdc.access_request_delete", id=item.id ) }}' class="btn-danger btn-sm" data-module="confirm-action" data-module-content="Are you sure you want to delete this submission?">Delete</a>
Expand Down
10 changes: 5 additions & 5 deletions ckanext/ubdc/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def post(self):
error_msg = tk._("Please accept the terms and conditions.")
tk.h.flash_error(error_msg)
return self.get()

if not asbool(data_dict.get("contactConsent", False)):
error_msg = tk._("Please accept the contact consent.")
tk.h.flash_error(error_msg)
return self.get()
# if not asbool(data_dict.get("contactConsent", False)):
# error_msg = tk._("Please accept the contact consent.")
# tk.h.flash_error(error_msg)
# return self.get()
try:
captcha.check_recaptcha(tk.request)
except captcha.CaptchaError:
Expand Down

0 comments on commit 706e989

Please sign in to comment.