2013-01-11 23:49:59 +00:00
|
|
|
<%#
|
|
|
|
# @file
|
|
|
|
# This view shows an index of all topics, or just your topics if you're
|
|
|
|
# logged in
|
|
|
|
# TODO: What URL accesses this view?
|
|
|
|
#%>
|
|
|
|
|
2013-07-09 16:32:13 +00:00
|
|
|
<% if @user %><%= @user.name %>'s <% end %>
|
|
|
|
<% content_for :title, @user.name + "'s Topics | Metamaps" %>
|
|
|
|
<% else %>
|
|
|
|
<% content_for :title, "Topics | Metamaps" %>
|
|
|
|
<% end %>
|
|
|
|
|
2013-01-06 23:40:48 +00:00
|
|
|
<h1 class="index"><% if @user %><%= @user.name %>'s <% end %>Topics</h1>
|
2013-01-01 22:45:35 +00:00
|
|
|
|
|
|
|
<div class="topics" id="cards">
|
|
|
|
<% @topics.each do |topic| %>
|
|
|
|
<%= render topic %>
|
|
|
|
<% end %>
|
|
|
|
<% if @topics.empty? %>
|
|
|
|
<p class="empty"><br>Shucks, there are no topics. <% if authenticated? %><%= link_to "Create some if you want.", console_url %><% end %></p>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2013-01-06 23:40:48 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
//bind best_in_place ajax callbacks
|
|
|
|
$('.topic').find('.best_in_place_metacode')
|
|
|
|
.bind("ajax:success", function() {
|
|
|
|
var metacode = $(this).html();
|
|
|
|
//changing img alt, img src for top card (topic view page)
|
|
|
|
//and on-canvas card. Also changing image of node
|
|
|
|
$(this).parent().find('img.icon').attr('alt', metacode);
|
|
|
|
$(this).parent().find('img.icon').attr('src', imgArray[metacode].src);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.topic').find('.best_in_place_link').bind("ajax:success", function() {
|
|
|
|
var link = $(this).html();
|
|
|
|
$(this).parent().find('.go-link').attr('href', link);
|
|
|
|
});
|
|
|
|
|
2013-01-11 23:49:59 +00:00
|
|
|
</script>
|