1
0

_navigation.html.erb 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <div class="navbar-header">
  2. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
  3. <span class="sr-only">Toggle navigation</span>
  4. <span class="icon-bar"></span>
  5. <span class="icon-bar"></span>
  6. <span class="icon-bar"></span>
  7. </button>
  8. <%= link_to "Huginn", root_path, :class => 'navbar-brand' %>
  9. </div>
  10. <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  11. <% if user_signed_in? %>
  12. <ul class='nav navbar-nav'>
  13. <%= nav_link "Agents", agents_path do %>
  14. <ul class='dropdown-menu' role='menu'>
  15. <%= nav_link icon_tag('glyphicon-plus') + " New Agent", new_agent_path %>
  16. <%= nav_link icon_tag('glyphicon-refresh') + " Run event propagation", propagate_agents_path, method: 'post' %>
  17. <%= nav_link icon_tag('glyphicon-random') + " View Diagram", diagram_path %>
  18. </ul>
  19. <% end %>
  20. <%= nav_link "Scenarios", scenarios_path %>
  21. <%= nav_link "Events", events_path %>
  22. <%= nav_link "Credentials", user_credentials_path %>
  23. <%= nav_link "Services", services_path %>
  24. </ul>
  25. <% end %>
  26. <ul class="nav navbar-nav navbar-right">
  27. <% if user_signed_in? %>
  28. <form class="navbar-form navbar-left" role="search">
  29. <div class="form-group">
  30. <input type="text" class="form-control" id='agent-navigate' autocomplete="off" placeholder="Search">
  31. <%= image_tag "spinner-arrows.gif", :class => "spinner" %>
  32. </div>
  33. </form>
  34. <li class='job-indicator' role='pending'>
  35. <%= link_to current_user.admin? ? jobs_path : '#' do %>
  36. <span class="badge"><%= icon_tag('glyphicon-refresh', class: 'icon-white') %> <span class='number'>0</span></span>
  37. <% end %>
  38. </li>
  39. <li class='job-indicator' role='awaiting_retry'>
  40. <%= link_to current_user.admin? ? jobs_path : '#' do %>
  41. <span class="badge"><%= icon_tag('glyphicon-question-sign', class: 'icon-yellow') %> <span class='number'>0</span></span>
  42. <% end %>
  43. </li>
  44. <li class='job-indicator' role='recent_failures'>
  45. <%= link_to current_user.admin? ? jobs_path : '#', class: 'hidden-sm hidden-xs' do %>
  46. <span class="badge"><%= icon_tag('glyphicon-exclamation-sign', class: 'icon-white') %> <span class='number'>0</span></span>
  47. <% end %>
  48. </li>
  49. <li id='event-indicator'>
  50. <a href="#" class='hidden-sm hidden-xs'>
  51. <span class="badge"><%= icon_tag('glyphicon-random', class: 'icon-white') %> <span class='number'>0</span> events</span>
  52. </a>
  53. </li>
  54. <% end %>
  55. <li class="dropdown">
  56. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  57. Account
  58. <% if user_signed_in? && session[:original_admin_user_id].present? %>
  59. <span class="label label-warning"><%= current_user.username %></span>
  60. <% end %>
  61. <b class="caret"></b>
  62. </a>
  63. <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  64. <% if user_signed_in? && session[:original_admin_user_id].present? %>
  65. <li>
  66. <%= link_to 'Switch Back to Admin User', switch_back_admin_users_path, tabindex: '-1' %>
  67. </li>
  68. <% end %>
  69. <li>
  70. <% if user_signed_in? %>
  71. <%= link_to 'Account', edit_user_registration_path, :tabindex => "-1" %>
  72. <% else %>
  73. <%= link_to 'Sign up', new_user_registration_path, :tabindex => "-1" %>
  74. <% end %>
  75. </li>
  76. <% if user_signed_in? && current_user.admin %>
  77. <li>
  78. <%= link_to 'Job Management', jobs_path, :tabindex => '-1' %>
  79. </li>
  80. <li>
  81. <%= link_to 'User Management', admin_users_path, tabindex: '-1' %>
  82. </li>
  83. <% end %>
  84. <li>
  85. <%= link_to 'About', 'https://github.com/huginn/huginn', :tabindex => "-1" %>
  86. </li>
  87. <li>
  88. <% if user_signed_in? %>
  89. <%= link_to 'Logout', destroy_user_session_path, :method => :delete, :tabindex => "-1" %>
  90. <% else %>
  91. <%= link_to 'Login', new_user_session_path, :tabindex => "-1" %>
  92. <% end %>
  93. </li>
  94. </ul>
  95. </li>
  96. </ul>
  97. </div>