Sha256: fcc54ec645bacf3c2bc3ef77b4fc896d6f27126fc8dda041339fba837bf65028

Contents?: true

Size: 613 Bytes

Versions: 5

Compression:

Stored size: 613 Bytes

Contents

module Cas
  class Sites::Sections::ApplicationController < Sites::ApplicationController
    before_action :load_section

    private

    def load_section
      @section ||= @site.sections.friendly.find(params[:section_id])
    end

    def scope_content_by_role(model_relation = ::Cas::Content)
      # Only admins and editors can see other people's content
      if !current_user.admin? && !current_user.editor?
        model_relation = model_relation.where(author_id: current_user.id)
      end
      model_relation
    end

    def load_categories
      @categories ||= @section.categories
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cas-cms-1.0.0.alpha2 app/controllers/cas/sites/sections/application_controller.rb
cas-cms-1.0.0.alpha1 app/controllers/cas/sites/sections/application_controller.rb
cas-cms-0.1.3 app/controllers/cas/sites/sections/application_controller.rb
cas-cms-0.1.2 app/controllers/cas/sites/sections/application_controller.rb
cas-cms-0.1.1 app/controllers/cas/sites/sections/application_controller.rb