Merge branch '7816-crunch2-exec' closes #7816
[arvados.git] / apps / workbench / app / views / layouts / body.html.erb
1   <div id="wrapper" class="container-fluid">
2     <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
3       <div class="navbar-header">
4         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
5           <span class="sr-only">Toggle navigation</span>
6           <span class="icon-bar"></span>
7           <span class="icon-bar"></span>
8           <span class="icon-bar"></span>
9         </button>
10         <% site_name = Rails.configuration.site_name.downcase rescue Rails.application.class.parent_name %>
11         <% if current_user %>
12           <a class="navbar-brand" href="/" data-push=true><%= site_name %></a>
13         <% else %>
14           <span class="navbar-brand"><%= site_name %></span>
15         <% end %>
16       </div>
17
18       <div class="collapse navbar-collapse">
19         <ul class="nav navbar-nav navbar-right">
20
21           <li>
22             <a><i class="rotating loading glyphicon glyphicon-refresh"></i></a>
23           </li>
24
25           <% if current_user %>
26             <% if current_user.is_active %>
27             <li>
28               <form class="navbar-form" role="search"
29                          data-search-modal=
30                          "<%= url_for(
31                           action: 'choose',
32                           controller: 'search',
33                           title: 'Search',
34                           action_name: 'Show',
35                           action_href: url_for(controller: :actions, action: :show),
36                           action_method: 'get',
37                           action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json)
38                          %>">
39                 <div class="input-group" style="width: 220px">
40                   <input type="text" class="form-control" placeholder="search">
41                   <a class="input-group-addon"><span class="glyphicon glyphicon-search"></span></a>
42                 </div>
43               </form>
44             </li>
45             <% end %>
46
47             <li class="dropdown notification-menu">
48               <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
49                 <span class="badge badge-alert notification-count"><%= user_notifications.length if user_notifications.any? %></span>
50                 <span class="fa fa-lg fa-user"></span>
51                 <span class="caret"></span>
52               </a>
53               <ul class="dropdown-menu" role="menu">
54                 <li role="presentation" class="dropdown-header">
55                   <%= current_user.email %>
56                 </li>
57                 <% if current_user.is_active %>
58                 <li role="menuitem"><a href="/projects/<%=current_user.uuid%>" role="menuitem"><i class="fa fa-lg fa-home fa-fw"></i> Home project </a></li>
59
60                 <li role="menuitem">
61                   <%= link_to virtual_machines_user_path(current_user), role: 'menu-item' do %>
62                     <i class="fa fa-lg fa-terminal fa-fw"></i> Virtual machines
63                   <% end %>
64                 </li>
65                 <li role="menuitem">
66                   <%= link_to repositories_user_path(current_user), role: 'menu-item' do %>
67                     <i class="fa fa-lg fa-code-fork fa-fw"></i> Repositories
68                   <% end %>
69                 </li>
70                 <li role="menuitem"><a href="/current_token" role="menuitem"><i class="fa fa-lg fa-ticket fa-fw"></i> Current token</a></li>
71                 <li role="menuitem">
72                   <%= link_to ssh_keys_user_path(current_user), role: 'menu-item' do %>
73                     <i class="fa fa-lg fa-key fa-fw"></i> SSH keys
74                   <% end %>
75                 </li>
76
77                 <% if Rails.configuration.user_profile_form_fields %>
78                   <li role="menuitem"><a href="/users/<%=current_user.uuid%>/profile" role="menuitem"><i class="fa fa-lg fa-user fa-fw"></i> Manage profile</a></li>
79                 <% end %>
80                 <% end %>
81                 <li role="presentation" class="divider"></li>
82                 <li role="menuitem"><a href="<%= logout_path %>" role="menuitem"><i class="fa fa-lg fa-sign-out fa-fw"></i> Log out</a></li>
83                 <% if user_notifications.any? %>
84                   <li role="presentation" class="divider"></li>
85                   <% user_notifications.each_with_index do |n, i| %>
86                     <% if i > 0 %><li class="divider"></li><% end %>
87                     <li class="notification"><%= n.call(self) %></li>
88                   <% end %>
89                 <% end %>
90               </ul>
91             </li>
92
93             <% if current_user.is_admin %>
94               <li class="dropdown">
95                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="system-menu">
96                   <span class="fa fa-lg fa-gear"></span>
97                   <span class="caret"></span>
98                 </a>
99                 <ul class="dropdown-menu" role="menu">
100                   <li role="presentation" class="dropdown-header">
101                     Admin Settings
102                   </li>
103                   <li role="menuitem"><a href="/repositories">
104                       <i class="fa fa-lg fa-code-fork fa-fw"></i> Repositories
105                   </a></li>
106                   <li role="menuitem"><a href="/virtual_machines">
107                       <i class="fa fa-lg fa-terminal fa-fw"></i> Virtual machines
108                   </a></li>
109                   <li role="menuitem"><a href="/authorized_keys">
110                       <i class="fa fa-lg fa-key fa-fw"></i> SSH keys
111                   </a></li>
112                   <li role="menuitem"><a href="/api_client_authorizations">
113                       <i class="fa fa-lg fa-ticket fa-fw"></i> API tokens
114                   </a></li>
115                   <li role="menuitem"><a href="/links">
116                       <i class="fa fa-lg fa-arrows-h fa-fw"></i> Links
117                   </a></li>
118                   <li role="menuitem"><a href="/users">
119                       <i class="fa fa-lg fa-user fa-fw"></i> Users
120                   </a></li>
121                   <li role="menuitem"><a href="/groups">
122                       <i class="fa fa-lg fa-users fa-fw"></i> Groups
123                   </a></li>
124                   <li role="menuitem"><a href="/nodes">
125                       <i class="fa fa-lg fa-cloud fa-fw"></i> Compute nodes
126                   </a></li>
127                   <li role="menuitem"><a href="/keep_services">
128                       <i class="fa fa-lg fa-exchange fa-fw"></i> Keep services
129                   </a></li>
130                   <li role="menuitem"><a href="/keep_disks">
131                       <i class="fa fa-lg fa-hdd-o fa-fw"></i> Keep disks
132                   </a></li>
133                 </ul>
134               </li>
135             <% end %>
136           <% else %>
137             <% if Rails.configuration.anonymous_user_token and Rails.configuration.enable_public_projects_page %>
138               <li><%= link_to 'Browse public projects', "/projects/public" %></li>
139             <% end %>
140             <li class="dropdown hover-dropdown login-menu">
141               <a href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">Log in</a>
142               <ul class="dropdown-menu">
143                 <li>
144                   <a href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">
145                     <span class="fa fa-lg fa-sign-in"></span>
146                     <p style="margin-left: 1.6em; margin-top: -1.35em; margin-bottom: 0em; margin-right: 0.5em;">Log in or register with<br/>any Google account</p>
147                   </a>
148                 </li>
149               </ul>
150             </li>
151           <% end %>
152
153           <li class="dropdown help-menu">
154             <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="arv-help">
155               <span class="fa fa-lg fa-question-circle"></span>
156               <span class="caret"></span>
157             </a>
158             <ul class="dropdown-menu">
159               <li role="presentation" class="dropdown-header">
160                 Help
161               </li>
162               <% if Rails.configuration.enable_getting_started_popup %>
163                 <li>
164                 <%= link_to raw('<i class="fa fa-fw fa-info"></i> Getting Started ...'), "#",
165                      {'data-toggle' => "modal", 'data-target' => '#getting-started-modal-window'}  %>
166                 </li>
167               <% end %>
168               <% if Rails.configuration.arvados_public_data_doc_url %>
169                 <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> Public Pipelines and Data sets'), "#{Rails.configuration.arvados_public_data_doc_url}", target: "_blank" %></li>
170               <% end %>
171               <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> Tutorials and User guide'), "#{Rails.configuration.arvados_docsite}/user", target: "_blank" %></li>
172               <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> API Reference'), "#{Rails.configuration.arvados_docsite}/api", target: "_blank" %></li>
173               <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> SDK Reference'), "#{Rails.configuration.arvados_docsite}/sdk", target: "_blank" %></li>
174               <li role="presentation" class="divider"></li>
175               <li> <%= link_to report_issue_popup_path(popup_type: 'version', current_location: request.url, current_path: request.fullpath, action_method: 'post'),
176                       {class: 'report-issue-modal-window', remote: true, return_to: request.url} do %>
177                        <i class="fa fa-fw fa-support"></i> Show version / debugging info ...
178                       <% end %>
179               </li>
180               <li> <%= link_to report_issue_popup_path(popup_type: 'report', current_location: request.url, current_path: request.fullpath, action_method: 'post'),
181                       {class: 'report-issue-modal-window', remote: true, return_to: request.url} do %>
182                        <i class="fa fa-fw fa-support"></i> Report a problem ...
183                       <% end %>
184               </li>
185             </ul>
186           </li>
187         </ul>
188       </div><!-- /.navbar-collapse -->
189     </nav>
190
191     <% if current_user.andand.is_active %>
192       <nav class="navbar navbar-default breadcrumbs" role="navigation">
193         <ul class="nav navbar-nav navbar-left">
194           <li>
195             <a href="/">
196               <i class="fa fa-lg fa-fw fa-dashboard"></i>
197               Dashboard
198             </a>
199           </li>
200           <li class="dropdown">
201             <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="projects-menu">
202               Projects
203               <span class="caret"></span>
204             </a>
205             <ul class="dropdown-menu" style="min-width: 20em" role="menu">
206               <li role="menuitem">
207                   <%= link_to(
208                         url_for(
209                           action: 'choose',
210                           controller: 'search',
211                           filters: [['uuid', 'is_a', 'arvados#group']].to_json,
212                           title: 'Search',
213                           action_name: 'Show',
214                           action_href: url_for(controller: :actions, action: :show),
215                           action_method: 'get',
216                           action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json),
217                         { remote: true, method: 'get', title: "Search" }) do %>
218                     <i class="glyphicon fa-fw glyphicon-search"></i> Search all projects ...
219                   <% end %>
220                </li>
221               <% if Rails.configuration.anonymous_user_token and Rails.configuration.enable_public_projects_page %>
222                 <li role="menuitem"><a href="/projects/public" role="menuitem"><i class="fa fa-fw fa-list"></i> Browse public projects </a>
223                 </li>
224               <% end %>
225               <li role="menuitem">
226                 <%= link_to projects_path(options: {ensure_unique_name: true}), role: 'menu-item', method: :post do %>
227                   <i class="fa fa-fw fa-plus"></i> Add a new project
228                 <% end %>
229               </li>
230               <li role="presentation" class="divider"></li>
231               <%= render partial: "projects_tree_menu", locals: {
232                   :project_link_to => Proc.new do |pnode, &block|
233                     link_to(project_path(pnode[:object].uuid),
234                       data: { 'object-uuid' => pnode[:object].uuid,
235                               'name' => 'name' },
236                       &block)
237                   end,
238               } %>
239             </ul>
240           </li>
241           <% if @name_link or @object %>
242             <li class="nav-separator">
243               <i class="fa fa-lg fa-angle-double-right"></i>
244             </li>
245             <li>
246               <%= link_to project_path(current_user.uuid) do %>
247                 Home
248               <% end %>
249             </li>
250             <% project_breadcrumbs.each do |p| %>
251               <li class="nav-separator">
252                 <i class="fa fa-lg fa-angle-double-right"></i>
253               </li>
254               <li>
255                 <%= link_to(p.name, project_path(p.uuid), data: {object_uuid: p.uuid, name: 'name'}) %>
256               </li>
257             <% end %>
258           <% end %>
259         </ul>
260       </nav>
261     <% elsif !current_user %>   <%# anonymous %>
262       <% if (@name_link or @object) and (project_breadcrumbs.any?) %>
263         <nav class="navbar navbar-default breadcrumbs" role="navigation">
264           <ul class="nav navbar-nav navbar-left">
265             <li>
266               <a href="/projects/public">Public Projects</a>
267             </li>
268             <% project_breadcrumbs.each do |p| %>
269               <li class="nav-separator">
270                 <i class="fa fa-lg fa-angle-double-right"></i>
271               </li>
272               <li>
273                 <%= link_to(p.name, project_path(p.uuid), data: {object_uuid: p.uuid, name: 'name'}) %>
274               </li>
275             <% end %>
276           </ul>
277         </nav>
278       <% end %>
279     <% end %>
280
281     <%= render partial: 'browser_unsupported' %><%# requires JS support below %>
282     <%= render partial: 'getting_started/getting_started_popup' %>
283
284     <div id="page-wrapper">
285       <%= yield %>
286     </div>
287   </div>
288
289   <%= yield :footer_html %>
290
291 <div class="modal-container"></div>
292 <div id="report-issue-modal-window"></div>
293 <script src="/browser_unsupported.js"></script>
294
295 <%  if Rails.configuration.enable_getting_started_popup and current_user and !current_user.prefs[:getting_started_shown] and
296        !request.url.include?("/profile") and
297        !request.url.include?("/user_agreements") and
298        !request.url.include?("/inactive")%>
299   <script>
300     $("#getting-started-modal-window").modal('show');
301   </script>
302   <%
303     prefs = current_user.prefs
304     prefs[:getting_started_shown] = Time.now
305     current_user.update_attributes prefs: prefs.to_json
306   %>
307 <% end %>