X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=myslice%2Fviewutils.py;h=fd364bc2d237cbc922028e699ae4cef620e48dac;hb=90cfd378e8bec3397b3c0c9171d8e7cac7589700;hp=2073ab48594f8c16c2db5e2f1f2077c39814e7c9;hpb=a2ae7986853adb271361957a08effd0c9537e7a3;p=myslice.git diff --git a/myslice/viewutils.py b/myslice/viewutils.py index 2073ab48..fd364bc2 100644 --- a/myslice/viewutils.py +++ b/myslice/viewutils.py @@ -3,22 +3,28 @@ from copy import deepcopy standard_topmenu_items = [ - { 'label':'Tab', 'href': '/tab/'}, - { 'label':'Scroll', 'href': '/scroll/'}, - { 'label':'Slice', 'href': '/slice/'}, - { 'label':'Plugin', 'href': '/plugin/'}, - { 'label':'Dashboard', 'href': '/dashboard/'}, +# { 'label':'Tab', 'href': '/tab/'}, +# { 'label':'Scroll', 'href': '/scroll/'}, +# { 'label':'One Plugin', 'href': '/plugin/'}, + { 'label':'Dashboard', 'href': '/portal/dashboard/'}, + { 'label':'Slice', 'href': '/slice/'}, ] #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() + if has_user: + result=deepcopy(standard_topmenu_items) + result.append({ 'label':'Request a slice', 'href': '/portal/slice_request/'}) + else: + result = [] + result.append({ 'label':'Register', 'href': '/portal/user/register/'}) 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