Sha256: c06ba1bab0a8757c180d760f14dbbb59aa46e8f5fe1d52efe3c5aa0d915849a0

Contents?: true

Size: 892 Bytes

Versions: 3

Compression:

Stored size: 892 Bytes

Contents

module Caboodle
  class Googlelocal < Caboodle::Kit
    
    description "A google map linking to a list of locations and enabling Local Search around each of them."
    
    required [:google_maps_api_key]
    
    config_files ["googlelocal.yml"]
    
    stylesheets ["http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css", "http://www.google.com/uds/css/gsearch.css"]
    
    before do
      @locations = Settings.google_local_locations
      @location = Settings.google_local_locations.first
    end
    
    menu "Near me"
    
    get "/near_me/:slug" do
      Settings.google_local_locations.each do |loc|
        if loc.title.downcase.gsub(" ","-") == params[:slug]
          @location = loc
        end
      end
            
      if @location
        haml :googlelocal
      else
        redirect "/near_me" 
      end
    end
    
    add_sass ["googlelocal"]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
caboodle-0.2.20 lib/caboodle/kits/googlelocal/googlelocal.rb
caboodle-0.2.19 lib/caboodle/kits/googlelocal/googlelocal.rb
caboodle-0.2.18 lib/caboodle/kits/googlelocal/googlelocal.rb