Sha256: fdd5a0bbe12cd55fdbcbe32fc4db20f5781b2559820c163a949756b11e2e702c

Contents?: true

Size: 719 Bytes

Versions: 7

Compression:

Stored size: 719 Bytes

Contents

require_dependency "storytime/application_controller"

module Storytime
  class DashboardController < ::Storytime::ApplicationController
    before_action :authenticate_user!
    before_action :verify_storytime_user, unless: ->{ Storytime::Site.count == 0 }
    layout "storytime/dashboard"

    after_action :verify_authorized, unless: :admin_controller?

  private

    def verify_storytime_user
      raise Pundit::NotAuthorizedError if current_user.storytime_memberships.count == 0
    end

    def load_media
      @media = Media.order("created_at DESC").page(1).per(10)
      @large_gallery = false
    end

    def dashboard_controller
      true
    end

    def admin_controller?
      false
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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