diff --git a/ckanext-hdx_org_group/ckanext/hdx_org_group/controllers/request_controller.py b/ckanext-hdx_org_group/ckanext/hdx_org_group/controllers/request_controller.py index 63afe9a1d3..007db0d125 100644 --- a/ckanext-hdx_org_group/ckanext/hdx_org_group/controllers/request_controller.py +++ b/ckanext-hdx_org_group/ckanext/hdx_org_group/controllers/request_controller.py @@ -3,6 +3,10 @@ @author: Dan, alexandru-m-g ''' + +import logging as logging +import exceptions as exceptions + import ckan.lib.helpers as h import ckan.logic as logic import ckan.lib.base as base @@ -11,8 +15,7 @@ import ckan.lib.base as base import ckanext.hdx_theme.helpers.helpers as hdx_h import ckan.model as model -import logging as logging -import exceptions as exceptions + import ckanext.hdx_theme.util.mail as hdx_mail @@ -90,7 +93,8 @@ def request_new_organization(self): errors = {} error_summary = {} data = {'from': request.params.get('from','')} - from_url = '' + + sent_successfully = False if 'save' in request.params: try: data = self._process_new_org_request() @@ -98,10 +102,9 @@ def request_new_organization(self): tk.get_action('hdx_send_new_org_request')(context, data) - #from_url = data.get('from','') data.clear() h.flash_success(_('Request sent successfully')) - h.redirect_to('user_dashboard_organizations') + sent_successfully = True except hdx_mail.NoRecipientException, e: h.flash_error(_(str(e))) except logic.ValidationError, e: @@ -110,6 +113,8 @@ def request_new_organization(self): except exceptions.Exception, e: log.error(str(e)) h.flash_error(_('Request can not be sent. Contact an administrator')) + if sent_successfully: + h.redirect_to('user_dashboard_organizations') vars = {'data': data, 'errors': errors, 'error_summary': error_summary, 'action': 'new'} diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/request_organization_form.html b/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/request_organization_form.html index 61c9aaf515..ac04f40e8e 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/request_organization_form.html +++ b/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/request_organization_form.html @@ -41,8 +41,8 @@

{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-organisation'), value=data.name, error=errors.name, attrs=attrs) }}
- {% set org_url_value = h.hdx_get_extras_element(data.extras) %} - {{ form.input('org_url', label=_('URL of Organisation'), id='field-org-url', type='url', placeholder=_('http://example.com/about'), value=org_url_value, error=errors.image_url, classes=['control-full','org-control','field-with-info']) }} + {{ form.input('org_url', label=_('URL of Organisation (please include protocol, e.g. "http://")'), id='field-org-url', + type='url', placeholder=_('http://example.com/about'), value=data.org_url, error=errors.org_url, classes=['control-full','org-control','field-with-info']) }}
{{_('Where can people go to find more about this organisation?')}}
diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/snippets/organization_form.html b/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/snippets/organization_form.html index 88a6ae889a..f04b20be04 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/snippets/organization_form.html +++ b/ckanext-hdx_theme/ckanext/hdx_theme/templates/organization/snippets/organization_form.html @@ -27,7 +27,13 @@

{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-organisation'), value=data.name, error=errors.name, attrs=attrs) }}
- {% set org_url_value = h.hdx_get_extras_element(data.extras) %} + + {# + data.get('org_url') contains the url after a validation fail for a new org. + When editing an activity we need to get the url from the org extas + #} + {% set org_url_value = data.get('org_url') if data.get('org_url') else h.hdx_get_extras_element(data.extras) %} + {{ form.input('org_url', label=_('URL of Organisation'), id='field-org-url', type='url', placeholder=_('http://example.com/about'), value=org_url_value, error=errors.image_url, classes=['control-full','org-control','field-with-info']) }}
{{_('Where can people go to find more about this organisation?')}}
diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html index 439fc7f21f..0555dbb834 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html +++ b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html @@ -81,10 +81,12 @@ {% set social_wrapper_div_id = 'social-wrapper-' + res.id %} + {# {% snippet 'indicator/snippets/share_button.html', title=resource_display_name, dataset_social_wrapper=social_wrapper_div_id, dataset_social=social_div_id, target_url=res.url, icon=true, class="btn btn-secondary hdx-btn resource-url-analytics ga-share resource-btn resource-icon-btn", button_id=button_id %} + #} {% endblock %}