Allow setting location in members/:id/nearby

It currently doesn't actually do anything, but the thought's there.
This commit is contained in:
Miles Gould
2013-03-28 12:40:18 +00:00
parent be2c2626f7
commit fed8ce2c17
4 changed files with 23 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ class MembersController < ApplicationController
end
def nearby
@location = params[:location] || current_member.location
@nearby_members = [current_member]
respond_to do |format|
format.html # nearby.html.haml

View File

@@ -1,8 +1,23 @@
- content_for :title, "Members near you"
- if @location != current_member.location
- content_for :title, "Members near #{@location}"
- else
- content_for :title, "Members near you"
= link_to "Edit your location", edit_member_registration_path(current_member)
= form_tag(nearby_members_path(current_member), :html => { :method => :get, :class => 'form-horizontal' }) do
.control-group
= label_tag :location, "Location", :class => 'control-label'
.controls
= text_field_tag :location, @location
.form-actions
= submit_tag "Search", :class => 'btn btn-primary'
%ul
- @nearby_members.each do |member|
%li
= link_to(member.login_name, member)
,
= member.location
- if member.location
, #{@member.location}

View File

@@ -14,6 +14,9 @@
= @member.location
%br/
= image_tag("http://maps.google.com/maps/api/staticmap?size=200x200&maptype=roadmap&sensor=false&markers=color:green|label:A|#{@member.latitude},#{@member.longitude}&zoom=12", :alt => "Map showing #{@member.location}", :width => 200, :height => 200 )
- if current_member == @member
%p
= link_to 'Show nearby members', nearby_members_path(@member)
- if @member.show_email
%p
Email:

View File

@@ -15,7 +15,7 @@ Growstuff::Application.routes.draw do
get "home/index"
match 'members/:id/nearby' => 'members#nearby'
match 'members/:id/nearby' => 'members#nearby', :as => :nearby_members
# The priority is based upon order of creation:
# first created -> highest priority.