Commit 26774255 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

use Astakos's external URL to prepend all links

Refs: #2102
parent 6e4c609e
......@@ -107,19 +107,26 @@ def get_menu(request):
if request.method != 'GET':
raise BadRequest('Method not allowed.')
location = request.GET.get('location', '')
index_url = reverse('astakos.im.views.index')
absolute = lambda (url): request.build_absolute_uri(url)
index_url = absolute(reverse('astakos.im.views.index'))
if urlparse(location).query.rfind('next=') == -1:
index_url = '%s?next=%s' % (index_url, quote(location))
l = [{ 'url': index_url, 'name': "login..."}]
if request.user.is_authenticated():
l = []
l.append({ 'url': reverse('astakos.im.views.edit_profile'), 'name': request.user.email})
l.append({ 'url': reverse('astakos.im.views.edit_profile'), 'name': "view your profile..." })
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')),
'name': request.user.email})
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')),
'name': "view your profile..." })
if request.user.password:
l.append({ 'url': reverse('password_change'), 'name': "change your password..." })
l.append({ 'url': absolute(reverse('password_change')),
'name': "change your password..." })
if INVITATIONS_ENABLED:
l.append({ 'url': reverse('astakos.im.views.invite'), 'name': "invite some friends..." })
l.append({ 'url': reverse('astakos.im.views.send_feedback'), 'name': "feedback..." })
l.append({ 'url': reverse('astakos.im.views.logout'), 'name': "logout..."})
l.append({ 'url': absolute(reverse('astakos.im.views.invite')),
'name': "invite some friends..." })
l.append({ 'url': absolute(reverse('astakos.im.views.send_feedback')),
'name': "feedback..." })
l.append({ 'url': absolute(reverse('astakos.im.views.logout')),
'name': "logout..."})
data = json.dumps(tuple(l))
return HttpResponse(content=data, mimetype="application/json")
\ No newline at end of file
......@@ -58,9 +58,11 @@ def cloudbar(request):
CB_LOCATION = getattr(settings, 'CLOUDBAR_LOCATION', IM_STATIC_URL + 'cloudbar/')
CB_COOKIE_NAME = getattr(settings, 'CLOUDBAR_COOKIE_NAME', COOKIE_NAME)
CB_ACTIVE_SERVICE = getattr(settings, 'CLOUDBAR_ACTIVE_SERVICE', 'cloud')
absolute = lambda (url): request.build_absolute_uri(url)
return {'CLOUDBAR_LOC': CB_LOCATION,
'CLOUDBAR_COOKIE_NAME': CB_COOKIE_NAME,
'ACTIVE_SERVICE': CB_ACTIVE_SERVICE,
'GET_SERVICES_URL': reverse('astakos.im.api.get_services'),
'GET_MENU_URL': reverse('astakos.im.api.get_menu')}
'GET_SERVICES_URL': absolute(reverse('astakos.im.api.get_services')),
'GET_MENU_URL': absolute(reverse('astakos.im.api.get_menu'))}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment