2022-11-26 10:15:56 +01:00
|
|
|
module Cms
|
|
|
|
class SectionsController < CmsController
|
2022-11-26 18:07:20 +01:00
|
|
|
before_action :set_page, only: %i[ show edit update destroy ]
|
|
|
|
|
2022-11-27 16:23:38 +01:00
|
|
|
def update
|
|
|
|
@section.content.each do |key , value|
|
|
|
|
next if key == "id"
|
|
|
|
if(!params[key].nil?)
|
|
|
|
@section.update(key, params[key])
|
|
|
|
puts "updating:#{key}=#{params[key]}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@page.save
|
|
|
|
redirect_to :cms_page_section
|
|
|
|
end
|
2022-11-26 18:07:20 +01:00
|
|
|
|
|
|
|
private
|
|
|
|
def set_page
|
|
|
|
@page = Page.find(params[:page_id])
|
|
|
|
@section = @page.find_section( params[:id] )
|
|
|
|
end
|
|
|
|
|
2022-11-26 10:15:56 +01:00
|
|
|
end
|
|
|
|
end
|