metamaps--metamaps/app/views/topics/index.html.erb
2013-01-06 18:40:48 -05:00

28 lines
No EOL
976 B
Text

<h1 class="index"><% if @user %><%= @user.name %>'s <% end %>Topics</h1>
<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>
<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);
});
</script>