made feedback and metamaps manual display conditional instead of hard coded so there's not errors on a blank database

This commit is contained in:
Devin Howard 2012-11-03 13:45:08 -04:00
parent 4787ca23c5
commit 77420bcb09
5 changed files with 16 additions and 6 deletions

View file

@ -11,7 +11,7 @@ class MainController < ApplicationController
@maps = Map.visibleToUser(@current, nil)
@map = @maps.sample
@mapjson = @map.self_as_json(@current).html_safe
@mapjson = @map.self_as_json(@current).html_safe if @map
respond_to do |format|
format.html { respond_with(@map, @user) }

View file

@ -23,9 +23,14 @@ class SessionsController < ApplicationController
@user = User.new
@connor = User.find(555629996)
@map = Map.find(5)
@map = Map.find(:first, 5)
respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format|
if @map
respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format|
end
else
respond_with(@user, @session, location: root_url) do |format|
end
end
end

View file

@ -40,9 +40,14 @@ class UsersController < ApplicationController
# direct them straight to the metamaps manual map.
@connor = User.find(555629996)
@map = Map.find(5)
@map = Map.find(:first, 5)
respond_with(@user, location: user_map_url(@connor,@map)) do |format|
if @map
respond_with(@user, location: user_map_url(@connor,@map)) do |format|
end
else
respond_with(@user, location: root_url) do |format|
end
end
end

View file

@ -65,7 +65,7 @@
</div>
<div class="footer">
<% unless Map.find(:all, 7).empty? %>
<% unless Map.find(:first, 7).nil? %>
<div class="feedback"><%= link_to "Feedback", user_map_path(User.find(555629996), Map.find(7)) %></div>
<% end %>
<div class="legend">

Binary file not shown.