From 076917967b51efd65acb391d90d41f4112791bf0 Mon Sep 17 00:00:00 2001 From: Loic Baron <loic.baron@lip6.fr> Date: Wed, 2 Apr 2014 12:40:39 +0200 Subject: [PATCH] wip user info and slices list --- portal/templates/base.html | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/portal/templates/base.html b/portal/templates/base.html index 29d1b3fe..1c5a2d49 100644 --- a/portal/templates/base.html +++ b/portal/templates/base.html @@ -1,7 +1,7 @@ {% load portal_filters %} {# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html> <html lang="en"><head> -<title>OneLab - {{ section }}</title> +<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"> {# This is where insert_str will end up #}{% media_container prelude %} @@ -31,6 +31,39 @@ {% insert_str prelude "css/topmenu.css" %} {% insert_str prelude "js/logout.js" %} <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css"> + +<script type="text/javascript"> +/* +XXX TODO: session +This list of slices should go into SESSION ! +*/ +$(document).ready(function() { + + user = myslice.user(); + if(user.length>0){ + $.each( user.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 %} +}); +</script> </head> <body> {% block container %} -- 2.47.0