Sha256: 2d03d38e28abcef6b20f05fc9b9f2a67b8808f8b06de33221d388990b57f282b

Contents?: true

Size: 1004 Bytes

Versions: 8

Compression:

Stored size: 1004 Bytes

Contents

class E9Crm::OffersController < E9Crm::ResourcesController
  defaults :resource_class => Offer
  include E9Rails::Controllers::Orderable
  self.should_paginate_index = false

  # record attributes templates js
  skip_before_filter :authenticate_user!, :filter_access_filter, :only => :show

  before_filter :throw_forbidden_unless_offer_cookied, :only => :show

  has_scope :of_type, :as => :type, :only => :index do |_, scope, value|
    scope.of_type("#{value}_offer".classify)
  end

  def show
    clear_breadcrumbs
    @show_title = resource.name
  end

  protected

  def throw_forbidden_unless_offer_cookied
    cookied_offer_array = Marshal.load(cookies['_e9_offers']) rescue []

    unless cookied_offer_array.member?(params[:id].to_i)
      permission_denied and return false
    end
  end

  def find_current_page
    if params[:action] != 'show'
      super
    else
      @current_page ||= Offer.page || super
    end
  end

  def determine_layout
    request.xhr? ? false : super
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
e9_crm-0.1.17 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.16 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.14 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.13 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.12 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.11 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.10 app/controllers/e9_crm/offers_controller.rb
e9_crm-0.1.8 app/controllers/e9_crm/offers_controller.rb