<div class="form register-form">
    <h4 class="login-logo">Register with app store</h4>
        <div class="form-block option-block">
            <div class="form-list clearfix">
                <form class="form-horizontal" action="<%= admin_site_registration_register_path %>" data-remote="true">
                    <div class="control-group clear">
                        <label class="control-label">Site name: </label>
                        <div class="controls">
                            <label class="control-label muted"><%= @site.title %></label>
                        </div>
                        <input type="hidden" name="site[name]" value="<%= @site.title %>" />
                    </div>
                    <div class="control-group clear">
                        <label class="control-label">Site id: </label>
                        <div class="controls">
                            <label class="control-label muted"><%= @site.id.to_s %></label>
                        </div>
                        <input type="hidden" name="site[id]" value="<%= @site.id.to_s %>" />
                    </div>
                     <div class="control-group clear">
                        <label class="control-label">Site url: </label>
                        <div class="controls">
                            <label class="control-label muted"><%= request.protocol + request.host %></label>
                        </div>
                        <input type="hidden" name="site[url]" value="<%= request.protocol + request.host %>" />
                    </div>
                     <div class="control-group clear">
                        <label class="control-label">University name: </label>
                        <div class="controls">
                            <input type="text" name="site[university]" />
                        </div>
                    </div>
                    <div class="control-group clear">
                        <label class="control-label">Department name: </label>
                        <div class="controls">
                            <input type="text" name="site[department]" />
                        </div>
                    </div>
                    <div class="control-group clear">
                        <label class="control-label">Admin email: </label>
                        <div class="controls">
                            <input type="text" name="site[email]" />
                        </div>
                    </div>
                    <div class="control-group clear">
                        <label class="control-label">Country name: </label>
                        <div class="controls">
                            <select id="country_list" name="site[country]"></select>
                        </div>
                    </div>
                    <div class="pull-right">
                        <input type="submit" class="btn btn-primary" value="Register"/>
                    </div>
                </form>
            </div>
        </div>
</div>
<style type="text/css">
    .register-form{
        width:500px; 
        margin:auto; 
        border-width:1px; 
        border-style:dashed; 
        padding:5px; 
        border-color:#d7d7d7;
    }
</style>
<script type="text/javascript">
(function() {
    var country_list = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua &amp; Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia &amp; Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada", "Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cruise Ship","Cuba","Curaçao","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kuwait","Kyrgyz Republic","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Mauritania","Mauritius","Mexico","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Namibia","Nepal","Netherlands","Netherlands Antilles","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russia","Rwanda","Saint Pierre &amp; Miquelon","Samoa","San Marino","Satellite","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","South Africa","South Korea","Spain","Sri Lanka","St Kitts &amp; Nevis","St Lucia","St Vincent","St. Lucia","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor L'Este","Togo","Tonga","Trinidad &amp; Tobago","Tunisia","Turkey","Turkmenistan","Turks &amp; Caicos","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States", "Uruguay","Uzbekistan","Venezuela","Vietnam","Virgin Islands (US)","Yemen","Zambia","Zimbabwe"];

    var cl = $("#country_list");
    cl.html("<option value=''>Select a country</option>");
    $.each(country_list,function(i,country){
        cl.append("<option value='" + country + "'>" + country + "</option>");
    })
     $("form").submit(function(){
        $(this).find("input[type=submit]").removeClass("btn-primary").addClass("btn-info").attr("disabled","disabled").val("Registering...");
     })
    $("form").on("ajax:complete",function(res,data){
        $(this).find("input[type=submit]").removeClass("btn-info").addClass("btn-success").attr("disabled","disabled").val("Registered");
        window.location.reload();
    });
   
})();
</script>