gateway/app/controllers/cms/sections_controller.rb

25 lines
556 B
Ruby
Raw Normal View History

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
end
end