I've implemented the cancel button for the Member status row of the committer
display.
When the (cancel) button is pressed, the canx function is invoked. What I want
to do here is to call dblclick on the div element so the inline form disappears
with no action.
But how can I find the HTMLDivElement to call dblclick on? I cannot find the
relationship between the inline form and the div that contains the dblclick
event.
#
# Render and edit a person's member status
#
class PersonMemberStatus < Vue
def render
committer = @@person.state.committer
owner = @@person.props.auth.id == committer.id
_div.row data_edit: ('memstat' if @@person.props.auth.secretary or owner) do
_div.name 'Member status'
mydiv = this
if committer.member.status
_div.value do
_span committer.member.status
def canx(event)
console.log('canx called from Cancel button')
console.log('event: ' + event + ' mydiv: ' + mydiv)
console.log('preventing default')
event.preventDefault()
console.log('was the default prevented? ' + event.defaultPrevented)
console.log(' mydiv.edit: ' + mydiv.edit)
mydiv.edit = nil
console.log(' mydiv.name: ' + mydiv.name)
console.log(' mydiv.document: ' + mydiv.document)
end
if @@edit == :memstat
opt = { year: 'numeric', month: 'long' } # Suggested date
dod = Date.new.toLocaleDateString('en-US', opt)
_form.inline method: 'post' do
# Cancel this form
_button.btn.btn_primary 'Cancel', onClick: canx
# These actions are only for the person's own use
if (owner)
if committer.member.status.include? 'Active'
if committer.forms['emeritus_request']
_button.btn.btn_primary 'rescind emeritus request',
name: 'action', value: 'rescind_emeritus'
else
_button.btn.btn_primary 'request emeritus status',
name: 'action', value: 'request_emeritus'
end
end
end
# These actions are only for secretary's use
if (@@person.props.auth.secretary)
if committer.member.status.include? 'Active'
_button.btn.btn_primary 'move to emeritus',
name: 'action', value: 'emeritus'
_button.btn.btn_primary 'move to deceased',
name: 'action', value: 'deceased'
_input 'dod', name: 'dod', value: dod
elsif committer.member.status.include? 'Emeritus'
_button.btn.btn_primary 'move to active',
name: 'action', value: 'active'
_button.btn.btn_primary 'move to deceased',
name: 'action', value: 'deceased'
_input 'dod', name: 'dod', value: dod
elsif committer.member.status.include? 'Deceased'
_button.btn.btn_primary 'move to active',
name: 'action', value: 'active'
_button.btn.btn_primary 'move to emeritus',
name: 'action', value: 'emeritus'
end
end
end
end
end
end
end
end
end
Craig L Russell
[email protected]