4 | Dummy
5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/openstreetmap_proxy.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Views
3 | class OpenStreetMapProxy < LatlngProxy
4 | def build(_, *args, &_block)
5 | super _, *args, &_block
6 | @template_name = 'openstreetmap.html.erb'
7 | @script_html = ''
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/features/form_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe "ActiveAdminLatLng", type: :feature do
4 | it "render successfully" do
5 | coordinate = Coordinate.create! lat: '23.23121', lng: '43.32123'
6 |
7 | visit admin_coordinate_path(coordinate)
8 |
9 | expect(page).to have_text 'Coordinate'
10 | expect(page).to have_text '23.23121'
11 | expect(page).to have_text '43.32123'
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/yandex_map_proxy.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Views
3 | class YandexMapProxy < LatlngProxy
4 | def build(_, *args, &_block)
5 | super _, *args, &_block
6 | @api_key_name = 'apiKey'
7 | @template_name = 'yandex.html.erb'
8 | @script_html = ""
9 | end
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/google_map_proxy.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Views
3 | class GoogleMapProxy < LatlngProxy
4 | def build(_, *args, &_block)
5 | super _, *args, &_block
6 | @api_key_name = 'key'
7 | @template_name = 'google.html.erb'
8 | @script_html = ""
9 | end
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/dummy/README.rdoc:
--------------------------------------------------------------------------------
1 | == README
2 |
3 | This README would normally document whatever steps are necessary to get the
4 | application up and running.
5 |
6 | Things you may want to cover:
7 |
8 | * Ruby version
9 |
10 | * System dependencies
11 |
12 | * Configuration
13 |
14 | * Database creation
15 |
16 | * Database initialization
17 |
18 | * How to run the test suite
19 |
20 | * Services (job queues, cache servers, search engines, etc.)
21 |
22 | * Deployment instructions
23 |
24 | * ...
25 |
26 |
27 | Please feel free to use a different markup language if you do not plan to run
28 | rake doc:app.
29 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | begin
2 | require 'bundler/setup'
3 | rescue LoadError
4 | puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5 | end
6 |
7 | require 'rdoc/task'
8 |
9 | RDoc::Task.new(:rdoc) do |rdoc|
10 | rdoc.rdoc_dir = 'rdoc'
11 | rdoc.title = 'ActiveadminLatlng'
12 | rdoc.options << '--line-numbers'
13 | rdoc.rdoc_files.include('README.rdoc')
14 | rdoc.rdoc_files.include('lib/**/*.rb')
15 | end
16 |
17 | APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18 | load 'rails/tasks/engine.rake'
19 |
20 |
21 | load 'rails/tasks/statistics.rake'
22 |
23 |
24 |
25 | Bundler::GemHelper.install_tasks
26 |
--------------------------------------------------------------------------------
/spec/dummy/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/active_admin.scss:
--------------------------------------------------------------------------------
1 | // SASS variable overrides must be declared before loading up Active Admin's styles.
2 | //
3 | // To view the variables that Active Admin provides, take a look at
4 | // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
5 | // Active Admin source.
6 | //
7 | // For example, to change the sidebar width:
8 | // $sidebar-width: 242px;
9 |
10 | // Active Admin's got SASS!
11 | @import "active_admin/mixins";
12 | @import "active_admin/base";
13 |
14 | // Overriding any non-variable SASS must be done after the fact.
15 | // For example, to change the default status-tag color:
16 | //
17 | // .status_tag { background: #6090DB; }
18 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/new_framework_defaults_5_1.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains migration options to ease your Rails 5.1 upgrade.
4 | #
5 | # Once upgraded flip defaults one by one to migrate to the new default.
6 | #
7 | # Read the Guide for Upgrading Ruby on Rails for more info on each option.
8 |
9 | # Make `form_with` generate non-remote forms.
10 | Rails.application.config.action_view.form_with_generates_remote_forms = false
11 |
12 | # Unknown asset fallback will return the path passed in when the given
13 | # asset is not present in the asset pipeline.
14 | # Rails.application.config.assets.unknown_asset_fallback = false
15 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/spec/dummy/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 | require 'simplecov'
5 |
6 | # Require the gems listed in Gemfile, including any gems
7 | # you've limited to :test, :development, or :production.
8 | Bundler.require(*Rails.groups)
9 |
10 | module Dummy
11 | class Application < Rails::Application
12 | # Initialize configuration defaults for originally generated Rails version.
13 | config.load_defaults 5.1
14 |
15 | # Settings in config/environments/* take precedence over those specified here.
16 | # Application configuration should go into files in config/initializers
17 | # -- all .rb files in that directory are automatically loaded.
18 | config.autoload_paths += %W(#{config.root}/app/models)
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any styles
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 | * file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Declare your gem's dependencies in activeadmin_latlng.gemspec.
4 | # Bundler will treat runtime dependencies like base dependencies, and
5 | # development dependencies will be added by default to the :development group.
6 | gemspec
7 |
8 | # Declare any dependencies that are still in development here instead of in
9 | # your gemspec. These might include edge Rails or gems from your path or
10 | # Git. Remember to move these dependencies to your gemspec before releasing
11 | # your gem to rubygems.org.
12 |
13 | # To use a debugger
14 | # gem 'byebug', group: [:development, :test]
15 |
16 | gem 'rails', '~> 5'
17 |
18 | group :development do
19 | gem 'listen'
20 | gem 'sqlite3'
21 | gem 'simplecov'
22 | gem 'byebug'
23 | end
24 |
25 | group :test do
26 | gem 'rails-controller-testing'
27 | end
28 |
--------------------------------------------------------------------------------
/spec/dummy/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a way to update your development environment automatically.
15 | # Add necessary update steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | puts "\n== Updating database =="
22 | system! 'bin/rails db:migrate'
23 |
24 | puts "\n== Removing old logs and tempfiles =="
25 | system! 'bin/rails log:clear tmp:clear'
26 |
27 | puts "\n== Restarting application server =="
28 | system! 'bin/rails restart'
29 | end
30 |
--------------------------------------------------------------------------------
/spec/dummy/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/spec/dummy/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 20170708215246) do
14 |
15 | create_table "coordinates", force: :cascade do |t|
16 | t.string "lat"
17 | t.string "lng"
18 | t.datetime "created_at", null: false
19 | t.datetime "updated_at", null: false
20 | end
21 |
22 | end
23 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/dashboard.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register_page "Dashboard" do
2 |
3 | menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
4 |
5 | content title: proc{ I18n.t("active_admin.dashboard") } do
6 | div class: "blank_slate_container", id: "dashboard_default_message" do
7 | span class: "blank_slate" do
8 | span I18n.t("active_admin.dashboard_welcome.welcome")
9 | small I18n.t("active_admin.dashboard_welcome.call_to_action")
10 | end
11 | end
12 |
13 | # Here is an example of a simple dashboard with columns and panels.
14 | #
15 | # columns do
16 | # column do
17 | # panel "Recent Posts" do
18 | # ul do
19 | # Post.recent(5).map do |post|
20 | # li link_to(post.title, admin_post_path(post))
21 | # end
22 | # end
23 | # end
24 | # end
25 |
26 | # column do
27 | # panel "Info" do
28 | # para "Welcome to ActiveAdmin."
29 | # end
30 | # end
31 | # end
32 | end # content
33 | end
34 |
--------------------------------------------------------------------------------
/MIT-LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2016 Alexey Krylov
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/activeadmin_latlng.gemspec:
--------------------------------------------------------------------------------
1 | $:.push File.expand_path("../lib", __FILE__)
2 |
3 | # Maintain your gem's version:
4 | require "activeadmin_latlng/version"
5 |
6 | # Describe your gem and declare its dependencies:
7 | Gem::Specification.new do |s|
8 | s.name = "activeadmin_latlng"
9 | s.version = ActiveadminLatlng::VERSION
10 | s.authors = ["Alexey Krylov"]
11 | s.email = ["alexey2142@mail.ru"]
12 | s.homepage = "https://github.com/forsaken1/activeadmin_latlng"
13 | s.summary = "ActiveadminLatlng"
14 | s.description = "Small Active Admin plugin for setting up latitude and longitude."
15 | s.license = "MIT"
16 |
17 | s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc", "README.md"]
18 | s.test_files = Dir["spec/**/*"]
19 |
20 | s.add_dependency "activeadmin"
21 |
22 | s.add_development_dependency 'capybara'
23 | s.add_development_dependency 'rspec-rails'
24 | s.add_development_dependency 'phantomjs'
25 | s.add_development_dependency 'poltergeist'
26 | s.add_development_dependency 'database_cleaner'
27 | s.add_development_dependency 'codecov'
28 | end
29 |
--------------------------------------------------------------------------------
/spec/dummy/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a starting point to setup your application.
15 | # Add necessary setup steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | # Install JavaScript dependencies if using Yarn
22 | # system('bin/yarn')
23 |
24 |
25 | # puts "\n== Copying sample files =="
26 | # unless File.exist?('config/database.yml')
27 | # cp 'config/database.yml.sample', 'config/database.yml'
28 | # end
29 |
30 | puts "\n== Preparing database =="
31 | system! 'bin/rails db:setup'
32 |
33 | puts "\n== Removing old logs and tempfiles =="
34 | system! 'bin/rails log:clear tmp:clear'
35 |
36 | puts "\n== Restarting application server =="
37 | system! 'bin/rails restart'
38 | end
39 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/latlng_proxy.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Views
3 | class LatlngProxy < FormtasticProxy
4 | def build(_, *args, &_block)
5 | @lang, @id_lat, @id_lng, @height, @loading_map, @api_key, @default_lat, @default_lng, @map_zoom = *args
6 | end
7 |
8 | def key
9 | @api_key ? "{@api_key_name}=#{@api_key}" : ''
10 | end
11 |
12 | def script_html
13 | @script_html % [@lang, key]
14 | end
15 |
16 | def loading_map_code
17 | @loading_map ? script_html : ''
18 | end
19 |
20 | def to_s
21 | template = File.read(File.expand_path("../templates/#{@template_name}", __FILE__))
22 | variables = {
23 | loading_map_code: loading_map_code,
24 | height: @height,
25 | id_lat: @id_lat,
26 | id_lng: @id_lng,
27 | map_zoom: @map_zoom,
28 | default_lat: @default_lat,
29 | default_lng: @default_lng
30 | }
31 |
32 | render_template_with_hash(template, variables)
33 | end
34 |
35 | private
36 |
37 | def render_template_with_hash(template, hash)
38 | ERB.new(template).result(OpenStruct.new(hash).instance_eval { binding })
39 | end
40 | end
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/activeadmin_form.rb:
--------------------------------------------------------------------------------
1 | module ActiveAdmin
2 | module Views
3 | class ActiveAdminForm
4 | def latlng **args
5 | class_name = form_builder.object.class.model_name.element
6 | lang = args[:lang] || 'en'
7 | map = args[:map] || :google
8 | id_lat = args[:id_lat] || "#{class_name}_lat"
9 | id_lng = args[:id_lng] || "#{class_name}_lng"
10 | height = args[:height] || 400
11 | loading_map = args[:loading_map] || true
12 | api_key = args[:api_key] || (args[:api_key_env] && ENV[args[:api_key_env]])
13 | default_lat = args[:default_lat] || 55.7522200
14 | default_lng = args[:default_lng] || 37.6155600
15 | map_zoom = args[:map_zoom] || 12
16 |
17 | case map
18 | when :yandex
19 | insert_tag(YandexMapProxy, form_builder, lang, id_lat, id_lng, height, loading_map, api_key, default_lat, default_lng, map_zoom)
20 | when :google
21 | insert_tag(GoogleMapProxy, form_builder, lang, id_lat, id_lng, height, loading_map, api_key, default_lat, default_lng, map_zoom)
22 | when :openstreetmap
23 | insert_tag(OpenStreetMapProxy, form_builder, lang, id_lat, id_lng, height, loading_map, api_key, default_lat, default_lng, map_zoom)
24 | end
25 | end
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/spec/dummy/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rails secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | # Shared secrets are available across all environments.
14 |
15 | # shared:
16 | # api_key: a1B2c3D4e5F6
17 |
18 | # Environmental secrets are only available for that specific environment.
19 |
20 | development:
21 | secret_key_base: 673d1731f58ce44bc5e1878556b6f64caac3ee7c3632c102544a73be91b8d0e2e156751a788b926478e0b496d58bf43a0d73924eb083c83d14b3590ad1660eab
22 |
23 | test:
24 | secret_key_base: 78e64af14d4910c528b80eba0c6f7bf06047d91ee120f96a46c777c9edfdd100d6c67ad4d3f5de9e00d216ed2c5059d6d9e9ff775d1e2b32fe1b0c9b58953ce6
25 |
26 | # Do not keep production secrets in the unencrypted secrets file.
27 | # Instead, either read values from the environment.
28 | # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29 | # and move the `production:` environment over there.
30 |
31 | production:
32 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
33 |
--------------------------------------------------------------------------------
/spec/controllers/admin/coordinates_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Admin::CoordinatesController, type: :controller do
4 | render_views
5 |
6 | let(:page) { Capybara::Node::Simple.new(response.body) }
7 |
8 | describe 'GET new' do
9 | before do
10 | get :new
11 | end
12 |
13 | it 'returns http success' do
14 | expect(response).to have_http_status(:success)
15 | end
16 |
17 | it 'assigns the person' do
18 | expect(assigns(:coordinate)).to be_a_new(Coordinate)
19 | end
20 |
21 | it 'should render the form elements' do
22 | expect(page).to have_field('Lat')
23 | expect(page).to have_field('Lng')
24 | expect(page).to have_selector('div#google_map')
25 | end
26 |
27 | it 'should set up lang' do
28 | pending
29 | expect(page).to have_xpath('.//script')
30 | end
31 |
32 | it 'should set up api key'
33 |
34 | it 'should set up height' do
35 | expect(page).to have_xpath('.//div[@style="height: 345px"]')
36 | end
37 |
38 | it 'should set up default lat' do
39 | expect(page).to have_text('parseFloat($("#" + googleMapObject.idLat).val()) || 32.32')
40 | end
41 |
42 | it 'should set up default lng' do
43 | expect(page).to have_text('parseFloat($("#" + googleMapObject.idLng).val()) || 64.64')
44 | end
45 |
46 | it 'should set up map zoom' do
47 | expect(page).to have_text('zoom: 10')
48 | end
49 | end
50 | end
51 |
--------------------------------------------------------------------------------
/spec/dummy/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/dummy/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 | config.action_mailer.perform_caching = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/templates/yandex.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= loading_map_code %>
3 |
4 |
52 |
53 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports.
13 | config.consider_all_requests_local = true
14 |
15 | # Enable/disable caching. By default caching is disabled.
16 | if Rails.root.join('tmp/caching-dev.txt').exist?
17 | config.action_controller.perform_caching = true
18 |
19 | config.cache_store = :memory_store
20 | config.public_file_server.headers = {
21 | 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22 | }
23 | else
24 | config.action_controller.perform_caching = false
25 |
26 | config.cache_store = :null_store
27 | end
28 |
29 | # Don't care if the mailer can't send.
30 | #config.action_mailer.raise_delivery_errors = false
31 |
32 | #config.action_mailer.perform_caching = false
33 |
34 | # Print deprecation notices to the Rails logger.
35 | config.active_support.deprecation = :log
36 |
37 | # Raise an error on page load if there are pending migrations.
38 | config.active_record.migration_error = :page_load
39 |
40 | # Debug mode disables concatenation and preprocessing of assets.
41 | # This option may cause significant delays in view rendering with a large
42 | # number of complex assets.
43 | config.assets.debug = true
44 |
45 | # Suppress logger output for asset requests.
46 | config.assets.quiet = true
47 |
48 | # Raises error for missing translations
49 | # config.action_view.raise_on_missing_translations = true
50 |
51 | # Use an evented file watcher to asynchronously detect changes in source code,
52 | # routes, locales, etc. This feature depends on the listen gem.
53 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
54 | end
55 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ActiveadminLatlng
2 |
3 | [](https://travis-ci.org/forsaken1/activeadmin-latlng)
4 | [](https://codeclimate.com/github/forsaken1/activeadmin-latlng)
5 | [](https://codecov.io/gh/forsaken1/activeadmin-latlng)
6 |
7 | Active Admin latitude and longitude plugin
8 |
9 | 
10 |
11 |
12 |
13 | ## Getting started
14 |
15 | ```ruby
16 | gem 'activeadmin_latlng'
17 | ```
18 |
19 | ```ruby
20 | form do |f|
21 | f.inputs do
22 | f.input :lat
23 | f.input :lng
24 | f.latlng # add this
25 | end
26 | f.actions
27 | end
28 | ```
29 |
30 |
31 |
32 | ## Settings
33 |
34 | * `lang` - language, `en` by default.
35 |
36 | * `map` - map provider, `google` by default. Available: `google`, `yandex`, `openstreetmap`.
37 |
38 | * `id_lat` and `id_lng` - identificator of latitude and longitude inputs. `_lat` and `_lng` by default.
39 |
40 | * `height` - map height in pixels, `400` by default.
41 |
42 | * `loading_map` - loading map library. `true` by default. Set to `false`, if map loaded in other place.
43 |
44 | * `api_key` - you can send api key to map. WARNING! This is unsafe method, better use ENV-variable.
45 |
46 | * `api_key_env` - you can send name of ENV-variable where storing API key for map.
47 |
48 | * `default_lat` - default latitude for placemark, Moscow latitude by default.
49 |
50 | * `default_lng` - default longitude for placemark, Moscow longitude by default.
51 |
52 | * `map_zoom` - default zoom for map, `12` by default.
53 |
54 | ### Example
55 |
56 | ```ruby
57 | form do |f|
58 | f.inputs do
59 | f.input :lat
60 | f.input :lng
61 | f.latlng lang: :ru, map: :yandex, height: 500, loading_map: false, api_key_env: 'GOOGLE_API_KEY'
62 | end
63 | f.actions
64 | end
65 | ```
66 |
67 |
68 |
69 | ## Contributors
70 |
71 | Alexey Krylov
72 |
73 | ## License
74 |
75 | MIT License. Copyright 2018 Alexey Krylov
76 |
--------------------------------------------------------------------------------
/spec/dummy/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory. If you use this option
30 | # you need to make sure to reconnect any threads in the `on_worker_boot`
31 | # block.
32 | #
33 | # preload_app!
34 |
35 | # If you are preloading your application and using Active Record, it's
36 | # recommended that you close any connections to the database before workers
37 | # are forked to prevent connection leakage.
38 | #
39 | # before_fork do
40 | # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41 | # end
42 |
43 | # The code in the `on_worker_boot` will be called if you are using
44 | # clustered mode by specifying a number of `workers`. After each worker
45 | # process is booted, this block will be run. If you are using the `preload_app!`
46 | # option, you will want to use this block to reconnect to any threads
47 | # or connections that may have been created at application boot, as Ruby
48 | # cannot share connections between processes.
49 | #
50 | # on_worker_boot do
51 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52 | # end
53 | #
54 |
55 | # Allow puma to be restarted by `rails restart` command.
56 | plugin :tmp_restart
57 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | ENV["RAILS_ENV"] ||= 'test'
3 | require 'spec_helper'
4 | require File.expand_path("../dummy/config/environment", __FILE__)
5 | # Add additional requires below this line. Rails is not loaded until this point!
6 |
7 | require 'rspec/rails'
8 | require 'capybara/rails'
9 | require 'phantomjs/poltergeist'
10 | require 'database_cleaner'
11 |
12 | require 'simplecov'
13 | SimpleCov.start
14 |
15 | require 'codecov'
16 | SimpleCov.formatter = SimpleCov::Formatter::Codecov
17 |
18 | Capybara.javascript_driver = :poltergeist
19 |
20 | def reload_menus!
21 | ActiveAdmin.application.namespaces.each { |n| n.reset_menu! }
22 | end
23 |
24 | def reload_routes!
25 | Rails.application.reload_routes!
26 | end
27 |
28 | # Setup ActiveAdmin
29 | ActiveAdmin.application.load_paths = [File.expand_path("../dummy/app/admin", __FILE__)]
30 | ActiveAdmin.unload!
31 | ActiveAdmin.load!
32 | reload_menus!
33 | reload_routes!
34 |
35 | # Disabling authentication in specs so that we don't have to worry about
36 | # it allover the place
37 | ActiveAdmin.application.authentication_method = false
38 | ActiveAdmin.application.current_user_method = false
39 |
40 | # Requires supporting ruby files with custom matchers and macros, etc, in
41 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
42 | # run as spec files by default. This means that files in spec/support that end
43 | # in _spec.rb will both be required and run as specs, causing the specs to be
44 | # run twice. It is recommended that you do not name files matching this glob to
45 | # end with _spec.rb. You can configure this pattern with the --pattern
46 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
47 | #
48 | # The following line is provided for convenience purposes. It has the downside
49 | # of increasing the boot-up time by auto-requiring all files in the support
50 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
51 | # require only the support files necessary.
52 | #
53 | # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
54 |
55 | # Checks for pending migrations before tests are run.
56 | # If you are not using ActiveRecord, you can remove this line.
57 | ActiveRecord::Migration.maintain_test_schema!
58 |
59 | RSpec.configure do |config|
60 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
61 | # examples within a transaction, remove the following line or assign false
62 | # instead of true.
63 | config.use_transactional_fixtures = false
64 |
65 | # RSpec Rails can automatically mix in different behaviours to your tests
66 | # based on their file location, for example enabling you to call `get` and
67 | # `post` in specs under `spec/controllers`.
68 | #
69 | # You can disable this behaviour by removing the line below, and instead
70 | # explicitly tag your specs with their type, e.g.:
71 | #
72 | # RSpec.describe UsersController, :type => :controller do
73 | # # ...
74 | # end
75 | #
76 | # The different available types are documented in the features, such as in
77 | # https://relishapp.com/rspec/rspec-rails/docs
78 |
79 | config.before(:each) do
80 | DatabaseCleaner.strategy = :transaction
81 | end
82 |
83 | config.before(:each, js: true) do
84 | DatabaseCleaner.strategy = :truncation
85 | end
86 |
87 | config.before(:each) do
88 | DatabaseCleaner.start
89 | end
90 |
91 | config.after(:each) do
92 | DatabaseCleaner.clean
93 | end
94 |
95 | config.infer_spec_type_from_file_location!
96 | end
97 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/templates/google.html.erb:
--------------------------------------------------------------------------------
1 |
97 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
18 | # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
19 | # `config/secrets.yml.key`.
20 | config.read_encrypted_secrets = true
21 |
22 | # Disable serving static files from the `/public` folder by default since
23 | # Apache or NGINX already handles this.
24 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
25 |
26 | # Compress JavaScripts and CSS.
27 | config.assets.js_compressor = :uglifier
28 | # config.assets.css_compressor = :sass
29 |
30 | # Do not fallback to assets pipeline if a precompiled asset is missed.
31 | config.assets.compile = false
32 |
33 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
34 |
35 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
36 | # config.action_controller.asset_host = 'http://assets.example.com'
37 |
38 | # Specifies the header that your server uses for sending files.
39 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41 |
42 | # Mount Action Cable outside main process or domain
43 | # config.action_cable.mount_path = nil
44 | # config.action_cable.url = 'wss://example.com/cable'
45 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
46 |
47 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
48 | # config.force_ssl = true
49 |
50 | # Use the lowest log level to ensure availability of diagnostic information
51 | # when problems arise.
52 | config.log_level = :debug
53 |
54 | # Prepend all log lines with the following tags.
55 | config.log_tags = [ :request_id ]
56 |
57 | # Use a different cache store in production.
58 | # config.cache_store = :mem_cache_store
59 |
60 | # Use a real queuing backend for Active Job (and separate queues per environment)
61 | # config.active_job.queue_adapter = :resque
62 | # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
63 | config.action_mailer.perform_caching = false
64 |
65 | # Ignore bad email addresses and do not raise email delivery errors.
66 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
67 | # config.action_mailer.raise_delivery_errors = false
68 |
69 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
70 | # the I18n.default_locale when a translation cannot be found).
71 | config.i18n.fallbacks = true
72 |
73 | # Send deprecation notices to registered listeners.
74 | config.active_support.deprecation = :notify
75 |
76 | # Use default logging formatter so that PID and timestamp are not suppressed.
77 | config.log_formatter = ::Logger::Formatter.new
78 |
79 | # Use a different logger for distributed setups.
80 | # require 'syslog/logger'
81 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
82 |
83 | if ENV["RAILS_LOG_TO_STDOUT"].present?
84 | logger = ActiveSupport::Logger.new(STDOUT)
85 | logger.formatter = config.log_formatter
86 | config.logger = ActiveSupport::TaggedLogging.new(logger)
87 | end
88 |
89 | # Do not dump schema after migrations.
90 | config.active_record.dump_schema_after_migration = false
91 | end
92 |
--------------------------------------------------------------------------------
/lib/activeadmin/views/templates/openstreetmap.html.erb:
--------------------------------------------------------------------------------
1 |
116 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause this
4 | # file to always be loaded, without a need to explicitly require it in any files.
5 | #
6 | # Given that it is always loaded, you are encouraged to keep this file as
7 | # light-weight as possible. Requiring heavyweight dependencies from this file
8 | # will add to the boot time of your test suite on EVERY test run, even for an
9 | # individual file that may not need all of that loaded. Instead, consider making
10 | # a separate helper file that requires the additional dependencies and performs
11 | # the additional setup, and require it from the spec files that actually need it.
12 | #
13 | # The `.rspec` file also contains a few flags that are not defaults but that
14 | # users commonly want.
15 | #
16 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17 |
18 | RSpec.configure do |config|
19 | # rspec-expectations config goes here. You can use an alternate
20 | # assertion/expectation library such as wrong or the stdlib/minitest
21 | # assertions if you prefer.
22 | config.expect_with :rspec do |expectations|
23 | # This option will default to `true` in RSpec 4. It makes the `description`
24 | # and `failure_message` of custom matchers include text for helper methods
25 | # defined using `chain`, e.g.:
26 | # be_bigger_than(2).and_smaller_than(4).description
27 | # # => "be bigger than 2 and smaller than 4"
28 | # ...rather than:
29 | # # => "be bigger than 2"
30 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31 | end
32 |
33 | # rspec-mocks config goes here. You can use an alternate test double
34 | # library (such as bogus or mocha) by changing the `mock_with` option here.
35 | config.mock_with :rspec do |mocks|
36 | # Prevents you from mocking or stubbing a method that does not exist on
37 | # a real object. This is generally recommended, and will default to
38 | # `true` in RSpec 4.
39 | mocks.verify_partial_doubles = true
40 | end
41 |
42 | # The settings below are suggested to provide a good initial experience
43 | # with RSpec, but feel free to customize to your heart's content.
44 | =begin
45 | # These two settings work together to allow you to limit a spec run
46 | # to individual examples or groups you care about by tagging them with
47 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48 | # get run.
49 | config.filter_run :focus
50 | config.run_all_when_everything_filtered = true
51 |
52 | # Limits the available syntax to the non-monkey patched syntax that is recommended.
53 | # For more details, see:
54 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
55 | # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
56 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
57 | config.disable_monkey_patching!
58 |
59 | # Many RSpec users commonly either run the entire suite or an individual
60 | # file, and it's useful to allow more verbose output when running an
61 | # individual spec file.
62 | if config.files_to_run.one?
63 | # Use the documentation formatter for detailed output,
64 | # unless a formatter has already been configured
65 | # (e.g. via a command-line flag).
66 | config.default_formatter = 'doc'
67 | end
68 |
69 | # Print the 10 slowest examples and example groups at the
70 | # end of the spec run, to help surface which specs are running
71 | # particularly slow.
72 | config.profile_examples = 10
73 |
74 | # Run specs in random order to surface order dependencies. If you find an
75 | # order dependency and want to debug it, you can fix the order by providing
76 | # the seed, which is printed after each run.
77 | # --seed 1234
78 | config.order = :random
79 |
80 | # Seed global randomization in this process using the `--seed` CLI option.
81 | # Setting this allows you to use `--seed` to deterministically reproduce
82 | # test failures related to randomization by passing the same `--seed` value
83 | # as the one that triggered the failure.
84 | Kernel.srand config.seed
85 | =end
86 | end
87 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: .
3 | specs:
4 | activeadmin_latlng (1.5.0)
5 | activeadmin
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actioncable (5.1.2)
11 | actionpack (= 5.1.2)
12 | nio4r (~> 2.0)
13 | websocket-driver (~> 0.6.1)
14 | actionmailer (5.1.2)
15 | actionpack (= 5.1.2)
16 | actionview (= 5.1.2)
17 | activejob (= 5.1.2)
18 | mail (~> 2.5, >= 2.5.4)
19 | rails-dom-testing (~> 2.0)
20 | actionpack (5.1.2)
21 | actionview (= 5.1.2)
22 | activesupport (= 5.1.2)
23 | rack (~> 2.0)
24 | rack-test (~> 0.6.3)
25 | rails-dom-testing (~> 2.0)
26 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
27 | actionview (5.1.2)
28 | activesupport (= 5.1.2)
29 | builder (~> 3.1)
30 | erubi (~> 1.4)
31 | rails-dom-testing (~> 2.0)
32 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
33 | activeadmin (1.4.3)
34 | arbre (>= 1.1.1)
35 | coffee-rails
36 | formtastic (~> 3.1)
37 | formtastic_i18n
38 | inherited_resources (>= 1.9.0)
39 | jquery-rails (>= 4.2.0)
40 | kaminari (>= 0.15)
41 | railties (>= 4.2, < 5.3)
42 | ransack (>= 1.8.7)
43 | sass (~> 3.1)
44 | sprockets (< 4.1)
45 | activejob (5.1.2)
46 | activesupport (= 5.1.2)
47 | globalid (>= 0.3.6)
48 | activemodel (5.1.2)
49 | activesupport (= 5.1.2)
50 | activerecord (5.1.2)
51 | activemodel (= 5.1.2)
52 | activesupport (= 5.1.2)
53 | arel (~> 8.0)
54 | activesupport (5.1.2)
55 | concurrent-ruby (~> 1.0, >= 1.0.2)
56 | i18n (~> 0.7)
57 | minitest (~> 5.1)
58 | tzinfo (~> 1.1)
59 | addressable (2.5.1)
60 | public_suffix (~> 2.0, >= 2.0.2)
61 | arbre (1.2.1)
62 | activesupport (>= 3.0.0)
63 | arel (8.0.0)
64 | builder (3.2.3)
65 | byebug (10.0.2)
66 | capybara (2.11.0)
67 | addressable
68 | mime-types (>= 1.16)
69 | nokogiri (>= 1.3.3)
70 | rack (>= 1.0.0)
71 | rack-test (>= 0.5.4)
72 | xpath (~> 2.0)
73 | cliver (0.3.2)
74 | codecov (0.1.10)
75 | json
76 | simplecov
77 | url
78 | coffee-rails (4.2.2)
79 | coffee-script (>= 2.2.0)
80 | railties (>= 4.0.0)
81 | coffee-script (2.4.1)
82 | coffee-script-source
83 | execjs
84 | coffee-script-source (1.12.2)
85 | concurrent-ruby (1.0.5)
86 | database_cleaner (1.6.1)
87 | diff-lcs (1.3)
88 | docile (1.1.5)
89 | erubi (1.6.1)
90 | execjs (2.7.0)
91 | ffi (1.9.18)
92 | formtastic (3.1.5)
93 | actionpack (>= 3.2.13)
94 | formtastic_i18n (0.6.0)
95 | globalid (0.4.0)
96 | activesupport (>= 4.2.0)
97 | has_scope (0.7.2)
98 | actionpack (>= 4.1)
99 | activesupport (>= 4.1)
100 | i18n (0.8.4)
101 | inherited_resources (1.10.0)
102 | actionpack (>= 5.0, < 6.0)
103 | has_scope (~> 0.6)
104 | railties (>= 5.0, < 6.0)
105 | responders (~> 2.0)
106 | jquery-rails (4.3.3)
107 | rails-dom-testing (>= 1, < 3)
108 | railties (>= 4.2.0)
109 | thor (>= 0.14, < 2.0)
110 | json (2.1.0)
111 | kaminari (1.1.1)
112 | activesupport (>= 4.1.0)
113 | kaminari-actionview (= 1.1.1)
114 | kaminari-activerecord (= 1.1.1)
115 | kaminari-core (= 1.1.1)
116 | kaminari-actionview (1.1.1)
117 | actionview
118 | kaminari-core (= 1.1.1)
119 | kaminari-activerecord (1.1.1)
120 | activerecord
121 | kaminari-core (= 1.1.1)
122 | kaminari-core (1.1.1)
123 | listen (3.0.8)
124 | rb-fsevent (~> 0.9, >= 0.9.4)
125 | rb-inotify (~> 0.9, >= 0.9.7)
126 | loofah (2.0.3)
127 | nokogiri (>= 1.5.9)
128 | mail (2.6.6)
129 | mime-types (>= 1.16, < 4)
130 | method_source (0.8.2)
131 | mime-types (3.1)
132 | mime-types-data (~> 3.2015)
133 | mime-types-data (3.2016.0521)
134 | mini_portile2 (2.2.0)
135 | minitest (5.10.2)
136 | nio4r (2.1.0)
137 | nokogiri (1.8.0)
138 | mini_portile2 (~> 2.2.0)
139 | phantomjs (1.9.8.0)
140 | poltergeist (1.12.0)
141 | capybara (~> 2.1)
142 | cliver (~> 0.3.1)
143 | websocket-driver (>= 0.2.0)
144 | public_suffix (2.0.5)
145 | rack (2.0.3)
146 | rack-test (0.6.3)
147 | rack (>= 1.0)
148 | rails (5.1.2)
149 | actioncable (= 5.1.2)
150 | actionmailer (= 5.1.2)
151 | actionpack (= 5.1.2)
152 | actionview (= 5.1.2)
153 | activejob (= 5.1.2)
154 | activemodel (= 5.1.2)
155 | activerecord (= 5.1.2)
156 | activesupport (= 5.1.2)
157 | bundler (>= 1.3.0, < 2.0)
158 | railties (= 5.1.2)
159 | sprockets-rails (>= 2.0.0)
160 | rails-controller-testing (1.0.2)
161 | actionpack (~> 5.x, >= 5.0.1)
162 | actionview (~> 5.x, >= 5.0.1)
163 | activesupport (~> 5.x)
164 | rails-dom-testing (2.0.3)
165 | activesupport (>= 4.2.0)
166 | nokogiri (>= 1.6)
167 | rails-html-sanitizer (1.0.3)
168 | loofah (~> 2.0)
169 | railties (5.1.2)
170 | actionpack (= 5.1.2)
171 | activesupport (= 5.1.2)
172 | method_source
173 | rake (>= 0.8.7)
174 | thor (>= 0.18.1, < 2.0)
175 | rake (12.0.0)
176 | ransack (2.1.1)
177 | actionpack (>= 5.0)
178 | activerecord (>= 5.0)
179 | activesupport (>= 5.0)
180 | i18n
181 | rb-fsevent (0.9.8)
182 | rb-inotify (0.9.10)
183 | ffi (>= 0.5.0, < 2)
184 | responders (2.4.1)
185 | actionpack (>= 4.2.0, < 6.0)
186 | railties (>= 4.2.0, < 6.0)
187 | rspec-core (3.6.0)
188 | rspec-support (~> 3.6.0)
189 | rspec-expectations (3.6.0)
190 | diff-lcs (>= 1.2.0, < 2.0)
191 | rspec-support (~> 3.6.0)
192 | rspec-mocks (3.6.0)
193 | diff-lcs (>= 1.2.0, < 2.0)
194 | rspec-support (~> 3.6.0)
195 | rspec-rails (3.6.0)
196 | actionpack (>= 3.0)
197 | activesupport (>= 3.0)
198 | railties (>= 3.0)
199 | rspec-core (~> 3.6.0)
200 | rspec-expectations (~> 3.6.0)
201 | rspec-mocks (~> 3.6.0)
202 | rspec-support (~> 3.6.0)
203 | rspec-support (3.6.0)
204 | sass (3.7.4)
205 | sass-listen (~> 4.0.0)
206 | sass-listen (4.0.0)
207 | rb-fsevent (~> 0.9, >= 0.9.4)
208 | rb-inotify (~> 0.9, >= 0.9.7)
209 | simplecov (0.14.1)
210 | docile (~> 1.1.0)
211 | json (>= 1.8, < 3)
212 | simplecov-html (~> 0.10.0)
213 | simplecov-html (0.10.1)
214 | sprockets (3.7.1)
215 | concurrent-ruby (~> 1.0)
216 | rack (> 1, < 3)
217 | sprockets-rails (3.2.0)
218 | actionpack (>= 4.0)
219 | activesupport (>= 4.0)
220 | sprockets (>= 3.0.0)
221 | sqlite3 (1.3.13)
222 | thor (0.19.4)
223 | thread_safe (0.3.6)
224 | tzinfo (1.2.3)
225 | thread_safe (~> 0.1)
226 | url (0.3.2)
227 | websocket-driver (0.6.5)
228 | websocket-extensions (>= 0.1.0)
229 | websocket-extensions (0.1.2)
230 | xpath (2.1.0)
231 | nokogiri (~> 1.3)
232 |
233 | PLATFORMS
234 | ruby
235 |
236 | DEPENDENCIES
237 | activeadmin_latlng!
238 | byebug
239 | capybara
240 | codecov
241 | database_cleaner
242 | listen
243 | phantomjs
244 | poltergeist
245 | rails (~> 5)
246 | rails-controller-testing
247 | rspec-rails
248 | simplecov
249 | sqlite3
250 |
251 | BUNDLED WITH
252 | 1.16.3
253 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/active_admin.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.setup do |config|
2 | # == Site Title
3 | #
4 | # Set the title that is displayed on the main layout
5 | # for each of the active admin pages.
6 | #
7 | config.site_title = "Dummy"
8 |
9 | # Set the link url for the title. For example, to take
10 | # users to your main site. Defaults to no link.
11 | #
12 | # config.site_title_link = "/"
13 |
14 | # Set an optional image to be displayed for the header
15 | # instead of a string (overrides :site_title)
16 | #
17 | # Note: Aim for an image that's 21px high so it fits in the header.
18 | #
19 | # config.site_title_image = "logo.png"
20 |
21 | # == Default Namespace
22 | #
23 | # Set the default namespace each administration resource
24 | # will be added to.
25 | #
26 | # eg:
27 | # config.default_namespace = :hello_world
28 | #
29 | # This will create resources in the HelloWorld module and
30 | # will namespace routes to /hello_world/*
31 | #
32 | # To set no namespace by default, use:
33 | # config.default_namespace = false
34 | #
35 | # Default:
36 | # config.default_namespace = :admin
37 | #
38 | # You can customize the settings for each namespace by using
39 | # a namespace block. For example, to change the site title
40 | # within a namespace:
41 | #
42 | # config.namespace :admin do |admin|
43 | # admin.site_title = "Custom Admin Title"
44 | # end
45 | #
46 | # This will ONLY change the title for the admin section. Other
47 | # namespaces will continue to use the main "site_title" configuration.
48 |
49 | # == User Authentication
50 | #
51 | # Active Admin will automatically call an authentication
52 | # method in a before filter of all controller actions to
53 | # ensure that there is a currently logged in admin user.
54 | #
55 | # This setting changes the method which Active Admin calls
56 | # within the application controller.
57 | # config.authentication_method = :authenticate_admin_user!
58 |
59 | # == User Authorization
60 | #
61 | # Active Admin will automatically call an authorization
62 | # method in a before filter of all controller actions to
63 | # ensure that there is a user with proper rights. You can use
64 | # CanCanAdapter or make your own. Please refer to documentation.
65 | # config.authorization_adapter = ActiveAdmin::CanCanAdapter
66 |
67 | # In case you prefer Pundit over other solutions you can here pass
68 | # the name of default policy class. This policy will be used in every
69 | # case when Pundit is unable to find suitable policy.
70 | # config.pundit_default_policy = "MyDefaultPunditPolicy"
71 |
72 | # You can customize your CanCan Ability class name here.
73 | # config.cancan_ability_class = "Ability"
74 |
75 | # You can specify a method to be called on unauthorized access.
76 | # This is necessary in order to prevent a redirect loop which happens
77 | # because, by default, user gets redirected to Dashboard. If user
78 | # doesn't have access to Dashboard, he'll end up in a redirect loop.
79 | # Method provided here should be defined in application_controller.rb.
80 | # config.on_unauthorized_access = :access_denied
81 |
82 | # == Current User
83 | #
84 | # Active Admin will associate actions with the current
85 | # user performing them.
86 | #
87 | # This setting changes the method which Active Admin calls
88 | # (within the application controller) to return the currently logged in user.
89 | # config.current_user_method = :current_admin_user
90 |
91 | # == Logging Out
92 | #
93 | # Active Admin displays a logout link on each screen. These
94 | # settings configure the location and method used for the link.
95 | #
96 | # This setting changes the path where the link points to. If it's
97 | # a string, the strings is used as the path. If it's a Symbol, we
98 | # will call the method to return the path.
99 | #
100 | # Default:
101 | config.logout_link_path = :destroy_admin_user_session_path
102 |
103 | # This setting changes the http method used when rendering the
104 | # link. For example :get, :delete, :put, etc..
105 | #
106 | # Default:
107 | # config.logout_link_method = :get
108 |
109 | # == Root
110 | #
111 | # Set the action to call for the root path. You can set different
112 | # roots for each namespace.
113 | #
114 | # Default:
115 | # config.root_to = 'dashboard#index'
116 |
117 | # == Admin Comments
118 | #
119 | # This allows your users to comment on any resource registered with Active Admin.
120 | #
121 | # You can completely disable comments:
122 | config.comments = false
123 | #
124 | # You can change the name under which comments are registered:
125 | # config.comments_registration_name = 'AdminComment'
126 | #
127 | # You can change the order for the comments and you can change the column
128 | # to be used for ordering:
129 | # config.comments_order = 'created_at ASC'
130 | #
131 | # You can disable the menu item for the comments index page:
132 | # config.comments_menu = false
133 | #
134 | # You can customize the comment menu:
135 | # config.comments_menu = { parent: 'Admin', priority: 1 }
136 |
137 | # == Batch Actions
138 | #
139 | # Enable and disable Batch Actions
140 | #
141 | config.batch_actions = true
142 |
143 | # == Controller Filters
144 | #
145 | # You can add before, after and around filters to all of your
146 | # Active Admin resources and pages from here.
147 | #
148 | # config.before_action :do_something_awesome
149 |
150 | # == Localize Date/Time Format
151 | #
152 | # Set the localize format to display dates and times.
153 | # To understand how to localize your app with I18n, read more at
154 | # https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52
155 | #
156 | config.localize_format = :long
157 |
158 | # == Setting a Favicon
159 | #
160 | # config.favicon = 'favicon.ico'
161 |
162 | # == Meta Tags
163 | #
164 | # Add additional meta tags to the head element of active admin pages.
165 | #
166 | # Add tags to all pages logged in users see:
167 | # config.meta_tags = { author: 'My Company' }
168 |
169 | # By default, sign up/sign in/recover password pages are excluded
170 | # from showing up in search engine results by adding a robots meta
171 | # tag. You can reset the hash of meta tags included in logged out
172 | # pages:
173 | # config.meta_tags_for_logged_out_pages = {}
174 |
175 | # == Removing Breadcrumbs
176 | #
177 | # Breadcrumbs are enabled by default. You can customize them for individual
178 | # resources or you can disable them globally from here.
179 | #
180 | # config.breadcrumb = false
181 |
182 | # == Create Another Checkbox
183 | #
184 | # Create another checkbox is disabled by default. You can customize it for individual
185 | # resources or you can enable them globally from here.
186 | #
187 | # config.create_another = true
188 |
189 | # == Register Stylesheets & Javascripts
190 | #
191 | # We recommend using the built in Active Admin layout and loading
192 | # up your own stylesheets / javascripts to customize the look
193 | # and feel.
194 | #
195 | # To load a stylesheet:
196 | # config.register_stylesheet 'my_stylesheet.css'
197 | #
198 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
199 | # config.register_stylesheet 'my_print_stylesheet.css', media: :print
200 | #
201 | # To load a javascript file:
202 | # config.register_javascript 'my_javascript.js'
203 |
204 | # == CSV options
205 | #
206 | # Set the CSV builder separator
207 | # config.csv_options = { col_sep: ';' }
208 | #
209 | # Force the use of quotes
210 | # config.csv_options = { force_quotes: true }
211 |
212 | # == Menu System
213 | #
214 | # You can add a navigation menu to be used in your application, or configure a provided menu
215 | #
216 | # To change the default utility navigation to show a link to your website & a logout btn
217 | #
218 | # config.namespace :admin do |admin|
219 | # admin.build_menu :utility_navigation do |menu|
220 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
221 | # admin.add_logout_button_to_menu menu
222 | # end
223 | # end
224 | #
225 | # If you wanted to add a static menu item to the default menu provided:
226 | #
227 | # config.namespace :admin do |admin|
228 | # admin.build_menu :default do |menu|
229 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
230 | # end
231 | # end
232 |
233 | # == Download Links
234 | #
235 | # You can disable download links on resource listing pages,
236 | # or customize the formats shown per namespace/globally
237 | #
238 | # To disable/customize for the :admin namespace:
239 | #
240 | # config.namespace :admin do |admin|
241 | #
242 | # # Disable the links entirely
243 | # admin.download_links = false
244 | #
245 | # # Only show XML & PDF options
246 | # admin.download_links = [:xml, :pdf]
247 | #
248 | # # Enable/disable the links based on block
249 | # # (for example, with cancan)
250 | # admin.download_links = proc { can?(:view_download_links) }
251 | #
252 | # end
253 |
254 | # == Pagination
255 | #
256 | # Pagination is enabled by default for all resources.
257 | # You can control the default per page count for all resources here.
258 | #
259 | # config.default_per_page = 30
260 | #
261 | # You can control the max per page count too.
262 | #
263 | # config.max_per_page = 10_000
264 |
265 | # == Filters
266 | #
267 | # By default the index screen includes a "Filters" sidebar on the right
268 | # hand side with a filter for each attribute of the registered model.
269 | # You can enable or disable them for all resources here.
270 | #
271 | # config.filters = true
272 | #
273 | # By default the filters include associations in a select, which means
274 | # that every record will be loaded for each association.
275 | # You can enabled or disable the inclusion
276 | # of those filters by default here.
277 | #
278 | # config.include_default_association_filters = true
279 |
280 | # == Footer
281 | #
282 | # By default, the footer shows the current Active Admin version. You can
283 | # override the content of the footer here.
284 | #
285 | # config.footer = 'my custom footer text'
286 |
287 | # == Sorting
288 | #
289 | # By default ActiveAdmin::OrderClause is used for sorting logic
290 | # You can inherit it with own class and inject it for all resources
291 | #
292 | # config.order_clause = MyOrderClause
293 | end
294 |
--------------------------------------------------------------------------------