/**
 * Created by nkmathew on 23/06/2016.
 */

$(document).ready(function () {
    var source   = $("#email-list-template").html();
    var template = Handlebars.compile(source);

    var html = template({email: 'ngetich.kipkoech@students.jkuat.ac.ke'});
    $('#email-list-section').append(html);

    $("#email-input-box").keyup(function (e) {
        if (e.keyCode == 13) {
            var email = $('#email-input-box').val() + '@students.jkuat.ac.ke';
            var html = template({email: email});
            $('#email-list-section').append(html);

            $('.email-delete-btn').click(function () {
                $(this).closest('.email-line').remove();
            })
        }
    });

});

@@ -476,32 +476,33 @@
        var html 
+ 
 = template(%7Bemai
@@ -700,30 +700,575 @@
   %7D)
-%0D%0A        %7D%0D%0A    %7D);%0D%0A
+;%0D%0A            $(this).val('');%0D%0A        %7D%0D%0A    %7D);%0D%0A%0D%0A    $(%22#invite-button%22).click(function () %7B%0D%0A        var emailList = %5B%5D;%0D%0A        $('.email-address').each(function () %7B%0D%0A            emailList.push($(this).html());%0D%0A        %7D);%0D%0A        $.ajax(%7B%0D%0A            type: 'POST',%0D%0A            url: '/site/send-signup-links',%0D%0A            data: %7B%0D%0A                'email-list': JSON.stringify(emailList),%0D%0A            %7D,%0D%0A            error: function (msg) %7B%0D%0A                alert('Problem occurred while trying to send email...');%0D%0A            %7D,%0D%0A        %7D);%0D%0A    %7D);
 %0D%0A%7D)

Add ajax call for sending signup links