Merge branch 'master' into 2272-setup-user-in-workbench
[arvados.git] / apps / workbench / app / views / layouts / application.html.erb
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta charset="utf-8">
5   <title>
6     <% if content_for? :page_title %>
7     <%= yield :page_title %> / <%= Rails.configuration.site_name %>
8     <% else %>
9     <%= Rails.configuration.site_name %>
10     <% end %>
11   </title>
12   <meta name="viewport" content="width=device-width, initial-scale=1.0">
13   <link rel="icon" href="/favicon.ico" type="image/x-icon">
14   <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
15   <meta name="description" content="">
16   <meta name="author" content="">
17   <%= stylesheet_link_tag    "application", :media => "all" %>
18   <%= javascript_include_tag "application" %>
19   <%= csrf_meta_tags %>
20   <%= yield :head %>
21   <%= javascript_tag do %>
22   <%= yield :js %>
23   <% end %>
24   <style>
25     <%= yield :css %>
26     body {
27     min-height: 100%;
28     height: 100%;
29     }
30
31     body > div.container-fluid {
32     padding-top: 70px; /* 70px to make the container go all the way to the bottom of the navbar */
33     }
34
35     body > div.container-fluid > div.col-sm-9.col-sm-offset-3 {
36     overflow: auto;
37     }
38
39     @media (max-width: 979px) { body { padding-top: 0; } }
40
41     .navbar .nav li.nav-separator > span.glyphicon.glyphicon-arrow-right {
42     padding-top: 1.25em;
43     }
44
45     @media (min-width: 768px) {
46     .left-nav {
47     position: fixed;
48     }
49     }
50     @media (max-width: 767px) {
51     .breadcrumbs {
52     display: none;
53     }
54     }
55   </style>
56 </head>
57 <body>
58
59   <div class="navbar navbar-default navbar-fixed-top">
60     <div class="container-fluid">
61       <div class="navbar-header">
62         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#workbench-navbar.navbar-collapse">
63           <span class="sr-only">Toggle navigation</span>
64           <span class="icon-bar"></span>
65           <span class="icon-bar"></span>
66           <span class="icon-bar"></span>
67         </button>
68         <a class="navbar-brand" href="/"><%= Rails.configuration.site_name rescue Rails.application.class.parent_name %></a>
69       </div>
70
71       <div class="collapse navbar-collapse" id="workbench-navbar">
72       <ul class="nav navbar-nav navbar-left breadcrumbs">
73         <% if current_user %>
74         <% if content_for?(:breadcrumbs) %>
75           <%= yield(:breadcrumbs) %>
76         <% else %>
77           <li class="nav-separator"><span class="glyphicon glyphicon-arrow-right"></span></li>
78           <li>
79             <%= link_to(
80                         controller.model_class.to_s.pluralize.underscore.gsub('_', ' '),
81                         url_for({controller: params[:controller]})) %>
82           </li>
83           <% if params[:action] != 'index' %>
84             <li class="nav-separator">
85               <span class="glyphicon glyphicon-arrow-right"></span>
86             </li>
87             <li>
88               <%= link_to controller.breadcrumb_page_name, request.fullpath %>
89             </li>
90             <li style="padding: 14px 0 14px">
91               <%= form_tag do |f| %>
92                 <%= render :partial => "selection_checkbox", :locals => {:object => @object} %>
93               <% end %>
94             </li>
95           <% end %>
96         <% end %>
97         <% end %>
98       </ul>
99
100       <ul class="nav navbar-nav navbar-right">
101
102         <li>
103           <a><i class="rotating loading glyphicon glyphicon-refresh"></i></a>
104         </li>
105
106         <% if current_user %>
107         <!-- XXX placeholder for this when search is implemented
108         <li>
109           <form class="navbar-form" role="search">
110             <div class="input-group" style="width: 220px">
111               <input type="text" class="form-control" placeholder="search">
112               <span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
113             </div>
114           </form>
115         </li>
116         -->
117
118         <li class="dropdown notification-menu">
119           <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="collections-menu">
120             <span class="glyphicon glyphicon-paperclip"></span>
121             <span class="badge" id="persistent-selection-count"></span>
122             <span class="caret"></span>
123           </a>
124             <ul class="dropdown-menu" role="menu" id="persistent-selection-list">
125               <%= form_tag '/actions' do %>
126               <div id="selection-form-content"></div>
127               <% end %>
128           </ul>
129         </li>
130
131         <% if current_user.is_active %>
132         <li class="dropdown notification-menu">
133           <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
134             <span class="glyphicon glyphicon-envelope"></span>
135             <span class="badge badge-alert notification-count"><%= @notification_count %></span>
136             <span class="caret"></span>
137           </a>
138           <ul class="dropdown-menu" role="menu">
139             <% if (@notifications || []).length > 0 %>
140               <% @notifications.each_with_index do |n, i| %>
141                 <% if i > 0 %><li class="divider"></li><% end %>
142                 <li class="notification"><%= n.call(self) %></li>
143               <% end %>
144             <% else %>
145               <li class="notification empty">No notifications.</li>
146             <% end %>
147           </ul>
148         </li>
149         <% end %>
150
151         <li class="dropdown">
152           <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="user-menu">
153             <span class="glyphicon glyphicon-user"></span><span class="caret"></span>
154           </a>
155           <ul class="dropdown-menu" role="menu">
156             <li role="presentation" class="dropdown-header"><%= current_user.email %></li>
157             <% if current_user.is_active %>
158             <li role="presentation" class="divider"></li>
159             <li role="presentation"><a href="/authorized_keys" role="menuitem">Manage ssh keys</a></li>
160             <li role="presentation"><a href="/api_client_authorizations" role="menuitem">Manage API tokens</a></li>
161             <li role="presentation" class="divider"></li>
162             <% end %>
163             <li role="presentation"><a href="<%= logout_path %>" role="menuitem">Log out</a></li>
164           </ul>
165         </li>
166         <% else -%>
167           <li><a href="<%= $arvados_api_client.arvados_login_url(return_to: root_url) %>">Log in</a></li>
168         <% end -%>
169       </ul>
170       </div><!-- /.navbar-collapse -->
171     </div><!-- /.container-fluid -->
172   </div>
173
174   <div class="container-fluid">
175       <div class="col-sm-9 col-sm-offset-3">
176         <div id="content" class="body-content">
177           <%= yield %>
178         </div>
179       </div>
180       <div class="col-sm-3 left-nav">
181         <div class="arvados-nav-container">
182         <% if current_user.andand.is_active %>
183         <div class="well">
184         <ul class="arvados-nav">
185           <li class="<%= 'arvados-nav-active' if params[:action] == 'home' %>">
186             <a href="/">Dashboard</a>
187           </li>
188
189           <% [['Data', [['collections', 'Collections (data files)'],
190                         ['humans'],
191                         ['traits'],
192                         ['specimens'],
193                         ['links']]],
194               ['Activity', [['pipeline_instances', 'Recent pipeline instances'],
195                             ['jobs', 'Recent jobs']]],
196               ['Compute', [['pipeline_templates'],
197                            ['repositories', 'Code repositories'],
198                            ['virtual_machines']]],
199               ['System', [['users'],
200                          ['groups'],
201                          ['nodes', 'Compute nodes'],
202                          ['keep_disks']]]].each do |j| %>
203             <li><%= j[0] %>
204               <ul>
205               <% j[1].each do |k| %>
206                 <% unless k[0] == 'users' and !current_user.andand.is_admin %>
207                   <li class="<%= 'arvados-nav-active' if (params[:controller] == k[0] && params[:action] != 'home') %>">
208                     <a href="/<%= k[0] %>">
209                       <%= if k[1] then k[1] else k[0].capitalize.gsub('_', ' ') end %>
210                     </a>
211                   </li>
212                 <% end %>
213               <% end %>
214               </ul>
215             </li>
216           <% end %>
217
218           <li>Help
219             <ul>
220               <li><%= link_to 'Tutorials and User guide', "#{Rails.configuration.arvados_docsite}/user", target: "_blank" %></li>
221               <li><%= link_to 'API Reference', "#{Rails.configuration.arvados_docsite}/api", target: "_blank" %></li>
222               <li><%= link_to 'SDK Reference', "#{Rails.configuration.arvados_docsite}/sdk", target: "_blank" %></li>
223               <li><%= link_to 'Admin guide', "#{Rails.configuration.arvados_docsite}/admin", target: "_blank" %></li>
224             </ul>
225           </li>
226         </ul>
227         </div>
228         <% end %>
229       </div>
230         </div>
231   </div>
232
233   <%= piwik_tracking_tag %>
234   <%= javascript_tag do %>
235   <%= yield :footer_js %>
236   <% end %>
237
238 </body>
239 </html>