index.html.erb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. </td>
  24. <td class="creator text-right text-muted">
  25. <% if (creator = query.creator) and creator.respond_to?(:name) %>
  26. <% name = creator.name %>
  27. <% if respond_to?(:current_user) and creator == current_user %>
  28. you
  29. <div class="hide">me <%= name %></div>
  30. <% else %>
  31. <%= name %>
  32. <% end %>
  33. <% end %>
  34. </td>
  35. </tr>
  36. <% end %>
  37. </tbody>
  38. </table>
  39. </div>
  40. <script>
  41. var options = {
  42. valueNames: ['query', 'creator']
  43. };
  44. var userList = new List('queries', options);
  45. </script>