Class: Store::DonationsController

Inherits:
StoreController
  • Object
show all
Defined in:
app/controllers/store/donations_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

Raises:

  • (ActionController::RoutingError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/store/donations_controller.rb', line 8

def index
  # If there is no kit at all, NotFound
  raise ActionController::RoutingError.new('Not Found') unless @store_organization.has_kit?(:regular_donation)

  # If there's a kit, and they're logged in, show them a preview if the kit is off
  if current_user && current_user.current_organization == @store_organization
    if !@store_organization.has_active_donation_only_storefront?
      flash[:notice] = "You are seeing a preview of your donation-only storefront. To make this page visible to the general public, go to your 501(c)(3) kit configuration and check \"Display Donation-Only Storefront\""
    end
  else
    # show everyone else NotFound
    raise ActionController::RoutingError.new('Not Found') unless @store_organization.has_active_donation_only_storefront?
  end
end