Class: PandaCms::FormSubmissionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PandaCms::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
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/panda_cms/form_submissions_controller.rb', line 3 def create vars = params.except(:authenticity_token, :controller, :action, :id) form = PandaCms::Form.find(params[:id]) form_submission = PandaCms::FormSubmission.create(form_id: params[:id], data: vars.to_unsafe_h) form.update(submission_count: form.submission_count + 1) PandaCms::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 |