metamaps--metamaps/app/views/maps/index.html.erb
2014-07-30 21:10:10 -04:00

64 lines
2.2 KiB
Text

<%#
# @file
# Shows a list of all maps, or just a user's maps.
# TODO: What url is this accessible at?
#%>
<% content_for :title, "Explore Maps | Metamaps" %>
<div class="mapOrder">
<span class="displaying">Displaying:</span>
<div class="whichMaps">
<% if @request == "other" %>
<a href="/maps/mappers/<%= @user.id %>" class="active">By <%= @user.name %></a> /
<% end %>
<% if @request == "topic" %>
<a href="/maps/topics/<%= @topic.id %>" class="active">Maps Containing Topic <%= @topic.id.to_s %>: "<%= @topic.name.truncate(30) %>"</a>
<% end %>
<% if @request != "topic" %>
<a href="/maps/active" class="<%= @request == "active" ? "active" : "" %>">Recently Active</a> /
<a href="/maps/featured" class="<%= @request == "featured" ? "active" : "" %>">Featured</a> /
<a href="/maps/new" class="<%= @request == "new" ? "active" : "" %>">Newest First</a>
<% if authenticated? %>
/ <a href="/maps/mappers/<%= @current.id %>" class="<%= @request == "you" ? "active" : "" %>">Yours</a>
<% end %>
<% end %>
</div>
<div class="clearfloat"></div>
</div>
<div class="mapsWrapper">
<div class="maps" id="cards">
<% @maps.each do |map| %>
<%= render map %>
<% end %>
<div class="clearfloat"></div>
</div>
</div>
<script>
$(document).ready(function() {
$('.authenticated div.permission.canEdit .best_in_place').best_in_place();
$('.scroll').each(function(index) {
$(this).height( $(this).height() ).mCustomScrollbar();
});
// when you change the title, make sure that the description doesn't overflow
$('.best_in_place_name').bind('ajax:success', function() {
var p = $(this).parents('.mapCard').find('.scroll');
p.height( p.height() ).mCustomScrollbar('update');
});
// when you change the description, update the scroll box field
$('.best_in_place_desc').bind('ajax:success', function() {
var s = $(this).parents('.scroll');
s.height( s.height() ).mCustomScrollbar('update');
});
$('.mapsWrapper').height( (parseInt($('body').height()) - 39) );
var s = $('.maps');
s.height( s.height() ).mCustomScrollbar();
});
</script>