diff options
| author | gitlabhq <m@gitlabhq.com> | 2011-10-17 20:05:47 +0300 |
|---|---|---|
| committer | gitlabhq <m@gitlabhq.com> | 2011-10-17 20:05:47 +0300 |
| commit | 2daa6161fd08e18bdf7f1ad0f30a83a58226543e (patch) | |
| tree | 2056331781844770a9db6ed6eb2d23a1140e0a3e | |
| parent | 74a89d9ed6e79d6172ac2638a334bb31b9fea7da (diff) | |
| download | gitlab-ce-2daa6161fd08e18bdf7f1ad0f30a83a58226543e.tar.gz | |
prevent double note submit
| -rw-r--r-- | app/views/notes/_form.html.haml | 2 | ||||
| -rw-r--r-- | app/views/notes/_notes.html.haml | 9 | ||||
| -rw-r--r-- | app/views/notes/create.js.haml | 3 |
3 files changed, 13 insertions, 1 deletions
diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml index ccb159f128c..8eaf968c803 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/notes/_form.html.haml @@ -25,4 +25,4 @@ .clear %br - = f.submit 'Add note', :class => "lbutton vm" + = f.submit 'Add note', :class => "lbutton vm", :id => "submit_note" diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml index 040c2f28053..c93a47239fb 100644 --- a/app/views/notes/_notes.html.haml +++ b/app/views/notes/_notes.html.haml @@ -9,6 +9,15 @@ $('.delete-note').live('ajax:success', function() { $(this).closest('li').fadeOut(); }); + $("#new_note").live("ajax:before", function(){ + $("#submit_note").attr("disabled", "disabled"); + }) + + $("#new_note").live("ajax:complete", function(){ + $("#submit_note").removeAttr("disabled"); + }) + + - if ["issues", "projects"].include?(controller.controller_name) :javascript $(function(){ diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml index 47cff1d8834..0af548ff855 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/notes/create.js.haml @@ -6,3 +6,6 @@ - else :plain $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); + +:plain + $("#submit_note").removeAttr("disabled"); |
