Skip to content
Browse files

SOC-7 and SOC-9 completed.

  • Loading branch information...
1 parent 90e536e commit 09e363466cb6387dda48de386eff3af1820e37ee Eric Ryan Jones committed Oct 20, 2013
Showing with 12 additions and 8 deletions.
  1. +2 −2 app/controllers/dashboard_controller.rb
  2. +2 −2 app/models/user.rb
  3. +8 −4 app/views/dashboard/index.html.erb
View
4 app/controllers/dashboard_controller.rb
@@ -5,9 +5,9 @@ def index
@my_topics = Topic.find_all_by_user_id(current_user.id)
if params[:search].present?
- @users = User.near(params[:search], 50, :order => :distance)
+ @user_search = User.near(params[:search], 50, :order => :distance)
else
- @users = User.new()
+ @user_search = NIL
end
end
end
View
4 app/models/user.rb
@@ -1,12 +1,12 @@
class User < ActiveRecord::Base
extend FriendlyId
- friendly_id :name, use: :slugged
+ geocoded_by :address
+ friendly_id :name, use: :slugged
rolify
acts_as_tagger
acts_as_taggable
acts_as_taggable_on :interest
- geocoded_by :address
after_validation :geocode, :if => :address_changed?
View
12 app/views/dashboard/index.html.erb
@@ -38,12 +38,16 @@
<% end %>
<% if params[:search].present? %>
<h3>Nearby guides</h3>
- <ul>
- <% for guides in @users.nearbys(100) %>
- <li><%= link_to guides.address, guides %> (<%= guides.distance.round(2) %> miles)</li>
+ <ul class="guideSearchResults">
+ <% if @user_search.count() > 0 %>
+ <% for guides in @user_search %>
+ <li><%= link_to guides.address, guides %> (<%= guides.distance.round(2) %> miles)</li>
+ <% end %>
+ <% else %>
+ <li class="noneFound">Sorry <%= @user_search.count() %> guides could be found at this time.</li>
<% end %>
</ul>
- <% end %>s
+ <% end %>
</div>
</div>
</div>

0 comments on commit 09e3634

Please sign in to comment.
Something went wrong with that request. Please try again.