@@ -36,7 +36,7 @@
- <%= render Shared::BannerComponent.new(@banner) %>
+ <%= render Shared::BannerComponent.new(banner) %>
<% end %>
diff --git a/app/components/admin/banners/form_component.rb b/app/components/admin/banners/form_component.rb
new file mode 100644
index 000000000..26c51f9ba
--- /dev/null
+++ b/app/components/admin/banners/form_component.rb
@@ -0,0 +1,15 @@
+class Admin::Banners::FormComponent < ApplicationComponent
+ include TranslatableFormHelper
+ include GlobalizeHelper
+ attr_reader :banner
+
+ def initialize(banner)
+ @banner = banner
+ end
+
+ private
+
+ def sections
+ WebSection.all
+ end
+end
diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb
index 72b085a5d..3ae9df5f8 100644
--- a/app/controllers/admin/banners_controller.rb
+++ b/app/controllers/admin/banners_controller.rb
@@ -3,8 +3,6 @@ class Admin::BannersController < Admin::BaseController
has_filters %w[all with_active with_inactive], only: :index
- before_action :banner_sections, only: [:edit, :new, :create, :update]
-
respond_to :html, :js
load_and_authorize_resource
@@ -47,10 +45,6 @@ class Admin::BannersController < Admin::BaseController
web_section_ids: []]
end
- def banner_sections
- @banner_sections = WebSection.all
- end
-
def resource
@banner ||= Banner.find(params[:id])
end
diff --git a/app/views/admin/banners/edit.html.erb b/app/views/admin/banners/edit.html.erb
index 26b4f49b0..a3d17da83 100644
--- a/app/views/admin/banners/edit.html.erb
+++ b/app/views/admin/banners/edit.html.erb
@@ -5,6 +5,6 @@
<%= t("admin.banners.edit.editing") %>
- <%= render "form" %>
+ <%= render Admin::Banners::FormComponent.new(@banner) %>