section template selection
This commit is contained in:
@ -1,10 +1,14 @@
|
||||
module Merged
|
||||
class SectionsController < MergedController
|
||||
before_action :set_page, only: %i[ show edit update destroy set_image select_image]
|
||||
before_action :set_page
|
||||
#, only: %i[ show edit update destroy set_image select_image]
|
||||
|
||||
def select_image
|
||||
@images = Image.all
|
||||
end
|
||||
def select_template
|
||||
@sections = Style.sections
|
||||
end
|
||||
|
||||
def set_image
|
||||
@section.content["image"] = params[:image]
|
||||
@ -12,6 +16,12 @@ module Merged
|
||||
redirect_to page_section_url(@page.id,@section.id)
|
||||
end
|
||||
|
||||
def set_template
|
||||
@section.content["template"] = params[:template]
|
||||
@page.save
|
||||
redirect_to page_section_url(@page.id,@section.id)
|
||||
end
|
||||
|
||||
def update
|
||||
@section.content.each do |key , value|
|
||||
next if key == "id"
|
||||
@ -21,7 +31,7 @@ module Merged
|
||||
end
|
||||
end
|
||||
@page.save
|
||||
redirect_to :merged_page_section
|
||||
redirect_to :page_section
|
||||
end
|
||||
|
||||
private
|
||||
|
Reference in New Issue
Block a user