Js refactoring and ajax animation replaced

This commit is contained in:
Dmitriy Zaporozhets 2012-03-26 21:41:58 +03:00
parent f1c534c68e
commit 7d56a51bdc
14 changed files with 41 additions and 54 deletions

View file

@ -1,29 +1,12 @@
= render "project_head"
%h3 Edit Project
%hr
= render "projects/form"
%div{ :class => "ajax_loader", :style => "display:none;height:200px;"}
.project_edit_holder
%h3 Edit Project
%hr
= render "projects/form"
%div.ajax_loader.hide
%center
= image_tag "ajax-loader.gif", :class => "append-bottom"
%div.padded= image_tag "ajax_loader.gif"
%h3.prepend-top Saving project & repository. Please wait...
:javascript
$(function(){
$("#project_name").live("change", function(){
var slug = slugify($(this).val());
$("#project_code").val(slug);
$("#project_path").val(slug);
});
});
function slugify(text) {
return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase();
}
$(function(){
$('.edit_project').live('ajax:before', function() {
$(this).hide();
$('.ajax_loader').show();
});
$('form #project_default_branch').chosen();
})
$(function(){ new Projects(); });