Form helpers for edit fields such as zoom, longitude and latitude
Add this line to your application's Gemfile:
gem 'rails-marker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails-marker
For example you have model office:
# == Schema Information
#
# Table name: offices
#
# id :integer(4) not null, primary key
# title :string(255) not null
# address :string(255)
# phone :string(255)
# email :string(255)
# longitude :float
# latitude :float
# zoom :integer(1)
# created_at :datetime not null
# updated_at :datetime not null
#
class Office < ActiveRecord::Base
validates_presence_of :title, :address
validates_numericality_of :latitude, :longitude
attr_accessible :address, :email, :latitude, :longitude, :phone, :title, :is_visible, :zoom
end
And you want edit fields zoom, longitude and latitude:
<%= form_for @office do |f| %>
<%= f.marker_field :marker %>
<% end %>
It's all you need! Just move the marker, and zoom, latitude and longitude fields will be automatically filled:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright (c) 2012 Aimbulance, released under the MIT license