Fix banners in user pages

Banners were not been shown in certain pages; now
they are.

Spec to check if the banner is been shown correctly
added. Before it was in admins specs, now it has it's
own spec out of admins folder.
This commit is contained in:
iagirre
2018-05-03 15:53:05 +02:00
committed by Angel Perez
parent 5ce08532cb
commit 0d9da5398b
16 changed files with 75 additions and 20 deletions

View File

@@ -16,6 +16,7 @@ class BudgetsController < ApplicationController
def index
@finished_budgets = @budgets.finished.order(created_at: :desc)
@budgets_coordinates = current_budget_map_locations
@banners = Banner.in_section('budgets').with_active
end
end

View File

@@ -16,7 +16,7 @@ module CommentableActions
index_customization if index_customization.present?
@tag_cloud = tag_cloud
@banners = Banner.with_active
@banners = Banner.in_section(section(resource_model.name)).with_active
set_resource_votes(@resources)
@@ -114,4 +114,13 @@ module CommentableActions
nil
end
def section(resource_name)
case resource_name
when "Proposal"
'proposals'
when "Debate"
'debates'
end
end
end

View File

@@ -3,6 +3,7 @@ class PagesController < ApplicationController
def show
@custom_page = SiteCustomization::Page.published.find_by(slug: params[:id])
@banners = Banner.in_section('help_page').with_active
if @custom_page.present?
render action: :custom_page

View File

@@ -8,6 +8,7 @@ class WelcomeController < ApplicationController
@header = Widget::Card.header.first
@feeds = Widget::Feed.active
@cards = Widget::Card.body
@banners = Banner.in_section('homepage').with_active
end
def welcome