Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
[myslice.git] / portal / templates / onelab / onelab_home-view.html
1 {% extends "layout.html" %}
2
3 {% block content %}
4 <div class="row" id="home-dashboard">
5         <ul class="nav nav-tabs">
6           <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
7           <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
8         </ul>
9         <div class="home-panel" id="user">
10                 <table>
11                         <tr>
12                                 <td>ACCOUNT</td>
13                                 <td>SLICES</td>
14                                 <td>SUPPORT</td>
15                         </tr>
16                         <tr>
17                                 <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
18                                 <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
19                                 <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
20                         </tr>
21                         <tr>
22                                 {% if person %}
23                                 <td class="logged-in">
24                                         <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
25                                         <div>
26                                         {% if person.last_name %}
27                                                 {{person.first_name}} {{person.last_name}}<br />
28                                         {% endif %}
29                                         <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
30                                 </div>
31                                 {% else %}
32                                 <td>
33                                         {% include 'onelab__widget-login-user.html' %}
34                                 {% endif %}
35                                 </td>
36                                 <td>
37                                 {% if person %}
38                                         <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request a Slice</button>
39                                         <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
40                                 {% else %}
41                                 {% endif %}
42                                 </td>
43                                 <td class="support">
44                                         <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
45                                         <div>
46                                                 <a href="/portal/contact">Contact</a> <br />
47                                                 <a href="/portal/support/documentation">Documentation</a>
48                                         </div>
49                                 </td>
50                         </tr>
51                 </table>
52         </div>
53         <div class="home-panel" id="manager">
54                 <table>
55                         <tr>
56                                 <td>INSTITUTION</td>
57                                 <td>SLICES</td>
58                                 <td>REQUESTS</td>
59                         </tr>
60                         <tr>
61                                 <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
62                                 <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
63                                 <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
64                         </tr>
65                         <tr>
66                                 {% if person %}
67                                 <td class="logged-in">
68                                         <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
69                                 {% else %}
70                                 <td>
71                                         {% include 'onelab__widget-login-manager.html' %}
72                                 {% endif %}
73                                 </td>
74                                 <td>
75                                         {% if person %}
76                                     <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create a Slice</button>
77                                         {% endif %}
78                                 </td>
79                                 <td class="support">
80                                         {% if person %}
81                                     <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
82                                         {% endif %}
83                                 </td>
84                         </tr>
85                 </table>
86         </div>
87 </div>
88 <script>
89         $(document).ready(function() {
90                 $('a.home-tab').click(function() {
91                         $('ul.nav-tabs li').removeClass('active');
92                         $(this).parent().addClass('active');
93                         $('div.home-panel').hide();
94                         $('div#'+$(this).data('panel')).show();
95                 });
96                 $('button#validaterequestbtn').click(function() {
97                         window.location="/portal/validate/";
98                 });
99                 $('button#ticketbtn').click(function() {
100                         window.location="/portal/contact/";
101                 });
102                 $('button#slicerequestbtn').click(function() {
103                         window.location="/portal/slice_request/";
104                 });
105                 
106                 {% if person %}
107         $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
108                   var items = [];
109                   $.each( data[0].slices, function(i, val) {
110                         items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
111                   });
112                   
113                   $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
114                   
115                 });
116                 {% endif %}
117         });
118 </script>
119 {% endblock %}