Class: Plugins::ContactForm::FrontController

Inherits:
CamaleonCms::Apps::PluginsFrontController
  • Object
show all
Defined in:
app/apps/plugins/contact_form/front_controller.rb

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Method Summary collapse

Instance Method Details

#indexObject


12
13
14
# File 'app/apps/plugins/contact_form/front_controller.rb', line 12

def index
  # here your actions for frontend module
end

#save_formObject

here add your custom functions


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/apps/plugins/contact_form/front_controller.rb', line 17

def save_form
  @form = current_site.contact_forms.find_by_id(params[:id])
  values = JSON.parse(@form.value).to_sym
  settings = JSON.parse(@form.settings).to_sym
  fields = params[:fields]
  errors = []
  success = []

  perform_save_form(@form, values, fields, settings, success, errors)
  if success.present?
    flash[:notice] = success.join('<br>')
  else
    flash[:error] = errors.join('<br>')
    flash[:values] = fields
  end

  redirect_to :back
end