X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=blobdiff_plain;f=myslice%2Fviewutils.py;h=b9309e1b123fddd2d44b1935690eab719b841171;hp=ecdd81f4464637db80cdcbdd5d8186a040b72883;hb=c33d0dd5fbfbd8e16c7d971100a851469d313eff;hpb=a222cef0a10a5517349f05cea0e382b35e3a14a6 diff --git a/myslice/viewutils.py b/myslice/viewutils.py index ecdd81f4..b9309e1b 100644 --- a/myslice/viewutils.py +++ b/myslice/viewutils.py @@ -1,22 +1,39 @@ # a set of utilities to help make the global layout consistent across views -from copy import deepcopy - -standard_topmenu_items = [ { 'label':'Plugin', 'href': '/plugin/'}, - { 'label':'Slice', 'href': '/slice/'}, - { 'label':'Scroll', 'href': '/scroll/'}, - { 'label':'Tab', 'href': '/tab/'}, - ] +# this +standard_topmenu_items = [ +# { 'label':'Tab', 'href': '/tab/'}, +# { 'label':'Scroll', 'href': '/scroll/'}, +# { 'label':'One Plugin', 'href': '/plugin/'}, +# Thierry : using this goes to some test slice that not every one is in +# besides, the topmenu needs to be shrunk down horizontally +# otherwise the topmenu takes more vertical space than avail. and the layout is broken +# { 'label':'Slice', 'href': '/slice/'}, + #{'label':'My Account', 'href': '/portal/account/'} + ] #login_out_items = { False: { 'label':'Login', 'href':'/login/'}, # True: { 'label':'Logout', 'href':'/logout/'}} def topmenu_items (current,request=None): - result=deepcopy(standard_topmenu_items) + has_user=request.user.is_authenticated() + result=[] + if has_user: + result.append({'label':'Platforms', 'href': '/portal/platforms/'}) + result.append({ 'label':'Dashboard', 'href': '/portal/dashboard/'}) + # This should probably go in dashboard at some point + result.append({ 'label':'Request a slice', 'href': '/portal/slice_request/'}) + result.append({'label':'My Account', 'href': '/portal/account/'}) + else: + result.append({'label':'Home', 'href': '/login'}) + # looks like this is accessible to non-logged users + result.append({'label':'Platforms', 'href': '/portal/platforms/'}) + result.append({ 'label':'Register', 'href': '/portal/register/'}) + result.append({'label':'Contact Support', 'href': '/portal/contact/'}) for d in result: - if d['label'].lower().find(current)>=0: d['active']=True + #if d['label'].lower()find(current)>=0: d['is_active']=True + if d['label'] == current: d['is_active']=True if not request: return result - has_user=request.user.is_authenticated() # result.append (login_out_items [ has_user] ) return result @@ -57,6 +74,8 @@ hard_wired_list.append("just like a standard plugin can be set as visible or not hard_wired_list.append("") hard_wired_list.append("OTOH and IMHO, there should be two separate and explicit subclasses of SimpleList for slices or testbeds") -quickfilter_criterias = [{'key': 'Slice', 'values': ['slice1','slice2']}, \ - {'key': 'Type', 'values': ['type1','type2']}, \ - {'key': 'Network', 'values': ['net1','net2']}] +quickfilter_criterias = [ + {'key': 'Slice', 'values': ['slice1','slice2']}, + {'key': 'Type', 'values': ['type1','type2']}, + {'key': 'Network', 'values': ['net1','net2']}, + ]