rosa-build/app/assets/javascripts/extra/mass_build.js

30 lines
868 B
JavaScript
Raw Normal View History

2012-12-11 14:03:55 +00:00
$(document).ready(function() {
var projects_list = $('.form.mass_build #projects_list');
2012-12-12 11:05:02 +00:00
var repositories = $(".form.mass_build .left input:checkbox");
2012-12-11 14:03:55 +00:00
repositories.click(function(){
if (this.checked){
$(this).attr('disabled',true);
$.ajax({
type: 'GET',
url: $(this).attr('href'),
success: function(data){
var text = projects_list.val();
if(text.length > 0 && text.slice(-1) != '\n') {text = text + "\n"}
projects_list.val(text+data);
},
error: function(data){
alert('Error :(') // TODO remove
}
});
}
return true;
});
projects_list.keyup(function(){
if($(this).val().length == 0) {
repositories.attr('disabled',false)
.attr('checked', false);
}
});
});