Opening changes
[myslice.git] / portal / templates / base.html
index 1c5a2d4..5989508 100644 (file)
@@ -3,11 +3,12 @@
 <html lang="en"><head>
 <title>{{theme}} portal - {{ section }}</title>
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
-<link rel="shortcut icon" href="/static/img/myslice-icon.png">
+<link rel="shortcut icon" href="/static/img/favicon_fed4fire.ico">
 {# This is where insert_str will end up #}{% media_container prelude %}
 {% include 'messages-transient-header.html' %}
 <script type="text/javascript"> {# raw js code - use {% insert prelude_js %} ... {% endinsert %} #} {% container prelude_js %}</script>
 <script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
+<script src="{{ STATIC_URL }}js/jquery.qtip.min.js"></script>
 <script src="{{ STATIC_URL }}js/bootstrap.datatables.js"></script>
 <!-- <script src="{{ STATIC_URL }}js/stash.min.js"></script> -->
 <script src="{{ STATIC_URL }}js/myslice.js"></script>
@@ -31,6 +32,8 @@
 {% insert_str prelude "css/topmenu.css" %}
 {% insert_str prelude "js/logout.js" %}
 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css">
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/jquery.qtip.min.css">
+
 
 <script type="text/javascript">
 /*
@@ -38,30 +41,38 @@ XXX TODO: session
 This list of slices should go into SESSION !
 */
 $(document).ready(function() {
+    {% if username %}
+    myslice.login();
 
     user = myslice.user();
-    if(user.length>0){
-       $.each( user.slices, function(i, val) {
-               items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+    
+    var slices = [];
+    if($.isEmptyObject(user)){
+        $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+            if(data.length > 0){
+                drawSlices(data[0].slices);  
+            }else{
+               $("div#home-slice-list").html(
+                                       "<div>You do not yet have a slice</div>");
+                       $("ul#dropdown-slice-list").append("<li>no slice</li>");
+                slices.push("no slice");
+            }
        });
-       $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
-       $("ul#dropdown-slice-list").append(items.join( "" ));
+    }else{
+        slices = user.slices;
+        drawSlices(slices);
+    }
+    function drawSlices(slices){
+        var items = [];
+               
+        $.each( slices, function(i, val) {
+            items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+        });
+        $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+        $("ul#dropdown-slice-list").append(items.join( "" ));
     }
-       {% if person %}
-    $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
-         var items = [];
-      if(data.length > 0){
-                 $.each( data[0].slices, function(i, val) {
-                       items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
-                 });
-                 
-                 $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
-                 $("ul#dropdown-slice-list").append(items.join( "" ));
-         }else{
-                 $("div#home-slice-list").html("no slice");
-      } 
-       });
-       {% endif %}
+    {% endif %}
+       jQuery('[title!=""]').qtip();
 });
 </script>
 </head>