Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails_admin_yamap_field

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_admin_yamap_field

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RailsAdminYamapField

Simple implementation of Yandex maps in rails admin.

Inspired by these projects:

  • Rails Admin Map Field
  • RailsAdminGoogleMap
  • Rails Admin Place Field

Installation

Add this line to your application's Gemfile:

gem 'rails_admin_yamap_field'

And then execute:

$ bundle

Usage

Add attr_accessor ya_map to you model for which you need to show the map or define ya_map and ya_map= methods as you wish, for example:

class Address < ApplicationRecord
  # others methods
  def ya_map=(lat_lon)
    self[:lat], self[:lon] = lat_lon.split(",")
  end
  def ya_map
    [lat, lon].join(",")
  end
  # others methods
end

Available options for configure in rails_admin:

  • center_lat - map center latitude
  • center_long - map center longitude
  • zoom_level - map zoom level
  • map_html_width - width div map container: default '100%'
  • map_html_height - height div map container: default '500px'
  • map_lang - language map: default 'ru_RU', for other values see this ref
  • api_key - api key for enterprise version: default 'nil'
  • latitude_field - latitude attribute name in you model: default 'latitude'
  • longitude_field - longitude attribute name in you model: default 'longitude'

Example:

class Address < ApplicationRecord
  attr_accessor :ya_map

  rails_admin do
    field :lat, :hidden
    field :lon, :hidden
    field :ya_map, :yamap_field do
      map_html_width "600px"
      latitude_field :lat
      longitude_field :lon
     end
  end
end

Screenshot

Sample screenshot

References

Contributing

Feel free to send pull requests or write issue.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 12 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc