Sha256: 3b9ef48177c1dde11c9dced47c45e8e885f46a9d2169c56a72bf09bc92050b1f

Contents?: true

Size: 782 Bytes

Versions: 7

Compression:

Stored size: 782 Bytes

Contents

require_dependency "storytime/dashboard/posts_controller"

module Storytime
  module Dashboard
    class PagesController < PostsController


    private
      def current_post_type
        @current_post_type ||= Storytime::Page
      end
      helper_method :current_post_type

      def load_posts
        @posts = policy_scope(Storytime::Post).page(params[:page_number]).per(10)
        @posts = @posts.where(type: "Storytime::Page")

        @posts = if params[:published].present? && params[:published] == 'true'
          @posts.published.order(published_at: :desc)
        elsif params[:draft].present? && params[:draft] == "true"
          @posts.draft.order(updated_at: :desc)
        else
          @posts.order(published_at: :desc)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
storytime-2.1.6 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.5 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.4 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.3 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.2 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.1 app/controllers/storytime/dashboard/pages_controller.rb
storytime-2.1.0 app/controllers/storytime/dashboard/pages_controller.rb