Class: Panda::CMS::FormSubmissionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Panda::CMS::FormSubmissionsController
- Defined in:
- app/controllers/panda/cms/form_submissions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#add_breadcrumb, #authenticate_admin_user!, #authenticate_user!, #breadcrumbs, #current_user, #set_current_request_details, #user_signed_in?
Methods included from ApplicationHelper
#active_link?, #block_link_to, #component, #level_indent, #menu_indent, #nav_class, #nav_highlight_colour_classes, #panda_cms_editor, #panda_cms_form_with, #selected_nav_highlight_colour_classes, #table_indent, #title_tag
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/panda/cms/form_submissions_controller.rb', line 8 def create vars = params.except(:authenticity_token, :controller, :action, :id) form = Panda::CMS::Form.find(params[:id]) form_submission = Panda::CMS::FormSubmission.create(form_id: params[:id], data: vars.to_unsafe_h) form.update(submission_count: form.submission_count + 1) Panda::CMS::FormMailer.notification_email(form: form, form_submission: form_submission).deliver_now if (completion_path = form&.completion_path) redirect_to completion_path else # TODO: This isn't a great fallback, we should do something nice here... # Perhaps a simple JS alert when sent? redirect_to "/" end end |