index.html.erb 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <div id="queries">
  2. <div id="header" style="margin-bottom: 20px;">
  3. <div class="pull-right">
  4. <%= link_to "New Query", new_query_path, class: "btn btn-info" %>
  5. </div>
  6. <input type="text" placeholder="Start typing a query or person" style="width: 300px; display: inline-block;" autofocus=true class="search form-control" />
  7. </div>
  8. <table class="table">
  9. <thead>
  10. <tr>
  11. <th>Query</th>
  12. <th style="width: 20%; text-align: right;">Mastermind</th>
  13. </tr>
  14. </thead>
  15. <tbody class="list">
  16. <% @queries.each do |query| %>
  17. <tr>
  18. <td class="query">
  19. <%= link_to query.name, query %>
  20. <% if query.created_at > 2.days.ago %>
  21. <small style="font-weight: bold; color: #5cb85c;">NEW</small>
  22. <% end %>
  23. <% if @trending_queries[query.id] %>
  24. <small style="font-weight: bold; color: #f60;">TRENDING</small>
  25. <% end %>
  26. </td>
  27. <td class="creator text-right text-muted">
  28. <% if query.respond_to?(:creator) && (creator = query.creator) && creator.respond_to?(Blazer.user_name) %>
  29. <% name = creator.send(Blazer.user_name) %>
  30. <% if respond_to?(:current_user) and creator == current_user %>
  31. You
  32. <div class="hide">me <%= name %></div>
  33. <% else %>
  34. <%= name %>
  35. <% end %>
  36. <% end %>
  37. </td>
  38. </tr>
  39. <% end %>
  40. </tbody>
  41. </table>
  42. </div>
  43. <script>
  44. var options = {
  45. valueNames: ['query', 'creator']
  46. };
  47. var userList = new List('queries', options);
  48. </script>