Sha256: 58095d23310ab01b8b384789b71bb0075fe900d1b3b69c770f51f6c29d5ea5bc
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# -*- encoding : utf-8 -*- module RademadeAdmin class LocationInput < SimpleForm::Inputs::Base def input template.content_tag( :div, HtmlBuffer.new([map_html, location_attributes_html]), { :class => 'location' } ) end private def map_html template.content_tag(:div, '', { :id => "map_#{object.id}", :class => 'map' }) end def location_attributes_html location_attributes = object.send(attribute_name) HtmlBuffer.new([ location_attribute_html(location_attributes, :latitude), location_attribute_html(location_attributes, :longitude), location_attribute_html(location_attributes, :zoom, 1) ]) end def location_attribute_html(location_attributes, name, default_value = 0) template.content_tag(:input, '', { :type => 'hidden', :name => "data[#{attribute_name}][#{name}]", :value => location_attributes[name] || default_value, :data => { :location_attribute => name } }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.1.1 | app/inputs/rademade_admin/location_input.rb |