Permalink
Browse files

adding waypoints in one area

  • Loading branch information...
1 parent 95d4f0b commit bb655908fed0c636a3f6d6306acbf9d075b9f728 @akwiatkowski committed May 31, 2012
View
@@ -47,7 +47,7 @@ class Waypoint < ActiveRecord::Base
}
def google_maps_path(map_zoom = 15)
- "http://maps.google.com/maps?q=#{lat},#{lon}&z=#{map_zoom}"
+ "http://maps.google.com/maps?q=#{lat},#{lon}&z=#{map_zoom}&t=p"
end
def alt
@@ -1,44 +1,14 @@
= simple_form_for @waypoint do |f|
= f.input :lat
= f.input :lon
+ = f.input :dms_coords
= f.input :elevation
= f.input :name
= f.input :sym, as: :select, collection: Waypoint::SYMBOLS.keys, include_blank: false
- = f.input :area_id, as: :select, collection: Area.all
+ = f.input :area_id, as: :select, collection: Area.all#, :selected => @waypoint.area_id || params[:area_id]
= f.button :submit
%p
%b Google maps:
= link_to "map", @waypoint.google_maps_path
-
-
-- if false
- = form_for @waypoint do |f|
- -if @waypoint.errors.any?
- #error_explanation
- %h2= "#{pluralize(@waypoint.errors.count, "error")} prohibited this waypoint from being saved:"
- %ul
- - @waypoint.errors.full_messages.each do |msg|
- %li= msg
-
- .field
- = f.label :lat
- = f.text_field :lat
- .field
- = f.label :lon
- = f.text_field :lon
- .field
- = f.label :elevation
- = f.number_field :elevation
- .field
- = f.label :name
- = f.text_field :name
- .field
- = f.label :sym
- = f.select :sym, Waypoint::SYMBOLS.keys
- .field
- = f.label :area
- = f.select :area, Area.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }
- .actions
- = f.submit 'Save'
@@ -47,4 +47,11 @@
= paginate @waypoints
%br
-= link_to 'New Waypoint', new_waypoint_path
+- if params[:area_id]
+ - _area = Area.find(params[:area_id])
+ = link_to new_area_waypoint_path(_area) do
+ = "New Waypoint in "
+ %strong
+ = _area.name
+- else
+ = link_to 'New Waypoint', new_waypoint_path
@@ -20,7 +20,7 @@
= @waypoint.area.name unless @waypoint.area.nil?
%p
%b Google maps:
- = link_to "map", @waypoint.google_maps_path
+ = link_to "map", @waypoint.google_maps_path, target: '_blank'
= link_to 'Edit', edit_waypoint_path(@waypoint)
\|

0 comments on commit bb65590

Please sign in to comment.