Class: PandaCms::Admin::FormsController
- Inherits:
-
PandaCms::ApplicationController
- Object
- ActionController::Base
- PandaCms::ApplicationController
- PandaCms::Admin::FormsController
- Defined in:
- app/controllers/panda_cms/admin/forms_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
Lists all forms.
- #show ⇒ Object
Methods inherited from PandaCms::ApplicationController
#add_breadcrumb, #authenticate_admin_user!, #authenticate_user!, #breadcrumbs, #current_user, #set_current_request_details, #user_signed_in?
Methods included from PandaCms::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
#index ⇒ Object
Lists all forms
13 14 15 16 |
# File 'app/controllers/panda_cms/admin/forms_controller.rb', line 13 def index forms = PandaCms::Form.order(:name) render :index, locals: {forms: forms} end |
#show ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/panda_cms/admin/forms_controller.rb', line 18 def show form = PandaCms::Form.find(params[:id]) form.name, admin_form_path(form) submissions = form.form_submissions.order(created_at: :desc) # TODO: Set a whitelist of fields we allow to be submitted for the form, shown in this view # and a formatting array of how to display them... eventually? fields = if submissions.last submissions.last.data.keys.reverse.map { |field| [field, field.titleize] } else [] end render :show, locals: {form: form, submissions: submissions, fields: fields} end |