Skip to content

Commit

Permalink
Fixed hhu theme to be compatible with latest liqd build (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
carschroeder committed Nov 21, 2013
1 parent d588af3 commit 28cf3f4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
8 changes: 1 addition & 7 deletions adhocracy_client/static/javascripts/adhocracy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,7 @@ var adhocracy = adhocracy || {};
if (val === undefined) {
return undefined;
}
var separator;
if (val.indexOf('?') !== -1) {
separator = '&';
} else {
separator = '?';
}
return val + separator + 'came_from=' + encodeURIComponent(came_from);
return new Uri(val).replaceQueryParam('came_from', came_from).toString();
};
this.getOverlay().find('.patch_camefrom').attr({
'action': patch_camefrom,
Expand Down
4 changes: 4 additions & 0 deletions adhocracy_client/templates/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,7 @@
</select>

</%def>

## Makes sure the rebindCameFrom javascript function is only called if the patched target wouldn't also lead to a 403.
## If the rebindCameFrom function isn't called, we usually (in these cases) redirect to the page we came from.
<%def name="add_patch_camefrom_class()">${u'' if c.instance and c.instance.require_valid_email else u'patch_camefrom'}</%def>
2 changes: 1 addition & 1 deletion adhocracy_client/templates/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<p class="patch_description">
${_('Join this instance to start contributing.')}
</p>
<a class="button patch_camefrom" href="${h.entity_url(c.instance, member='join')}?${h.url_token()}">${_("join")}</a>
<a class="button ${components.add_patch_camefrom_class()}" href="${h.entity_url(c.instance, member='join')}?${h.url_token()}">${_("join")}</a>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions adhocracy_client/templates/user/login_form.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%namespace name="components" file="/components.html"/>
<%
login_types = h.allowed_login_types()
if 'username+password' in login_types and 'email+password' in login_types:
Expand All @@ -12,7 +13,7 @@
field_type = 'email'
%>
<div class="form_wrapper">
<form method="POST" action="/perform_login${h.camefrom_querystring()}" class="patch_camefrom login_form">
<form method="POST" action="${h.get_redirect_url(u'perform_login')}" class="${components.add_patch_camefrom_class()} login_form">
<div class="input_wrapper">
<label>${field_title}
<input type="${field_type}" name="login" autofocus="autofocus" />
Expand All @@ -28,7 +29,7 @@
<input type="submit" value="${_('Login')}" />
%if h.allow_user_registration():
${_("or")}
<a href="/register${h.camefrom_querystring()}" class="icon_link more_uppercase patch_camefrom">
<a href="${h.register_redirect_url()}" class="more_uppercase ${components.add_patch_camefrom_class()}">
${_("Register new account")|n}</a>
%endif
</div>
Expand Down
3 changes: 2 additions & 1 deletion adhocracy_client/templates/user/login_form_alternate.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%namespace name="components" file="/components.html"/>
<%
login_titleandtype = h.allowed_login_types()
if 'email+password' in login_titleandtype:
Expand All @@ -12,7 +13,7 @@
field_title = _('My user name:')
field_type = 'text'
%>
<form class="login-alternate patch_camefrom login_form" method="POST" action="/perform_login${h.camefrom_querystring()}">
<form class="login-alternate ${components.add_patch_camefrom_class()} login_form" method="POST" action="${h.get_redirect_url(u'perform_login')}">
${h.field_token()|n}

<form:error name="login"></form:error>
Expand Down
2 changes: 1 addition & 1 deletion adhocracy_client/templates/user/register_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form_wrapper">
<form name="create_user" method="POST" action="/user${h.camefrom_querystring()}">
<form name="create_user" method="POST" action="${h.get_redirect_url(u'user')}">
${h.field_token()|n}

<fieldset>
Expand Down

0 comments on commit 28cf3f4

Please sign in to comment.