Revision 51b0ca27 ui/static/synnefo.js
b/ui/static/synnefo.js | ||
---|---|---|
2589 | 2589 |
|
2590 | 2590 |
|
2591 | 2591 |
function show_invitations() { |
2592 |
|
|
2593 |
function display_resend_success(msg) { |
|
2594 |
clear_resend_messages(); |
|
2595 |
$("#invsent .message.success").text(msg).show(); |
|
2596 |
} |
|
2597 |
|
|
2598 |
function display_resend_error(msg) { |
|
2599 |
clear_resend_messages(); |
|
2600 |
$("#invsent .message.errormsg").text(msg).show(); |
|
2601 |
} |
|
2602 |
|
|
2603 |
// clear resent messages |
|
2604 |
function clear_resend_messages() { |
|
2605 |
$("#invsent .message").hide(); |
|
2606 |
} |
|
2607 |
|
|
2608 |
// register resent click handlers |
|
2609 |
function register_invitation_resends() { |
|
2610 |
$(".invitations .resend-invitation").click(function() { |
|
2611 |
var invid = $(this).attr("id"); |
|
2612 |
|
|
2613 |
if (invid == null) |
|
2614 |
return; |
|
2615 |
|
|
2616 |
var id = invid.split("-")[1]; |
|
2617 |
|
|
2618 |
if (id == null) |
|
2619 |
return; |
|
2620 |
|
|
2621 |
var child = $(this).find("img"); |
|
2622 |
child.attr('src', '/static/progress-tiny.gif'); |
|
2623 |
|
|
2624 |
$.ajax({ |
|
2625 |
type: "POST", |
|
2626 |
url : "/invitations/resend", |
|
2627 |
data : {invid : id}, |
|
2628 |
success: function(msg) { |
|
2629 |
display_resend_success("Invitation has been resent"); |
|
2630 |
child.attr('src', '/static/resend.png'); |
|
2631 |
}, |
|
2632 |
error : function(xhr, status, error) { |
|
2633 |
display_resend_error("Something seems to have gone wrong. " + |
|
2634 |
"Please try again in a few minutes."); |
|
2635 |
child.attr('src', '/static/resend.png'); |
|
2636 |
} |
|
2637 |
}); |
|
2638 |
}); |
|
2639 |
} |
|
2592 | 2640 |
|
2593 | 2641 |
handle_invitations = function(el) { |
2594 | 2642 |
|
... | ... | |
2613 | 2661 |
|
2614 | 2662 |
// we copy/paste it on the title no need to show it twice |
2615 | 2663 |
$(".invitations-left").hide(); |
2664 |
|
|
2665 |
// sending finished or first invitations view |
|
2666 |
$(".invitations .sending").hide(); |
|
2667 |
$(".invitations .submit").show(); |
|
2668 |
$(".invitations #fieldheaders").show(); |
|
2669 |
$(".invitations #fields").show(); |
|
2616 | 2670 |
|
2617 | 2671 |
// reset title |
2618 | 2672 |
$("#notification-box .header-box").html(""); |
2619 | 2673 |
$("#notification-box .header-box").html(window.INVITATIONS_TITLE + " " + $($(".invitations-left")[0]).text()); |
2674 |
|
|
2675 |
// resend buttons |
|
2676 |
register_invitation_resends(); |
|
2677 |
clear_resend_messages(); |
|
2620 | 2678 |
|
2621 | 2679 |
// handle form submit |
2622 | 2680 |
form.submit(function(evn){ |
2623 | 2681 |
evn.preventDefault(); |
2682 |
|
|
2683 |
// sending... |
|
2684 |
$(".invitations .sending").show(); |
|
2685 |
$(".invitations .submit").hide(); |
|
2686 |
$(".invitations #fieldheaders").hide(); |
|
2687 |
$(".invitations #fields").hide(); |
|
2624 | 2688 |
|
2625 | 2689 |
// do the post |
2626 | 2690 |
$.post(form.attr("action"), form.serialize(), function(data) { |
Also available in: Unified diff