Sha256: 8b7622ce4964a38d73d4a76ecc4d350687e39795c43aef17beb133d854856493

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

class Admin::Shop::DiscountsController < Admin::ResourceController
  
  model_class ShopDiscount

  before_filter :config_global
  before_filter :config_index,  :only => [ :index ]
  before_filter :config_new,    :only => [ :new, :create ]
  before_filter :config_edit,   :only => [ :edit, :update ]
  before_filter :assets_global, :except => [ :remove, :destroy ]
  before_filter :assets_edit,   :only => [ :edit, :update ]
  
  private
  
    def config_global
      @inputs   ||= []
      @meta     ||= []
      @buttons  ||= []
      @parts    ||= []
      @popups   ||= []
    end
    
    def config_index
      @buttons  << 'new_discount'
    end
    
    def config_new
      @inputs   << 'name'
      @inputs   << 'amount'
      @inputs   << 'code'
      
      @meta     << 'start'
      @meta     << 'finish'
    end
    
    def config_edit
      @buttons  << 'browse_categories'
      @buttons  << 'browse_products'
      
      @inputs   << 'name'
      @inputs   << 'amount'
      @inputs   << 'code'
      
      @meta     << 'start'
      @meta     << 'finish'
      
      @parts    << 'categories'
      @parts    << 'products'
      
      @popups   << 'browse_categories'
      @popups   << 'browse_products'
    end
    
    def assets_global
      include_stylesheet 'admin/extensions/shop/edit'
      include_stylesheet 'admin/extensions/shop/index'
    end
    
    def assets_edit
      include_javascript 'admin/extensions/shop/edit'
      include_javascript 'admin/extensions/shop/discounts/edit'
      include_stylesheet 'admin/extensions/shop/discounts/edit'
    end
    
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
radiant-shop_discounts-extension-0.0.3 app/controllers/admin/shop/discounts_controller.rb
radiant-shop_discounts-extension-0.0.1 app/controllers/admin/shop/discounts_controller.rb
radiant-shop-extension-0.11.6 app/controllers/admin/shop/discounts_controller.rb