_navigation.html.erb 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
  2. <div class="navbar-header">
  3. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  4. <span class="sr-only">Toggle navigation</span>
  5. <span class="icon-bar"></span>
  6. <span class="icon-bar"></span>
  7. <span class="icon-bar"></span>
  8. </button>
  9. <%= link_to "School Platform", root_path, class: "navbar-brand" %>
  10. </div>
  11. <ul class="nav navbar-top-links navbar-right">
  12. <li class="dropdown">
  13. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  14. <%= fa_icon "envelope fw" %>
  15. <% count = unread_messages_count current_user %>
  16. <% if count > 0 %>
  17. (<span class="unread-messages"><%= count %></span>)
  18. <% end %>
  19. <%= fa_icon "caret-down" %>
  20. </a>
  21. <ul class="dropdown-menu dropdown-messages">
  22. <% for conversation in current_user.conversations.sort_by{ |conversation| conversation.messages.last.created_at }[0..1] %>
  23. <% message = conversation.messages.last %>
  24. <li>
  25. <%= link_to "#{conversation_path conversation}#message-#{message.id}" do %>
  26. <div>
  27. <span class="pull-right text-muted">
  28. <em><%= time_ago_in_words(message.created_at) %>
  29. ago</em>
  30. </span>
  31. <strong><%= message.user.name %></strong>
  32. </div>
  33. <div><%= truncate(message.content, length: 100) %></div>
  34. <% end %>
  35. </li>
  36. <li class="divider"></li>
  37. <% end %>
  38. <li>
  39. <%= link_to conversations_path, class: 'text-center' do %>
  40. <strong>Read All Messages</strong>
  41. <%= fa_icon("angle-right") %>
  42. <% end %>
  43. </li>
  44. </ul>
  45. </li>
  46. <li class="dropdown">
  47. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  48. <%= fa_icon "user fw" %><%= fa_icon "caret-down" %>
  49. </a>
  50. <ul class="dropdown-menu dropdown-user">
  51. <li>
  52. <%= link_to fa_icon("user fw", text: "User Profile"), current_user %>
  53. </li>
  54. <li>
  55. <%= link_to fa_icon("gear fw", text: "Settings"), edit_user_path(current_user) %>
  56. </li>
  57. <li class="divider"></li>
  58. <li>
  59. <%= link_to fa_icon("sign-out fw", text: "Logout"), logout_path, method: :delete %>
  60. </li>
  61. </ul>
  62. </li>
  63. </ul>
  64. <div class="navbar-default sidebar" role="navigation">
  65. <div class="sidebar-nav navbar-collapse">
  66. <ul class="nav" id="side-menu">
  67. <li class="sidebar-search">
  68. <div class="input-group custom-search-form">
  69. <input type="text" class="form-control" placeholder="Search...">
  70. <span class="input-group-btn">
  71. <button class="btn btn-default" type="button">
  72. <i class="fa fa-search"></i>
  73. </button>
  74. </span>
  75. </div>
  76. </li>
  77. <li>
  78. <%= link_to fa_icon("home fw", text: "Home"), home_path %>
  79. </li>
  80. <li>
  81. <%= link_to fa_icon("envelope fw", text: "Conversations"), conversations_path %>
  82. </li>
  83. <% for school in (current_user.schools_administering + [current_user.school]).uniq.compact do %>
  84. <li>
  85. <%= link_to fa_icon("building fw", text: school.name), school_path(school) %>
  86. </li>
  87. <% end %>
  88. <li>
  89. <%= link_to fa_icon("book fw", text: "Courses"), courses_user_path(current_user) %>
  90. </li>
  91. <li>
  92. <%= link_to fa_icon("paperclip fw", text: "Assignments"), assignments_path %>
  93. </li>
  94. </ul>
  95. </div>
  96. </div>
  97. </nav>