2016-02-12 23:52:43 +08:00
|
|
|
<nav class="navbar navbar-default navbar-fixed-top" id="main-nav">
|
2018-03-12 23:27:35 +08:00
|
|
|
<div class="container-fluid">
|
2016-02-12 23:52:43 +08:00
|
|
|
|
|
|
|
<!-- 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>
|
2017-06-27 19:46:49 +08:00
|
|
|
<%= link_to(root_path, class: 'navbar-brand', title: t('nav.label.scinote')) do %>
|
2019-12-04 22:51:26 +08:00
|
|
|
<%= image_tag('/images/scinote_icon.svg', id: 'logo') %>
|
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">
|
2018-03-12 23:27:35 +08:00
|
|
|
<ul class="nav navbar-nav navbar-left" id="nav-team-switch">
|
2019-02-19 18:08:59 +08:00
|
|
|
<!-- System notification dropdown -->
|
|
|
|
<li class="dropdown system-notifications">
|
|
|
|
<a href="#"
|
|
|
|
id="system-notifications-dropdown"
|
|
|
|
class="dropdown-toggle"
|
2019-02-27 21:32:51 +08:00
|
|
|
title="<%= t('system_notifications.navbar.tooltip') %>"
|
2019-02-19 18:08:59 +08:00
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false"
|
|
|
|
data-href="<%= system_notifications_url(format: :json) %>">
|
|
|
|
<i class="fas fa-gift"></i>
|
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t("system_notifications.index.whats_new") %></span>
|
|
|
|
<span id="count-system-notifications"
|
|
|
|
data-href="<%= unseen_counter_system_notifications_url %>">
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu dropdown-system-notifications">
|
|
|
|
<li class="system-notifications-dropdown-header">
|
|
|
|
<span class="pull-left"><%= t("system_notifications.index.whats_new") %></span>
|
|
|
|
<span class="show-all">
|
|
|
|
<%= link_to t('system_notifications.index.see_all'), system_notifications_path %>
|
|
|
|
</span>
|
|
|
|
<span class="pull-right">
|
|
|
|
<%= link_to t('nav.user.settings'), preferences_path %>
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
<li class="system-notifications-no-recent">
|
|
|
|
<em><%= t("system_notifications.index.no_notifications") %></em>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
2018-03-12 23:27:35 +08:00
|
|
|
<!-- Global team switch -->
|
|
|
|
<% if current_user.teams.length > 0 %>
|
|
|
|
<li id="team-switch">
|
|
|
|
<div class="btn-group">
|
2019-11-12 18:26:18 +08:00
|
|
|
<button type="button" class="btn btn-default selected-team" data-toggle="dropdown">
|
|
|
|
<%= current_team.name %>
|
2019-07-05 00:22:51 +08:00
|
|
|
</button>
|
2018-03-12 23:27:35 +08:00
|
|
|
<button type="button"
|
2018-04-25 19:57:12 +08:00
|
|
|
class="btn btn-default dropdown-toggle"
|
2018-03-12 23:27:35 +08:00
|
|
|
title="<%= t('nav.label.teams') %>"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
|
|
|
<span class="caret"></span>
|
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
<%= form_for(current_user,
|
|
|
|
url: user_current_team_path,
|
|
|
|
method: :post) do |f| %>
|
|
|
|
<%= hidden_field(:user, :current_team_id) %>
|
2018-05-15 00:33:57 +08:00
|
|
|
<div class="dropdown-header"><%= t('nav.team_switch_title') %></div>
|
2019-04-12 15:17:14 +08:00
|
|
|
<div class="team-container">
|
2020-01-30 20:42:02 +08:00
|
|
|
<% current_user.teams.ordered.each do |team| %>
|
2019-04-12 15:17:14 +08:00
|
|
|
<li class="team-name-item">
|
|
|
|
<a href="#"
|
|
|
|
data-id="<%= team.id %>"
|
|
|
|
class="text-center change-team"
|
|
|
|
data-turbolinks="false">
|
|
|
|
<% if current_team == team %>
|
|
|
|
<span class="fas fa-check-circle"></span> <strong><%= team.name %></strong>
|
|
|
|
<% else %>
|
|
|
|
<span class="team-name"><%= team.name %></span>
|
|
|
|
<% end %>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2018-03-12 23:27:35 +08:00
|
|
|
<% end %>
|
|
|
|
<% if current_user.teams.length > 1 && can_create_teams? %>
|
2019-04-12 15:17:14 +08:00
|
|
|
<li class="new-team">
|
2018-03-12 23:27:35 +08:00
|
|
|
<%= link_to new_team_path do %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-plus"></span>
|
2018-03-12 23:27:35 +08:00
|
|
|
<%= t('users.settings.teams.index.new_team') %>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</li>
|
2017-02-01 21:09:26 +08:00
|
|
|
<% end %>
|
2018-03-12 23:27:35 +08:00
|
|
|
</ul>
|
|
|
|
|
2018-03-16 22:56:12 +08:00
|
|
|
<!-- profile info -->
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
|
|
|
<!-- search form -->
|
2016-02-12 23:52:43 +08:00
|
|
|
<li>
|
2018-03-12 23:27:35 +08:00
|
|
|
<%= form_tag search_path,
|
|
|
|
method: :get,
|
|
|
|
id: 'search-bar',
|
|
|
|
class: 'navbar-form',
|
|
|
|
role: 'search' do %>
|
|
|
|
<div class="input-group">
|
|
|
|
<input class="form-control"
|
|
|
|
type="text"
|
|
|
|
name="q"
|
|
|
|
placeholder="<%= t('nav.search') %>" />
|
|
|
|
<span class="input-group-btn">
|
2019-02-19 18:08:59 +08:00
|
|
|
<button class="btn btn-default" type="submit"><%= t 'nav.search_button' %></button>
|
2018-03-12 23:27:35 +08:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</li>
|
2016-10-21 15:33:18 +08:00
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
<!-- notifications -->
|
2019-07-15 19:28:20 +08:00
|
|
|
<li class="dropdown notifications-dropdown">
|
2016-10-05 18:22:27 +08:00
|
|
|
<a href="#"
|
|
|
|
id="notifications-dropdown"
|
|
|
|
class="dropdown-toggle"
|
2017-06-27 19:46:49 +08:00
|
|
|
title="<%= t('nav.label.notifications') %>"
|
2016-10-05 18:22:27 +08:00
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false"
|
|
|
|
data-href="<%= recent_notifications_url(current_user) %>">
|
2018-03-30 23:03:44 +08:00
|
|
|
<i class="fas fa-bell"></i>
|
2017-06-27 19:46:49 +08:00
|
|
|
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.notifications') %></span>
|
2016-10-05 18:22:27 +08:00
|
|
|
<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>
|
2019-02-19 18:08:59 +08:00
|
|
|
<ul class="dropdown-menu dropdown-notifications system-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
|
|
|
|
2019-07-15 19:28:20 +08:00
|
|
|
<!-- greetings -->
|
|
|
|
<li id="user-account-dropdown" class="dropdown">
|
|
|
|
<a href="#"
|
|
|
|
class="dropdown-toggle"
|
|
|
|
title="<%= t('nav.label.account') %>"
|
|
|
|
data-toggle="dropdown"
|
|
|
|
role="button"
|
|
|
|
aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
|
|
|
<span>
|
|
|
|
<%= t('nav.user_greeting', full_name: current_user.full_name) %>
|
|
|
|
</span>
|
|
|
|
<span class='global-avatar-container'>
|
|
|
|
<%= image_tag avatar_path(current_user, :icon_small),
|
|
|
|
class: "avatar" %>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu" data-hook="navigation-user-menu">
|
2020-03-18 17:50:09 +08:00
|
|
|
<li data-hook="navigation-user-menu-logout">
|
2019-07-15 19:28:20 +08:00
|
|
|
<%= link_to t('nav.user.logout'),
|
|
|
|
destroy_user_session_path,
|
|
|
|
method: :delete %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
2016-10-05 18:22:27 +08:00
|
|
|
</ul>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<div id="loading-animation"></div>
|
|
|
|
|
2019-02-19 18:08:59 +08:00
|
|
|
<%= javascript_include_tag("system_notifications/index") %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<%= javascript_include_tag("navigation") %>
|