Sha256: 2e9851343de89cc4fbd9651ebf8f1c8f6f4ee12619adce95dfc53e146579d73b

Contents?: true

Size: 694 Bytes

Versions: 27

Compression:

Stored size: 694 Bytes

Contents

module Enjoy
  module Controllers
    module News
      extend ActiveSupport::Concern

      def index
        @news = model.enabled.after_now.by_date

        unless Enjoy.config.news_per_page.nil?
          @news = @news.page(params[:page])
        end
      end

      def show
        @news = model.after_now.find(params[:id])

        if @news and @news.text_slug != params[:id]
          redirect_to @news, status_code: 301
          return true
        end
      end

      private
      def model
        Enjoy::News
      end
      def page_title
        if @news.class.name == model.name
          @news.page_title
        else
          super
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.7.3 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.7.2 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.7.1 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.7 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.6.2 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.6.1 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.6 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.5 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.4 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.3 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.2.1 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.2 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.1.2 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.1.1 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.1 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.0.4 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.0.3 lib/enjoy/controllers/news.rb
enjoy_cms-0.3.0.2 lib/enjoy/controllers/news.rb
enjoy_cms-0.2.1 lib/enjoy/controllers/news.rb