%= render :partial => "json", :locals=>{:squares => squares} %>
<%
if not session[:use_js_renderer]
top = @top || -75
left = @left || -33
count = @count || 0
pos_counter = squares.last.position + 1
empty_square = Square.new(:square_type_id => 1)
6.times do |i|
empty_square.position = pos_counter + i
squares += [empty_square.clone]
end
squares.each do |square| -%>
<% count += 1 -%>
<% if square.deed -%>
<% elsif square.square_type_id == 6 -%>
<% elsif square.square_type_id == 5 -%>
<% elsif square.square_type_id == 3 -%>
<% else -%>
<% end -%>
<% if square.deed -%>
 |
<% if square.deed.name -%>
<%=h sanitize(square.deed.name) %>
<% else -%>
<%= square.deed.property_type.title %>
<% end -%>
Owned by: <%= square.deed.user.name %>
Rent: <%= rent_calc(square.deed.property_type,square.deed.levels) %>
Position: <%= number_with_precision(square.percentage_position,2) %>%
|
<% else -%>
 |
Position: <%= number_with_precision(square.percentage_position,2) %>%
|
<% end -%>
<%
# this is some smart cheating
# this tells us (without another query) if a user has been here in the last 10 minutes
# and while not 100% accurate is good enough to show cars moving about
#
# if this is too busy (too many cars) the original tests should be added to the end with "and"
# this at least avoids DB calls if the cell isn't locked... and the cell will always
# be locked if there is recent activity
# if square.users.size > 1 or (square != @user.square and square.users.size >0)
if square.locked?(@user)
-%>
<% end -%>
<% top += 19 -%>
<% left += 38 -%>
<% end -%>
<%= render :partial => "active_item" %>
<% end # if not using js renderer %>