2016-02-12 23:52:43 +08:00
|
|
|
<nav class="navbar navbar-default navbar-fixed-top" id="main-nav">
|
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
<!-- header -->
|
|
|
|
<div class="navbar-header">
|
|
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-menu" aria-expanded="false">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</button>
|
2016-11-30 16:48:57 +08:00
|
|
|
<%= link_to(root_path, class: 'navbar-brand') do %>
|
2016-11-28 17:52:17 +08:00
|
|
|
<%
|
|
|
|
show_version = !Rails.env.production?
|
|
|
|
if ENV['NAVBAR_SHOW_VERSION'].present?
|
|
|
|
show_version = YAML.load(ENV['NAVBAR_SHOW_VERSION'])
|
|
|
|
end
|
|
|
|
%>
|
|
|
|
<% if show_version %>
|
2016-11-30 16:48:57 +08:00
|
|
|
<%= image_tag('/images/logo.png', class: 'with-version', id: 'logo') %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span class="version">
|
2016-10-05 23:45:20 +08:00
|
|
|
<%= Constants::APP_VERSION %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</span>
|
2016-11-28 17:52:17 +08:00
|
|
|
<% else %>
|
2016-11-30 16:48:57 +08:00
|
|
|
<%= image_tag('/images/logo.png', id: 'logo') %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
2016-11-30 16:48:57 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if user_signed_in? %>
|
|
|
|
<div class="collapse navbar-collapse" id="main-menu">
|
|
|
|
<!-- links -->
|
|
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li>
|
|
|
|
<a href="<%= projects_path %>">
|
2016-07-21 19:11:15 +08:00
|
|
|
<span class="glyphicon glyphicon-home"></span>
|
2016-10-05 18:22:27 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.projects') %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
2017-02-01 21:09:26 +08:00
|
|
|
<% if current_team %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<li>
|
2016-11-17 21:28:58 +08:00
|
|
|
<a id="protocol-link" href="<%= protocols_path %>">
|
2016-07-21 19:11:15 +08:00
|
|
|
<span class="glyphicon glyphicon-list-alt"></span>
|
2016-10-05 18:22:27 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.protocols') %></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
2017-05-22 23:54:30 +08:00
|
|
|
<li>
|
|
|
|
<a id="repositories-link" href="<%= team_repositories_path(current_team) %>">
|
2017-06-13 00:00:28 +08:00
|
|
|
<i class="fa fa-cubes" aria-hidden="true"></i>
|
2017-05-22 23:54:30 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.repositories') %></span>
|
|
|
|
</a>
|
|
|
|
</li>
|
2017-02-01 21:09:26 +08:00
|
|
|
<% else %>
|
|
|
|
<li class="disabled">
|
|
|
|
<a id="protocol-link" href="#">
|
|
|
|
<span class="glyphicon glyphicon-list-alt"></span>
|
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.protocols') %></span>
|
|
|
|
</a>
|
|
|
|
</li>
|
2017-05-22 23:54:30 +08:00
|
|
|
<li class="disabled">
|
|
|
|
<a id="repositories-link" href="#">
|
2017-06-20 22:07:34 +08:00
|
|
|
<span class="fa fa-cubes"></span>
|
2017-05-22 23:54:30 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.repositories') %></span>
|
|
|
|
</a>
|
|
|
|
</li>
|
2017-02-01 21:09:26 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% if false %>
|
|
|
|
<li>
|
|
|
|
<a href="#">
|
|
|
|
<span class="glyphicon glyphicon-calendar"></span>
|
2016-10-05 18:22:27 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.calendar') %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
<li>
|
|
|
|
<a class="btn-activity" href="<%= activities_path(format: :json) %>" role="button" data-remote="true">
|
|
|
|
<span class="glyphicon glyphicon-equalizer"></span>
|
2016-10-05 18:22:27 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.activities') %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2016-10-05 18:22:27 +08:00
|
|
|
<!-- profile info -->
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
2016-10-21 15:33:18 +08:00
|
|
|
|
|
|
|
<!-- Global team switch -->
|
2017-01-25 19:01:23 +08:00
|
|
|
<% if current_user.teams.length > 0 %>
|
2016-10-21 15:33:18 +08:00
|
|
|
<li class="dropdown" id="team-switch">
|
|
|
|
<a href="#"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
|
|
|
<%= fa_icon 'users' %>
|
|
|
|
<span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= truncate_team_name(current_team.name) %>
|
2016-10-21 15:33:18 +08:00
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
|
2017-03-17 23:10:22 +08:00
|
|
|
<ul class="dropdown-menu"
|
|
|
|
data-hook="teams-dropdown">
|
2016-10-21 15:33:18 +08:00
|
|
|
<%= form_for(current_user,
|
2017-01-25 19:01:23 +08:00
|
|
|
url: user_current_team_path,
|
2016-10-21 15:33:18 +08:00
|
|
|
method: :post) do |f| %>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= hidden_field(:user, :current_team_id) %>
|
|
|
|
<% current_user.teams.each do |team| %>
|
|
|
|
<% next unless team != current_team %>
|
2016-10-21 15:33:18 +08:00
|
|
|
<li>
|
|
|
|
<a href="#"
|
2017-01-25 19:01:23 +08:00
|
|
|
data-id="<%= team.id %>"
|
2016-10-21 15:33:18 +08:00
|
|
|
class="text-center change-team">
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= team.name %>
|
2016-10-21 15:33:18 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2017-01-25 19:01:23 +08:00
|
|
|
<% if current_user.teams.length > 1 %>
|
2017-03-17 23:10:22 +08:00
|
|
|
<li data-hook="new-team-btn"
|
|
|
|
role="separator"
|
|
|
|
class="divider"></li>
|
2016-10-25 03:20:41 +08:00
|
|
|
<% end %>
|
2017-03-17 23:10:22 +08:00
|
|
|
<li data-hook="new-team-btn">
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= link_to new_team_path do %>
|
2016-10-21 15:33:18 +08:00
|
|
|
<span class="glyphicon glyphicon-plus"></span>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= t('users.settings.teams.index.new_team') %>
|
2016-10-21 15:33:18 +08:00
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- search -->
|
2016-10-21 17:46:59 +08:00
|
|
|
<li class="dropdown"
|
|
|
|
id="search-ico">
|
2016-10-21 15:33:18 +08:00
|
|
|
<a href="#"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
|
|
|
<span class="glyphicon glyphicon-search"></span>
|
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu search-dropdown">
|
|
|
|
<li>
|
|
|
|
<!-- search form -->
|
|
|
|
<%= form_tag search_path,
|
|
|
|
method: :get,
|
|
|
|
id: 'search-bar',
|
|
|
|
class: 'navbar-form navbar-right',
|
|
|
|
role: 'search' do %>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="input-group">
|
|
|
|
<input class="form-control"
|
|
|
|
type="text"
|
|
|
|
name="q"
|
2016-10-21 17:46:59 +08:00
|
|
|
placeholder="<%= t('nav.search') %>">
|
2016-10-21 15:33:18 +08:00
|
|
|
<span class="input-group-btn visible-xs visible-sm">
|
|
|
|
<button id="search-button"
|
|
|
|
class="btn btn-default"
|
|
|
|
type="submit">
|
|
|
|
<span class="glyphicon glyphicon-menu-right"></span>
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
<!-- notifications -->
|
2016-10-05 18:22:27 +08:00
|
|
|
<li class="dropdown">
|
|
|
|
<a href="#"
|
|
|
|
id="notifications-dropdown"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false"
|
|
|
|
data-href="<%= recent_notifications_url(current_user) %>">
|
|
|
|
<%= fa_icon 'bell'%>
|
|
|
|
<span id="count-notifications"
|
2016-10-21 15:33:18 +08:00
|
|
|
data-href="<%= unseen_notification_url(current_user) %>">
|
|
|
|
</span>
|
2016-10-05 18:22:27 +08:00
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu dropdown-notifications">
|
2016-10-21 15:33:18 +08:00
|
|
|
<li class="notifications-dropdown-header">
|
|
|
|
<span><%= t('notifications.title') %></span>
|
|
|
|
<span class="pull-right">
|
|
|
|
<%= link_to t('nav.user.settings'), preferences_path %>
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
<li class="notifications-no-recent">
|
|
|
|
<em><%= t('notifications.no_recent') %></em>
|
|
|
|
</li>
|
|
|
|
<li class="notifications-dropdown-footer">
|
|
|
|
<%= link_to t('notifications.show_all'), notifications_path %>
|
|
|
|
</li>
|
2016-10-05 18:22:27 +08:00
|
|
|
</ul>
|
|
|
|
</li>
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
|
|
<!-- help -->
|
2016-10-05 18:22:27 +08:00
|
|
|
<li class="dropdown">
|
2016-10-21 15:33:18 +08:00
|
|
|
<a href="#"
|
|
|
|
id="help-link"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
2016-10-05 18:22:27 +08:00
|
|
|
<span class="glyphicon glyphicon-info-sign"></span>
|
|
|
|
</a>
|
2016-11-07 23:57:18 +08:00
|
|
|
<ul class="dropdown-menu" data-hook="navigation-help-menu">
|
2017-04-07 17:31:09 +08:00
|
|
|
<li><%= link_to t('nav.help.support'),
|
|
|
|
Constants::SUPPORT_URL,
|
|
|
|
target: "_blank" %></li>
|
2016-10-05 23:45:20 +08:00
|
|
|
<li><%= link_to t('nav.help.tutorials'),
|
2016-10-11 21:13:05 +08:00
|
|
|
Constants::TUTORIALS_URL,
|
|
|
|
target: "_blank" %></li>
|
2016-10-24 22:59:32 +08:00
|
|
|
<li><%= link_to t('nav.help.release_notes'),
|
|
|
|
Constants::RELEASE_NOTES_URL,
|
|
|
|
target: "_blank" %></li>
|
2017-01-31 22:48:56 +08:00
|
|
|
<li><%= link_to t('nav.help.premium'),
|
|
|
|
Constants::PREMIUM_URL,
|
2016-10-11 21:13:05 +08:00
|
|
|
target: "_blank" %></li>
|
2016-10-05 23:45:20 +08:00
|
|
|
<li><%= link_to t('nav.help.contact'),
|
2016-10-11 21:13:05 +08:00
|
|
|
Constants::CONTACT_URL,
|
|
|
|
target: "_blank" %></li>
|
2016-10-05 18:22:27 +08:00
|
|
|
</ul>
|
|
|
|
</li>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2016-10-21 15:33:18 +08:00
|
|
|
<!-- greetings -->
|
|
|
|
<li class="dropdown">
|
|
|
|
<a href="#"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
2016-10-17 15:47:36 +08:00
|
|
|
<span>
|
2016-10-21 15:33:18 +08:00
|
|
|
<%= t('nav.user_greeting', full_name: current_user.full_name) %>
|
2016-10-17 15:47:36 +08:00
|
|
|
</span>
|
2016-10-21 15:33:18 +08:00
|
|
|
<%= image_tag avatar_path(current_user, :icon_small),
|
|
|
|
class: "avatar" %>
|
2016-10-11 17:40:14 +08:00
|
|
|
</a>
|
2016-11-07 23:57:18 +08:00
|
|
|
<ul class="dropdown-menu" data-hook="navigation-user-menu">
|
2016-10-20 19:47:41 +08:00
|
|
|
<li>
|
2017-02-09 18:34:52 +08:00
|
|
|
<%= link_to t('nav.user.settings'), edit_user_registration_path %>
|
2016-10-20 19:47:41 +08:00
|
|
|
</li>
|
2016-10-05 18:22:27 +08:00
|
|
|
<li role="separator" class="divider"></li>
|
2016-10-21 15:33:18 +08:00
|
|
|
<li>
|
|
|
|
<%= link_to t('nav.user.logout'),
|
|
|
|
destroy_user_session_path,
|
|
|
|
method: :delete %>
|
|
|
|
</li>
|
2016-10-05 18:22:27 +08:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<div id="loading-animation"></div>
|
|
|
|
|
|
|
|
<%= javascript_include_tag("navigation") %>
|