Skip to content

Commit

Permalink
#4238 fixing redirect after successful request
Browse files Browse the repository at this point in the history
- adapting label to specify protocol is needed
- small fixes
  • Loading branch information
alexandru-m-g committed Jun 24, 2016
1 parent d1170d0 commit 5798e6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -90,18 +93,18 @@ 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()
self._validate_new_org_request_field(data)

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:
Expand All @@ -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'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ <h1 class="h1-title uppercase">
{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-organisation'), value=data.name, error=errors.name, attrs=attrs) }}
</div>
<div class="org-control-container">
{% 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']) }}
<div class="org-control-info info-field">
<div class="org-info-label">{{_('Where can people go to find more about this organisation?')}}</div>
</div>
Expand Down

0 comments on commit 5798e6d

Please sign in to comment.