Sha256: fa2ac9d1aa970e4e9a4c0b799f3bba633090f4cf0cf27b54f581ee0cf5605329

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

module Cmor
  module Blog
    module Backend
      class PostsController < Cmor::Core::Backend::ResourcesController::Base
        include Rao::ResourcesController::ActsAsListConcern
        include Rao::ResourcesController::ActsAsPublishedConcern
        include Rao::ResourcesController::FriendlyIdConcern

        helper Cmor::Tags::Backend::ApplicationHelper if Cmor::Core.features?(:cmor_tags)

        include Rao::Query::Controller::QueryConcern
        view_helper Rao::Query::ApplicationHelper, as: :query_helper
        
        def self.resource_class
          Cmor::Blog::Post
        end

        private

        def current_user_for_userstamp
          Cmor::Blog::Backend::Configuration.current_user_proc.call(self)
        end

        def initialize_resource
          super
          @resource.creator = current_user_for_userstamp
        end

        def initialize_resource_for_create
          super
          @resource.creator = current_user_for_userstamp
        end

        def load_collection_scope
          scope = super.friendly
          with_conditions_from_query(scope)
        end

        def load_resource_scope
          super.friendly
        end

        def permitted_params
          params.require(:post).permit(:title, :body, :published, :tag_list, assets: [], append_assets: [], overwrite_assets: [])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cmor_blog_backend-0.0.44.pre app/controllers/cmor/blog/backend/posts_controller.rb
cmor_blog_backend-0.0.43.pre app/controllers/cmor/blog/backend/posts_controller.rb
cmor_blog_backend-0.0.42.pre app/controllers/cmor/blog/backend/posts_controller.rb
cmor_blog_backend-0.0.41.pre app/controllers/cmor/blog/backend/posts_controller.rb
cmor_blog_backend-0.0.40.pre app/controllers/cmor/blog/backend/posts_controller.rb