Skip to content

Commit

Permalink
Add wrapped _whimsy_forms_submit method and improve help text
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneCurcuru committed Jan 31, 2025
1 parent 2ab8391 commit 2e12769
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/whimsy/asf/forms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _whimsy_control_wrapper(**args)
_div.col_sm_9 do
_div! class: "input-group #{args[:groupclass]}" do
yield
_whimsy_forms_iconlink(**args)
_whimsy_forms_iconlink(**args) unless args[:noicon]
end
if args[:helptext]
_span.help_block id: args[:aria_describedby] do
Expand Down Expand Up @@ -186,6 +186,15 @@ def _whimsy_forms_submit(value: 'submit')
end
end

def _whimsy_forms_submitwrap(**args)
_whimsy_control_wrapper(**args) do
args[:class] = 'form-control'
args[:aria_describedby] = "#{args[:name]}_help" if args[:helptext]
_input.btn.btn_default.col_sm_3 type: 'submit', name: args[:name], id: args[:id], value: args[:value], class: args[:class],
aria_describedby: args[:aria_describedby]
end
end

# Gather POST form data into submission Hash
# @returns {field: 'string', field2: ['array', 'only for', 'multivalue'] ...}
def _whimsy_params2formdata(params)
Expand Down
4 changes: 3 additions & 1 deletion www/members/nominate_board.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def emit_form(title, prev_data)
_whimsy_forms_input(label: 'Nomination Statement', name: field, rows: 10,
value: prev_data[field], helptext: 'Explain why you believe this person would be a good Director'
)
_whimsy_forms_submit
_whimsy_forms_submitwrap(
noicon: true, label: 'submit', name: 'submit', value: 'submit', helptext: 'Checkin this nomination and send email to members@'
)
end
end
end
Expand Down

0 comments on commit 2e12769

Please sign in to comment.