refinerycms-location_explorer 1.0

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.
Files changed (38) hide show
  1. data/app/assets/javascripts/refinery/location_explorer/locations_map.coffee +43 -0
  2. data/app/assets/javascripts/refinery/location_explorer/map_picker.coffee +28 -0
  3. data/app/assets/javascripts/refinery/location_explorer/vendor/gmaps.js +1091 -0
  4. data/app/assets/stylesheets/refinery/location_explorer.css.scss +70 -0
  5. data/app/assets/stylesheets/refinery/location_explorer/map_picker.css.scss +26 -0
  6. data/app/controllers/refinery/location_explorer/admin/locations_controller.rb +12 -0
  7. data/app/controllers/refinery/location_explorer/locations_controller.rb +44 -0
  8. data/app/models/refinery/location_explorer/location.rb +41 -0
  9. data/app/models/refinery/location_explorer/owner_decorator.rb +46 -0
  10. data/app/views/refinery/location_explorer/admin/locations/_actions.html.erb +25 -0
  11. data/app/views/refinery/location_explorer/admin/locations/_form.html.erb +27 -0
  12. data/app/views/refinery/location_explorer/admin/locations/_location.html.erb +20 -0
  13. data/app/views/refinery/location_explorer/admin/locations/_locations.html.erb +2 -0
  14. data/app/views/refinery/location_explorer/admin/locations/_map.html.erb +29 -0
  15. data/app/views/refinery/location_explorer/admin/locations/_records.html.erb +18 -0
  16. data/app/views/refinery/location_explorer/admin/locations/_sortable_list.html.erb +5 -0
  17. data/app/views/refinery/location_explorer/admin/locations/edit.html.erb +1 -0
  18. data/app/views/refinery/location_explorer/admin/locations/index.html.erb +7 -0
  19. data/app/views/refinery/location_explorer/admin/locations/new.html.erb +1 -0
  20. data/app/views/refinery/location_explorer/locations/index.html.haml +30 -0
  21. data/app/views/refinery/location_explorer/locations/show.html.haml +16 -0
  22. data/config/locales/en.yml +30 -0
  23. data/config/locales/es.yml +31 -0
  24. data/config/locales/fr.yml +30 -0
  25. data/config/locales/nb.yml +30 -0
  26. data/config/locales/nl.yml +30 -0
  27. data/config/routes.rb +17 -0
  28. data/db/migrate/1_create_location_explorer_locations.rb +33 -0
  29. data/db/seeds.rb +25 -0
  30. data/lib/generators/refinery/location_explorer_generator.rb +23 -0
  31. data/lib/generators/refinery/templates/config/initializers/refinery/location_explorer.rb.erb +4 -0
  32. data/lib/refinery/location_explorer.rb +22 -0
  33. data/lib/refinery/location_explorer/configuration.rb +9 -0
  34. data/lib/refinery/location_explorer/engine.rb +27 -0
  35. data/lib/refinerycms-location_explorer.rb +3 -0
  36. data/lib/tasks/refinery/locations.rake +13 -0
  37. data/readme.md +51 -0
  38. metadata +148 -0
