Sha256: 541de8852c69fc521c748d027988592f307fde2bbeb7c6bf09bf1b969a93369b

Contents?: true

Size: 834 Bytes

Versions: 12

Compression:

Stored size: 834 Bytes

Contents

class AdminController < ::ApplicationController

  layout 'admin'

  before_filter :set_timezone
  before_filter :restricted_access

  helper_method :current_shop

  private

  def set_timezone
    Time.zone = current_shop.time_zone
  end

  def restricted_access
    return unless Nimbleshop.config.ask_admin_to_login

    authenticate_or_request_with_http_basic('staging') { |username, password|
      username == Nimbleshop.config.admin_email && password == Nimbleshop.config.admin_password
    }
  end

  def delayed_job_admin_authentication
    return true if Rails.env.development? || Rails.env.test?
  end

  def no_page_title
    @do_not_use_page_title = true
  end

  def current_shop
    @shop ||= Shop.first
    raise "The database base is empty. Please run bundle exec rake setup first." unless @shop
    @shop
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nimbleshop_core-0.0.4.beta1 app/controllers/admin_controller.rb
nimbleshop_core-0.0.4 app/controllers/admin_controller.rb
nimbleshop_core-0.0.3 app/controllers/admin_controller.rb
nimbleshop_core-0.0.2 app/controllers/admin_controller.rb
nimbleshop_core-0.0.2.beta1 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc6 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc5 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc4 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc3 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc2 app/controllers/admin_controller.rb
nimbleshop_core-0.0.1.rc1 app/controllers/admin_controller.rb