On Tue, May 26, 2020 at 1:32 AM Craig Russell <apache....@gmail.com> wrote: > > But calling preventDefault on the event doesn't appear to do anything. It > still calls the POST behavior, and does not cause the inline edit menu to > disappear. And setting the edit function to nil doesn't do anything either. > > Maybe there is something else that I need to do?
I'll admit that I'm not clear on what you are trying to accomplish, but apparently the problem here is that there is another piece of code that attaches an event handler (and calls preventDefault): https://github.com/apache/whimsy/blob/d3246f107a35f4d989350f4c1ca64366c98ef423/www/roster/views/person/main.js.rb#L341 Perhaps it would be best to add an attribute to the button, and have the submit method remove the buttons and exit early: diff --git a/www/roster/views/person/main.js.rb b/www/roster/views/person/main.js.rb index 1b5ffdb8..f498489f 100644 --- a/www/roster/views/person/main.js.rb +++ b/www/roster/views/person/main.js.rb @@ -355,6 +355,12 @@ class Person < Vue form = jQuery(event.currentTarget).closest('form') target = event.target + # if button is a cancel button, don't submit and remove buttons + if target.getAttribute('data-cancel') + @edit = null + return + end + # serialize form formData = form.serializeArray(); diff --git a/www/roster/views/person/memstat.js.rb b/www/roster/views/person/memstat.js.rb index 39367c40..e8d3d318 100644 --- a/www/roster/views/person/memstat.js.rb +++ b/www/roster/views/person/memstat.js.rb @@ -35,6 +35,8 @@ class PersonMemberStatus < Vue _button.btn.btn_primary 'move to emeritus', name: 'action', value: 'emeritus' end + + _button.btn.btn_secondary 'cancel', data_cancel: true end end end - Sam Ruby