Add form fields to set the colours and the sections for the banner
Add migrations to store the information in the database
This commit is contained in:
@@ -4,6 +4,7 @@ class Admin::BannersController < Admin::BaseController
|
||||
|
||||
before_action :banner_styles, only: [:edit, :new, :create, :update]
|
||||
before_action :banner_imgs, only: [:edit, :new, :create, :update]
|
||||
before_action :banner_sections, only: [:edit, :new, :create, :update]
|
||||
|
||||
respond_to :html, :js
|
||||
|
||||
@@ -39,7 +40,8 @@ class Admin::BannersController < Admin::BaseController
|
||||
|
||||
def banner_params
|
||||
attributes = [:title, :description, :target_url, :style, :image,
|
||||
:post_started_at, :post_ended_at]
|
||||
:post_started_at, :post_ended_at, :sections,
|
||||
:background_color, :font_color]
|
||||
params.require(:banner).permit(*attributes)
|
||||
end
|
||||
|
||||
@@ -55,4 +57,7 @@ class Admin::BannersController < Admin::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def banner_sections
|
||||
@banner_sections = Banner::Section.sections.map {|banner_section| [banner_section[1], banner_section[0]]} # name, value
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user