gitlab-org--gitlab-foss/app/views/shared/_recaptcha_form.html.haml
Stan Hu b8f5a7d5e9 Fix 404 error after a user edits an issue description and solves the reCAPTCHA
When editing an issue, use the PUT method instead of POST to avoid
a 404 after solving the reCAPTCHA.

Closes #41445
2017-12-30 06:14:23 -08:00

20 lines
881 B
Text

- resource_name = spammable.class.model_name.singular
- humanized_resource_name = spammable.class.model_name.human.downcase
- script = local_assigns.fetch(:script, true)
- method = params[:action] == 'create' ? :post : :put
- has_submit = local_assigns.fetch(:has_submit, true)
= form_for resource_name, method: method, html: { class: 'recaptcha-form js-recaptcha-form' } do |f|
.recaptcha
- params[resource_name].each do |field, value|
= hidden_field(resource_name, field, value: value)
= hidden_field_tag(:spam_log_id, spammable.spam_log.id)
= hidden_field_tag(:recaptcha_verification, true)
= recaptcha_tags script: script, callback: 'recaptchaDialogCallback'
-# Yields a block with given extra params.
= yield
- if has_submit
.row-content-block.footer-block
= f.submit "Submit #{humanized_resource_name}", class: 'btn btn-create'