Class: GacoCms::Admin::FieldGroupsRendererController

Inherits:
BaseController show all
Defined in:
app/controllers/gaco_cms/admin/field_groups_renderer_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#upload_file

Instance Method Details

#indexObject



8
9
10
11
# File 'app/controllers/gaco_cms/admin/field_groups_renderer_controller.rb', line 8

def index
  @groups = @record.field_groups
  @groups = @record.page_type.field_groups if params[:parent] && @record.is_a?(Page)
end

#render_fieldObject



19
20
21
22
23
# File 'app/controllers/gaco_cms/admin/field_groups_renderer_controller.rb', line 19

def render_field
  field = Field.find(params[:field_id])
  value = field.field_values.new(group_no: params[:group_no])
  render partial: 'field', locals: { value: value }
end

#render_groupObject



13
14
15
16
17
# File 'app/controllers/gaco_cms/admin/field_groups_renderer_controller.rb', line 13

def render_group
  group = FieldGroup.find(params[:group_id])
  locals = { group: group, field_values: FieldValue.none, group_no: Time.current.to_i }
  render partial: 'group', locals: locals
end