aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/banners/banners_controller.rb
blob: 5ada5e0cfe90c5520d34bc5ed3310e05e1428787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Refinery
  module Banners
    class BannersController < ::ApplicationController

      before_filter :find_all_banners
      before_filter :find_page

      def index
        # you can use meta fields from your model instead (e.g. browser_title)
        # by swapping @page for @banner in the line below:
        present(@page)
      end

      def show
        @banner = Banner.find(params[:id])

        # you can use meta fields from your model instead (e.g. browser_title)
        # by swapping @page for @banner in the line below:
        present(@page)
      end

    protected

      def find_all_banners
        @banners = Banner.order('position ASC')
      end

      def find_page
        @page = ::Refinery::Page.where(:link_url => "/banners").first
      end

    end
  end
end