diff options
author | Valery Sizov <vsv2711@gmail.com> | 2012-01-07 14:53:01 +0400 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2012-01-07 14:53:01 +0400 |
commit | 97e74c5bde3269d4760b55971e7c06b42679f422 (patch) | |
tree | 507e83bb31b6b340b80300cb9a83b383115e68c9 /app/views/projects/new.html.haml | |
parent | dae9cd2af62ed857f8a4b1a3ae65972fb685659f (diff) |
Auto-populate the path and code on the name input's onchange event to the sluggified version of name
Diffstat (limited to 'app/views/projects/new.html.haml')
-rw-r--r-- | app/views/projects/new.html.haml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 1678ba5d940..02ddc683851 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -8,3 +8,16 @@ %div.clear = render 'form' + +:javascript + $(function(){ + $("#project_name").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(); + } |