Revision 26f1983a
b/invitations/invitations.py | ||
---|---|---|
86 | 86 |
data = render_to_string('invitations.html', |
87 | 87 |
{'invitations': invitations_for_user(request), |
88 | 88 |
'errors': errors, |
89 |
'ajax': True, |
|
90 | 89 |
'invitations_left': get_invitations_left(request.user) |
91 | 90 |
}, |
92 | 91 |
context_instance=RequestContext(request)) |
... | ... | |
94 | 93 |
_logger.warn("Error adding invitation %s -> %s: %s"%(request.user.uniq, |
95 | 94 |
email, errors)) |
96 | 95 |
else: |
97 |
response = HttpResponseRedirect("/invitations/") |
|
96 |
# form submitted |
|
97 |
data = render_to_string('invitations.html', |
|
98 |
{'invitations': invitations_for_user(request), |
|
99 |
'invitations_left': get_invitations_left(request.user) |
|
100 |
}, |
|
101 |
context_instance=RequestContext(request)) |
|
102 |
response = HttpResponse(data) |
|
98 | 103 |
_logger.info("Added invitation %s -> %s"%(request.user.uniq, email)) |
99 | 104 |
|
100 | 105 |
return response |
... | ... | |
134 | 139 |
if request.method == 'GET': |
135 | 140 |
data = render_to_string('invitations.html', |
136 | 141 |
{'invitations': invitations_for_user(request), |
137 |
'ajax': request.is_ajax(), |
|
138 | 142 |
'invitations_left': get_invitations_left(request.user) |
139 | 143 |
}, |
140 | 144 |
context_instance=RequestContext(request)) |
b/invitations/templates/invitations.html | ||
---|---|---|
1 |
{% load i18n %}{% if not ajax %}<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|
2 |
"http://www.w3.org/TR/html4/loose.dtd"> |
|
3 |
<html> |
|
4 |
<head> |
|
5 |
<title>{% trans "Invitations" %}</title> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
{% endif %} |
|
1 |
{% load i18n %} |
|
9 | 2 |
<div class="invitations-left">({% blocktrans count invitations_left as left %} |
10 | 3 |
{{ left }} invitation left |
11 | 4 |
{% plural %} |
12 | 5 |
{{ left }} invitations left |
13 | 6 |
{% endblocktrans %})</div> |
7 |
|
|
14 | 8 |
<form action="/invitations/" method="post" id="invform"> |
15 | 9 |
{% csrf_token %} |
16 | 10 |
|
... | ... | |
58 | 52 |
</ul> |
59 | 53 |
</div> |
60 | 54 |
</div> |
61 |
|
|
62 |
</body> |
|
63 |
</html> |
b/ui/static/invitations.js | ||
---|---|---|
13 | 13 |
;(function($) { |
14 | 14 |
$.fn.dynamicField = function(options) { |
15 | 15 |
if ( $(this).attr("id") == undefined ) { |
16 |
alert("The dynamicField plugin could not be initialized.\n\nPlease check the selector.");
|
|
16 |
throw "The dynamicField plugin could not be initialized.\n\nPlease check the selector.";
|
|
17 | 17 |
return $; |
18 | 18 |
} |
19 | 19 |
|
Also available in: Unified diff