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:
iagirre
2018-01-09 17:30:11 +01:00
committed by Angel Perez
parent 3e4d095e6f
commit 6d6da8affc
11 changed files with 106 additions and 12 deletions

View File

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