@@ -0,0 +1,30 @@
1
+ en:
2
+ refinery:
3
+ plugins:
4
+ location_explorer:
5
+ title: Locations
6
+ location_explorer:
7
+ admin:
8
+ locations:
9
+ actions:
10
+ create_new: Add New Location
11
+ reorder: Reorder Locations
12
+ reorder_done: Done Reordering Locations
13
+ records:
14
+ title: Locations
15
+ sorry_no_results: Sorry! There are no results found.
16
+ no_items_yet: There are no Locations yet. Click "Add New Location" to add your first location.
17
+ location:
18
+ view_live_html: View this location live <br/><em>(opens in a new window)</em>
19
+ edit: Edit this location
20
+ delete: Remove this location forever
21
+ locations:
22
+ show:
23
+ other: Other Locations
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/location_explorer/location':
27
+ name: Name
28
+ description: Description
29
+ latitude: Latitude
30
+ longitude: Longitude
@@ -0,0 +1,31 @@
1
+ es:
2
+ refinery:
3
+ plugins:
4
+ locations:
5
+ title: Locations
6
+ # article: masculino/femenino
7
+ locations:
8
+ admin:
9
+ locations:
10
+ actions:
11
+ create_new: Crear nuevo location
12
+ reorder: Reordenar locations
13
+ reorder_done: Reordenación de locations completada
14
+ records:
15
+ title: Locations
16
+ sorry_no_results: Lo siento, no hay resultados
17
+ no_items_yet: No hay locations todavía. Pulsa en "Crear nuevo Location" para crear tu primer location.
18
+ location:
19
+ view_live_html: Ver este location como abierto al público <br/><em>(abre en ventana nueva)</em>
20
+ edit: Editar este location
21
+ delete: Borrar este location para siempre
22
+ locations:
23
+ show:
24
+ other: Otros locations
25
+ activerecord:
26
+ attributes:
27
+ 'refinery/locations/location':
28
+ name: Name
29
+ description: Description
30
+ latitude: Latitude
31
+ longitude: Longitude
@@ -0,0 +1,30 @@
1
+ fr:
2
+ refinery:
3
+ plugins:
4
+ locations:
5
+ title: Locations
6
+ locations:
7
+ admin:
8
+ locations:
9
+ actions:
10
+ create_new: Créer un(e) nouve(au/l/lle) Location
11
+ reorder: Réordonner les Locations
12
+ reorder_done: Fin de réordonnancement des Locations
13
+ records:
14
+ title: Locations
15
+ sorry_no_results: "Désolé ! Aucun résultat."
16
+ no_items_yet: 'Il n''y a actuellement aucun(e) Location. Cliquer sur "Créer un(e) nouve(au/l/lle) Location" pour créer votre premi(er/ère) location.'
17
+ location:
18
+ view_live_html: Voir ce(t/tte) location <br/><em>(Ouvre une nouvelle fenêtre)</em>
19
+ edit: Modifier ce(t/tte) location
20
+ delete: Supprimer définitivement ce(t/tte) location
21
+ locations:
22
+ show:
23
+ other: Autres Locations
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/locations/location':
27
+ name: Name
28
+ description: Description
29
+ latitude: Latitude
30
+ longitude: Longitude
@@ -0,0 +1,30 @@
1
+ nb:
2
+ refinery:
3
+ plugins:
4
+ locations:
5
+ title: Locations
6
+ locations:
7
+ admin:
8
+ locations:
9
+ actions:
10
+ create_new: Lag en ny Location
11
+ reorder: Endre rekkefølgen på Locations
12
+ reorder_done: Ferdig å endre rekkefølgen Locations
13
+ records:
14
+ title: Locations
15
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
16
+ no_items_yet: Det er ingen Locations enda. Klikk på "Lag en ny Location" for å legge til din første location.
17
+ location:
18
+ view_live_html: Vis hvordan denne location ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
19
+ edit: Rediger denne location
20
+ delete: Fjern denne location permanent
21
+ locations:
22
+ show:
23
+ other: Andre Locations
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/locations/location':
27
+ name: Name
28
+ description: Description
29
+ latitude: Latitude
30
+ longitude: Longitude
@@ -0,0 +1,30 @@
1
+ nl:
2
+ refinery:
3
+ plugins:
4
+ locations:
5
+ title: Locations
6
+ locations:
7
+ admin:
8
+ locations:
9
+ actions:
10
+ create_new: Maak een nieuwe Location
11
+ reorder: Wijzig de volgorde van de Locations
12
+ reorder_done: Klaar met het wijzingen van de volgorde van de Locations
13
+ records:
14
+ title: Locations
15
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
16
+ no_items_yet: Er zijn nog geen Locations. Druk op 'Maak een nieuwe Location' om de eerste aan te maken.
17
+ location:
18
+ view_live_html: Bekijk deze location op de website <br/><em>(opent een nieuw venster)</em>
19
+ edit: Bewerk deze location
20
+ delete: Verwijder deze location voor eeuwig
21
+ locations:
22
+ show:
23
+ other: Andere Locations
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/locations/location':
27
+ name: Name
28
+ description: Description
29
+ latitude: Latitude
30
+ longitude: Longitude
@@ -0,0 +1,17 @@
1
+ Refinery::Core::Engine.routes.append do
2
+ # Frontend routes
3
+ namespace :location_explorer do
4
+ resources :locations, :path => '', :only => [:index, :show]
5
+ end
6
+
7
+ # Admin routes
8
+ namespace :location_explorer, :path => '' do
9
+ namespace :admin, :path => 'refinery' do
10
+ resources :locations, :except => :show do
11
+ collection do
12
+ post :update_positions
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ class CreateLocationExplorerLocations < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_locations do |t|
5
+ t.string :name
6
+ t.text :description
7
+ t.decimal :latitude, :precision => 12, :scale => 8
8
+ t.decimal :longitude, :precision => 12, :scale => 8
9
+ t.integer :owner_id
10
+ t.string :owner_type
11
+ t.string :colour_override, :string, :length => 6
12
+
13
+ t.integer :position
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ end
19
+
20
+ def down
21
+ if defined?(::Refinery::UserPlugin)
22
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-location_explorer"})
23
+ end
24
+
25
+ if defined?(::Refinery::Page)
26
+ ::Refinery::Page.delete_all({:link_url => "/location_explorer/locations"})
27
+ end
28
+
29
+ drop_table :refinery_locations
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,25 @@
1
+ (Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
2
+ I18n.locale = lang
3
+
4
+ if defined?(Refinery::User)
5
+ Refinery::User.all.each do |user|
6
+ if user.plugins.where(:name => 'refinerycms-location_explorer').blank?
7
+ user.plugins.create(:name => 'refinerycms-location_explorer',
8
+ :position => (user.plugins.maximum(:position) || -1) +1)
9
+ end
10
+ end
11
+ end
12
+
13
+ url = "/locations"
14
+ if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
15
+ page = Refinery::Page.create(
16
+ :title => 'Locations',
17
+ :link_url => url,
18
+ :deletable => false,
19
+ :menu_match => "^#{url}(\/|\/.+?|)$"
20
+ )
21
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
22
+ page.parts.create(:title => default_page_part, :body => nil, :position => index)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ module Refinery
2
+ class LocationExplorerGenerator < Rails::Generators::Base
3
+
4
+ def rake_db
5
+ rake("refinery_location_explorer:install:migrations")
6
+ end
7
+
8
+ def generate_locations_initializer
9
+ template "config/initializers/refinery/location_explorer.rb.erb", File.join(destination_root, "config", "initializers", "refinery", "location_explorer.rb")
10
+ end
11
+
12
+ def append_load_seed_data
13
+ create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
14
+ append_file 'db/seeds.rb', :verbose => true do
15
+ <<-EOH
16
+
17
+ # Added by Refinery CMS Location Explorer extension
18
+ Refinery::LocationExplorer::Engine.load_seed
19
+ EOH
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ Refinery::LocationExplorer.configure do |config|
2
+ # config.default_map_center = [-12.043333, -77.028333]
3
+
4
+ end
@@ -0,0 +1,22 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+ autoload :LocationsGenerator, 'generators/refinery/location_explorer_generator'
5
+
6
+ module LocationExplorer
7
+ require 'refinery/location_explorer/engine'
8
+
9
+ class << self
10
+ attr_writer :root
11
+
12
+ def root
13
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
14
+ end
15
+
16
+ def factory_paths
17
+ @factory_paths ||= [ root.join('spec', 'factories').to_s ]
18
+ end
19
+ end
20
+ require 'refinery/location_explorer/configuration'
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ module Refinery
2
+ module LocationExplorer
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :map_center, :map_zoom
6
+
7
+ self.map_center = [-12.043333, -77.028333]
8
+ end
9
+ end
@@ -0,0 +1,27 @@
1
+ module Refinery
2
+ module LocationExplorer
3
+ class Engine < Rails::Engine
4
+ include Refinery::Engine
5
+ isolate_namespace Refinery::LocationExplorer
6
+
7
+ engine_name :refinery_location_explorer
8
+
9
+ initializer "register refinerycms_location_explorer plugin" do
10
+ Refinery::Plugin.register do |plugin|
11
+ plugin.name = "location_explorer"
12
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.location_explorer_admin_locations_path }
13
+ plugin.pathname = root
14
+ plugin.activity = {
15
+ :class_name => :'refinery/location_explorer/admin/location',
16
+ :title => 'name'
17
+ }
18
+
19
+ end
20
+ end
21
+
22
+ config.after_initialize do
23
+ Refinery.register_extension(Refinery::LocationExplorer)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ require 'refinerycms-formtastic'
2
+ require 'refinerycms-jquery_gallery'
3
+ require 'refinery/location_explorer'
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :locations do
4
+
5
+ # call this task by running: rake refinery:locations:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,51 @@
1
+ # Locations extension for Refinery CMS.
2
+
3
+ http://github.com/craigambrose/refinerycms-location_explorer
4
+
5
+ This extension allows you to present a set of marker locations on a google map. Each of these locations displays
6
+ some preview information when clicked on, and also a "more detail" link which leads to a unique page for each
7
+ location which contains custom html and an image gallery.
8
+
9
+ The refinerycms-page-images extension is used to provide the admin functionality for attaching a set of images
10
+ to each location.
11
+
12
+ The refinerycms-jquery_gallery extension is used to display the image gallery (using the jQuery gallery view
13
+ widget).
14
+
15
+ ## Installation
16
+
17
+ Add the gem to your Gemfile:
18
+
19
+ ```ruby
20
+ gem 'refinerycms-location_explorer'
21
+ ```
22
+
23
+ Run the generator and then execute the migrations:
24
+
25
+ ```bash
26
+ rake refinery:location_explorer
27
+ rake db:migrate
28
+ ```
29
+
30
+ Add the stylesheet to your application.css
31
+
32
+ ```
33
+ //= require refinery/locations
34
+ ```
35
+
36
+ Note that this gem depends on refinerycms-page-images which requires you to run it's generator to install it.
37
+ Please see the instructions for that gem to ensure that it is installed correctly.
38
+
39
+ ## How to build this extension as a gem
40
+
41
+ gem build refinerycms-location_explorer.gemspec
42
+ gem push refinerycms-location_explorer.gem
43
+
44
+ ## Licence
45
+
46
+ This code us available under the MIT licence. See attached licence file for full details.
47
+
48
+ ## Credits
49
+
50
+ Craig Ambrose
51
+ http://github.com/craigambrose
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-location_explorer
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Craig Ambrose
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: refinerycms-core
16
+ requirement: &70148732291360 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70148732291360
25
+ - !ruby/object:Gem::Dependency
26
+ name: refinerycms-page-images
27
+ requirement: &70148732288280 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70148732288280
36
+ - !ruby/object:Gem::Dependency
37
+ name: refinerycms-jquery_gallery
38
+ requirement: &70148732298000 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.1
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70148732298000
47
+ - !ruby/object:Gem::Dependency
48
+ name: refinerycms-formtastic
49
+ requirement: &70148732320160 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.2
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70148732320160
58
+ - !ruby/object:Gem::Dependency
59
+ name: haml-rails
60
+ requirement: &70148732317240 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70148732317240
69
+ - !ruby/object:Gem::Dependency
70
+ name: refinerycms-testing
71
+ requirement: &70148732324920 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 2.0.5
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70148732324920
80
+ description: Ruby on Rails Locations extension for Refinery CMS
81
+ email:
82
+ - craig@craigambrose.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - app/assets/javascripts/refinery/location_explorer/locations_map.coffee
88
+ - app/assets/javascripts/refinery/location_explorer/map_picker.coffee
89
+ - app/assets/javascripts/refinery/location_explorer/vendor/gmaps.js
90
+ - app/assets/stylesheets/refinery/location_explorer/map_picker.css.scss
91
+ - app/assets/stylesheets/refinery/location_explorer.css.scss
92
+ - app/controllers/refinery/location_explorer/admin/locations_controller.rb
93
+ - app/controllers/refinery/location_explorer/locations_controller.rb
94
+ - app/models/refinery/location_explorer/location.rb
95
+ - app/models/refinery/location_explorer/owner_decorator.rb
96
+ - app/views/refinery/location_explorer/admin/locations/_actions.html.erb
97
+ - app/views/refinery/location_explorer/admin/locations/_form.html.erb
98
+ - app/views/refinery/location_explorer/admin/locations/_location.html.erb
99
+ - app/views/refinery/location_explorer/admin/locations/_locations.html.erb
100
+ - app/views/refinery/location_explorer/admin/locations/_map.html.erb
101
+ - app/views/refinery/location_explorer/admin/locations/_records.html.erb
102
+ - app/views/refinery/location_explorer/admin/locations/_sortable_list.html.erb
103
+ - app/views/refinery/location_explorer/admin/locations/edit.html.erb
104
+ - app/views/refinery/location_explorer/admin/locations/index.html.erb
105
+ - app/views/refinery/location_explorer/admin/locations/new.html.erb
106
+ - app/views/refinery/location_explorer/locations/index.html.haml
107
+ - app/views/refinery/location_explorer/locations/show.html.haml
108
+ - config/locales/en.yml
109
+ - config/locales/es.yml
110
+ - config/locales/fr.yml
111
+ - config/locales/nb.yml
112
+ - config/locales/nl.yml
113
+ - config/routes.rb
114
+ - db/migrate/1_create_location_explorer_locations.rb
115
+ - db/seeds.rb
116
+ - lib/generators/refinery/location_explorer_generator.rb
117
+ - lib/generators/refinery/templates/config/initializers/refinery/location_explorer.rb.erb
118
+ - lib/refinery/location_explorer/configuration.rb
119
+ - lib/refinery/location_explorer/engine.rb
120
+ - lib/refinery/location_explorer.rb
121
+ - lib/refinerycms-location_explorer.rb
122
+ - lib/tasks/refinery/locations.rake
123
+ - readme.md
124
+ homepage: https://github.com/craigambrose/refinerycms-location_explorer
125
+ licenses: []
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 1.8.17
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: Locations extension for Refinery CMS
148
+ test_files: []