publiclab/plots2

View on GitHub
app/views/users/likes.html.erb

Summary

Maintainability
Test Coverage
<div class="col-md-3">

<% user = user || @user # allow overriding w/ local variable %>

<% if @wikis && @wikis.count > 0 %>
  <h3 style="margin-top:0;"><%= translation('users.likes.wiki_liked_by') %> <a href="/profile/<%= user.name %>"><%= user.name %></a></h3>

  <ul class="nav bullet">
    <% @wikis.each do |wiki| %>
      <% unless (!@node.nil? && wiki.nid == @node.nid) %>
        <li><a href="<%= wiki.path %>"><i class="fa fa-book"></i> <%= wiki.title %></a> <small style="color:#888;">(<%= translation('users.likes.updated') %>: <%= distance_of_time_in_words(wiki.updated_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %>)</small></li>
      <% end %>
    <% end %>
    <% if params[:controller] == "search" %>
      <li><a href="/tag/<%= params[:id] %>"><%= translation('users.likes.more') %>...</a></li>
    <% end %>
  </ul>
<% end %>

</div>

<div class="col-md-9">
  <h3 style="margin-top:0;"><i class="fa fa-star-o"></i> <%= translation('users.likes.liked_by') %> <a href="/profile/<%= user.name %>"><%= user.name %></a></h3>

  <hr />
<% if @notes && @notes.count == 0 %>
  <% if current_user && (current_user.id == @user.uid) %>
    No notes liked by you.
  <% else %>
    <%= @user.name %> hasn't liked any notes.
  <% end %>
<% end %>
 <%= render :partial => "notes/notes" %>

</div>