fix #1155 where editing a note on the notes page submits the wrong form

This commit is contained in:
Reinier Balt 2011-04-29 18:26:27 +02:00
parent 3d3747cb45
commit 106f966965
2 changed files with 6 additions and 5 deletions

View file

@ -1,8 +1,9 @@
<% <%
submit_text ||= t('common.update') submit_text ||= t('common.update')
note = note_edit_form
form_for(note_edit_form, :html => { form_for(note, :html => {
:id => dom_id(note_edit_form, 'edit_form'), :id => dom_id(note, 'edit_form'),
:class => "inline-form edit-note-form"}) do |f| :class => "inline-form edit-note-form"}) do |f|
-%> -%>
@ -13,11 +14,11 @@ form_for(note_edit_form, :html => {
<div class="submit_box"> <div class="submit_box">
<div class="widgets"> <div class="widgets">
<button type="submit" class="positive" id="<%= dom_id(note_edit_form, 'submit') %>" tabindex="15"> <button type="submit" class="positive" id="<%= dom_id(note, 'submit') %>" tabindex="15">
<%=image_tag("accept.png", :alt => "") %> <%=image_tag("accept.png", :alt => "") %>
<%= submit_text %> <%= submit_text %>
</button> </button>
<a href="" class="negative" id="neg_<%=dom_id(note_edit_form, 'edit_form')%>"> <a href="" class="negative" id="neg_<%=dom_id(note, 'edit_form')%>">
<%=image_tag("cancel.png", :alt => "") %> <%=image_tag("cancel.png", :alt => "") %>
<%= t 'common.cancel' %> <%= t 'common.cancel' %>
</a> </a>

View file

@ -898,7 +898,7 @@ var NotesPage = {
/* update button when editing a note */ /* update button when editing a note */
$("form.edit-note-form button.positive").live('click', function (ev) { $("form.edit-note-form button.positive").live('click', function (ev) {
submit_with_ajax_and_block_element('form.edit-note-form', $(this)); submit_with_ajax_and_block_element($(this).parents('form.edit-note-form'), $(this));
return false; return false;
}); });
} }