radiant-location-extension 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ module GeoKitDefaults
2
+ [:default_units, :default_formula].each do |sym|
3
+ define_method sym do
4
+ Radiant::Config["geokit.#{sym}"].to_sym
5
+ end
6
+
7
+ define_method "#{sym}=" do |obj|
8
+ Radiant::Config["geokit.#{sym}"] = obj
9
+ end
10
+ end
11
+ end
12
+
13
+
14
+ module GeoKitGeocodersDefaults
15
+ [:yahoo, :google, :geocoder_us, :geocoder_ca, :proxy_addr, :proxy_port, :proxy_user, :proxy_pass].each do |sym|
16
+ define_method sym do
17
+ val = Radiant::Config["geokit.geocoders.#{sym}"]
18
+ val.strip.downcase.eql?("nil") ? nil : val
19
+ end
20
+
21
+ define_method "#{sym}=" do |obj|
22
+ Radiant::Config["geokit.geocoders.#{sym}"] = obj
23
+ end
24
+ end
25
+
26
+ def provider_order
27
+ Radiant::Config["geokit.geocoders.provider_order"].split(" ").map { |s| s.to_sym }
28
+ end
29
+ def timeout
30
+ val = Radiant::Config["geokit.geocoders.timeout"]
31
+ val.strip.downcase.eql?("nil") ? nil : val.to_i
32
+ end
33
+ def timeout=(obj)
34
+ Radiant::Config["geokit.geocoders.timeout"] = obj
35
+ end
36
+ end
37
+
38
+ GeoKit.extend GeoKitDefaults
39
+ GeoKit::Geocoders.extend GeoKitGeocodersDefaults
@@ -0,0 +1,5 @@
1
+ require "radiant-location-extension/version"
2
+
3
+ module RadiantLocationExtension
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module RadiantLocationExtension
2
+ VERSION = "1.2.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ namespace :radiant do
2
+ namespace :extensions do
3
+ namespace :location do
4
+
5
+ desc "Runs the migration of the Location extension"
6
+ task :migrate => :environment do
7
+ require 'radiant/extension_migrator'
8
+ if ENV["VERSION"]
9
+ LocationExtension.migrator.migrate(ENV["VERSION"].to_i)
10
+ else
11
+ LocationExtension.migrator.migrate
12
+ end
13
+ end
14
+
15
+ desc "Copies public assets of the Location to the instance public/ directory."
16
+ task :update => :environment do
17
+ is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
18
+ Dir[LocationExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
19
+ path = file.sub(LocationExtension.root, '')
20
+ directory = File.dirname(path)
21
+ puts "Copying #{path}..."
22
+ mkdir_p RAILS_ROOT + directory
23
+ cp file, RAILS_ROOT + path
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,51 @@
1
+ require_dependency 'application_controller'
2
+ require_dependency 'geo_kit/mappable'
3
+ require_dependency 'geo_kit/acts_as_mappable'
4
+ require_dependency 'geo_kit/ip_geocode_lookup'
5
+ require_dependency 'location_geo_kit'
6
+
7
+ require 'radiant-location-extension/version'
8
+
9
+ class LocationExtension < Radiant::Extension
10
+ version RadiantLocationExtension::VERSION
11
+ description 'Radiant Location Extension'
12
+ url 'https://github.com/adsmart/radiant-location-extension'
13
+
14
+ def activate
15
+ ActiveRecord::Base.send :include, GeoKit::ActsAsMappable
16
+ ActionController::Base.send :include, GeoKit::IpGeocodeLookup
17
+ Page.send :include, LocationsTags
18
+ tab 'Content' do
19
+ add_item "Locations", "/admin/locations", :after => "Pages"
20
+ end
21
+ Radiant::AdminUI.class_eval do
22
+ attr_accessor :locations
23
+ end
24
+ admin.locations = load_default_location_regions
25
+ LocationFinderPage
26
+ end
27
+
28
+ def deactivate
29
+ # admin.tabs.remove "Locations"
30
+ end
31
+
32
+ private
33
+ # Defines this extension's default regions (so that we can incorporate shards
34
+ # into its views).
35
+ def load_default_location_regions
36
+ returning OpenStruct.new do |locations|
37
+ locations.edit = Radiant::AdminUI::RegionSet.new do |edit|
38
+ edit.main.concat %w{edit_header edit_form}
39
+ edit.form.concat %w{edit_title edit_group edit_full_address edit_website_url edit_page_path edit_geocode}
40
+ edit.form_bottom.concat %w{edit_timestamp edit_buttons}
41
+ end
42
+ locations.new = locations.edit.clone
43
+ end
44
+ end
45
+
46
+
47
+
48
+
49
+
50
+
51
+ end
@@ -0,0 +1,19 @@
1
+ td.location-title {
2
+ font-size: 115%;
3
+ font-weight: bold;
4
+ padding-left: 9px;
5
+ }
6
+
7
+ td.location-title img {
8
+ padding: 3px 0;
9
+ }
10
+
11
+ td.location-title a {
12
+ color: black;
13
+ text-decoration: none;
14
+ }
15
+
16
+ table.index .node .location-title a:hover {
17
+ color: #06c;
18
+ text-decoration: underline;
19
+ }
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/radiant-location-extension/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Adam van den Hoven']
6
+ gem.email = ['adam.vandenhoven@gmail.com']
7
+ gem.description = %q{Location is a Radiant Extension that will allow you to create relatively robust list of locations (stores, churches, etc.).}
8
+ gem.summary = %q{Adds a location database to Radiant CMS}
9
+ gem.homepage = 'http://starkravingcoder.blogspot.com'
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = 'radiant-location-extension'
15
+ gem.require_paths = ['lib']
16
+ gem.version = RadiantLocationExtension::VERSION
17
+
18
+ gem.add_dependency 'radiant', '>=0.9'
19
+ # Radiant depends on rDoc anyway, but just to be sure
20
+ gem.add_development_dependency 'rdoc', '>=2.4'
21
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-location-extension
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam van den Hoven
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: radiant
16
+ requirement: &70343394357900 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0.9'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70343394357900
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdoc
27
+ requirement: &70343394357060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.4'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70343394357060
36
+ description: Location is a Radiant Extension that will allow you to create relatively
37
+ robust list of locations (stores, churches, etc.).
38
+ email:
39
+ - adam.vandenhoven@gmail.com
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - README
47
+ - Rakefile
48
+ - app/.DS_Store
49
+ - app/controllers/.DS_Store
50
+ - app/controllers/admin/locations_controller.rb
51
+ - app/helpers/.DS_Store
52
+ - app/helpers/admin/location_helper.rb
53
+ - app/models/location.rb
54
+ - app/models/location_finder_page.rb
55
+ - app/models/locations_tags.rb
56
+ - app/views/.DS_Store
57
+ - app/views/admin/.DS_Store
58
+ - app/views/admin/locations/_location.html.haml
59
+ - app/views/admin/locations/edit.html.haml
60
+ - app/views/admin/locations/index.html.haml
61
+ - app/views/admin/locations/new.html.haml
62
+ - app/views/admin/locations/remove.html.haml
63
+ - config/routes.rb
64
+ - db/migrate/001_create_locations.rb
65
+ - db/migrate/002_set_properties.rb
66
+ - lib/geo_kit/acts_as_mappable.rb
67
+ - lib/geo_kit/geocoders.rb
68
+ - lib/geo_kit/ip_geocode_lookup.rb
69
+ - lib/geo_kit/mappable.rb
70
+ - lib/location_geo_kit.rb
71
+ - lib/radiant-location-extension.rb
72
+ - lib/radiant-location-extension/version.rb
73
+ - lib/tasks/location_extension_tasks.rake
74
+ - location_extension.rb
75
+ - public/images/admin/location.png
76
+ - public/stylesheets/admin/location.css
77
+ - radiant-location-extension.gemspec
78
+ homepage: http://starkravingcoder.blogspot.com
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 1.8.11
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Adds a location database to Radiant CMS
102
+ test_files: []