Revision 4c49c72b
b/invitations/templates/invitations.html | ||
---|---|---|
5 | 5 |
{{ left }} invitations left |
6 | 6 |
{% endblocktrans %})</div> |
7 | 7 |
|
8 |
{% if invitations_left > 0 %} |
|
8 | 9 |
<form action="/invitations/" method="post" id="invform"> |
9 | 10 |
{% csrf_token %} |
10 | 11 |
|
... | ... | |
34 | 35 |
</div> |
35 | 36 |
<p><input class="submit" type="submit" value="{% trans "Send invitations" %}" /></p> |
36 | 37 |
</form> |
38 |
{% else %} |
|
39 |
|
|
40 |
<div class="no-invitations-left"> |
|
41 |
<p> |
|
42 |
{% blocktrans %} |
|
43 |
You have no invitations left in your account. |
|
44 |
{% endblocktrans %} |
|
45 |
</p> |
|
46 |
</div> |
|
47 |
{% endif %} |
|
37 | 48 |
|
38 | 49 |
<div id="invsent"> |
39 | 50 |
|
b/ui/static/main.css | ||
---|---|---|
3861 | 3861 |
} |
3862 | 3862 |
|
3863 | 3863 |
|
3864 |
.no-invitations-left { |
|
3865 |
margin-bottom: 20px; |
|
3866 |
color: #E44848; |
|
3867 |
} |
|
3868 |
|
|
3864 | 3869 |
.invitations #field_name_name, .invitations #field_email_name { |
3865 | 3870 |
float: left; |
3866 | 3871 |
display: block; |
b/ui/static/synnefo.js | ||
---|---|---|
2337 | 2337 |
function show_invitations() { |
2338 | 2338 |
|
2339 | 2339 |
handle_invitations = function(el) { |
2340 |
|
|
2341 |
// proper class to identify the overlay block |
|
2340 | 2342 |
el.addClass("invitations"); |
2343 |
|
|
2341 | 2344 |
var cont = el; |
2342 | 2345 |
var form = $(el).find("form"); |
2343 | 2346 |
|
2344 | 2347 |
// remove garbage rows that stay in DOM between requests |
2345 | 2348 |
$(".removable-field-row:hidden").remove(); |
2346 | 2349 |
|
2350 |
// avoid buggy behaviour, close all overlays if something went wrong |
|
2347 | 2351 |
try { |
2348 |
$("#invform #removable-name-container-1").dynamicField(); |
|
2352 |
// form is in content (form is not displayed if user has no invitations) |
|
2353 |
if ($("#invform #removable-name-container-1").length) { |
|
2354 |
$("#invform #removable-name-container-1").dynamicField(); |
|
2355 |
} |
|
2349 | 2356 |
} catch (err) { |
2350 | 2357 |
close_all_overlays(); |
2351 | 2358 |
} |
2352 | 2359 |
|
2360 |
// we copy/paste it on the title no need to show it twice |
|
2353 | 2361 |
$(".invitations-left").hide(); |
2362 |
|
|
2363 |
// reset title |
|
2354 | 2364 |
$("#notification-box .header-box").html(""); |
2355 | 2365 |
$("#notification-box .header-box").html(window.INVITATIONS_TITLE + " " + $($(".invitations-left")[0]).text()); |
2356 | 2366 |
|
2367 |
// handle form submit |
|
2357 | 2368 |
form.submit(function(evn){ |
2358 | 2369 |
evn.preventDefault(); |
2370 |
|
|
2371 |
// do the post |
|
2359 | 2372 |
$.post(form.attr("action"), form.serialize(), function(data) { |
2373 |
// replace data |
|
2360 | 2374 |
$(cont).html(data); |
2375 |
|
|
2376 |
// append all handlers again (new html data need to redo all changes) |
|
2361 | 2377 |
handle_invitations(cont); |
2362 | 2378 |
}); |
2379 |
|
|
2363 | 2380 |
return false; |
2364 | 2381 |
}); |
2365 | 2382 |
} |
2366 |
|
|
2383 |
|
|
2384 |
// first time clicked (show the msg box with /invitations content) |
|
2367 | 2385 |
msg_box({title:window.INVITATIONS_TITLE, content:'', ajax:INVITATIONS_URL, html:true, success: function(el){ |
2368 | 2386 |
handle_invitations(el)} |
2369 | 2387 |
}); |
Also available in: Unified diff