Sha256: 3489f26c21129e4bcba6c252e1d13d088b8f6b7dc929745fe62fdbd218f2b20c

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

class Admin::BaseController < Spree::BaseController
  ssl_required

  helper :search
  helper 'admin/navigation'
  layout 'admin'

  protected
  
  def flash_message_for(object, event_sym)
    resource_desc  = object.class.model_name.human
    resource_desc += " \"#{object.name}\"" if object.respond_to?(:name)
    I18n.t(event_sym, :resource => resource_desc)  
  end
  
  def render_js_for_destroy
    render :partial => "/admin/shared/destroy"
  end
  
  # Index request for JSON needs to pass a CSRF token in order to prevent JSON Hijacking
  def check_json_authenticity
    return unless request.format.js? or request.format.json?
    return unless protect_against_forgery?
    auth_token = params[request_forgery_protection_token]
    unless (auth_token and form_authenticity_token == URI.unescape(auth_token))
      raise(ActionController::InvalidAuthenticityToken)
    end
  end

  # def require_object_editable_by_current_user
  #   return access_denied unless object.editable_by?(current_user)
  #   true
  # end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_core-0.70.0 app/controllers/admin/base_controller.rb
spree_core-0.70.0.rc2 app/controllers/admin/base_controller.rb
spree_core-0.70.RC1 app/controllers/admin/base_controller.rb