from autonomie.default_layouts import DefaultLayout from autonomie.views.project.routes import ( PROJECT_ITEM_ROUTE, PROJECT_ITEM_ESTIMATION_ROUTE, PROJECT_ITEM_INVOICE_ROUTE, PROJECT_ITEM_PHASE_ROUTE, PROJECT_ITEM_GENERAL_ROUTE, PROJECT_ITEM_BUSINESS_ROUTE, PROJECT_ITEM_FILE_ROUTE, ) logger = logging.getLogger(__name__) ProjectMenu = Menu(name="projectmenu") def deferred_business_list_show_perms(item, kw): proj = kw['current_project'] request = kw['request'] return proj.project_type.name != 'default' and \ request.has_permission('list.businesses') def deferred_phase_show_perms(item, kw): """ Check if the phase menu should be shown """ proj = kw['current_project'] request = kw['request']
from autonomie.default_layouts import DefaultLayout from autonomie.views.project.routes import ( PROJECT_ITEM_ROUTE, PROJECT_ITEM_ESTIMATION_ROUTE, PROJECT_ITEM_INVOICE_ROUTE, PROJECT_ITEM_PHASE_ROUTE, PROJECT_ITEM_GENERAL_ROUTE, PROJECT_ITEM_BUSINESS_ROUTE, PROJECT_ITEM_FILE_ROUTE, ) logger = logging.getLogger(__name__) ProjectMenu = Menu(name="projectmenu") @colander.deferred def deferred_business_list_label(item, kw): """ return the label to be used for the given item """ proj = kw['current_project'] if proj.project_type.name == 'training': return u"Liste des formations" elif proj.project_type.name == "construction": return u"Liste des chantiers" else: return u"Liste des affaires"
import pkg_resources from autonomie.resources import ( user_resources, ) from autonomie.models.user.user import User from autonomie.utils.menu import ( MenuItem, AttrMenuItem, Menu, ) logger = logging.getLogger(__name__) UserMenu = Menu(name="usermenu") UserMenu.add( MenuItem( name="user", label=u'Compte utilisateur', route_name=u'/users/{id}', icon=u'fa fa-user-o', perm='view.user', ) ) UserMenu.add( AttrMenuItem( name="login", label=u'Identifiants', route_name=u'/users/{id}/login',
from autonomie.utils.menu import ( MenuItem, Menu, ) from autonomie.default_layouts import DefaultLayout from autonomie.views.business.routes import ( BUSINESS_ITEM_ROUTE, BUSINESS_ITEM_OVERVIEW_ROUTE, # BUSINESS_ITEM_ESTIMATION_ROUTE, BUSINESS_ITEM_INVOICE_ROUTE, BUSINESS_ITEM_FILE_ROUTE, ) logger = logging.getLogger(__name__) BusinessMenu = Menu(name="businessmenu") BusinessMenu.add( MenuItem( name='overview', label=u"Vue générale", route_name=BUSINESS_ITEM_OVERVIEW_ROUTE, icon="fa fa-line-chart", perm="view.business", )) # BusinessMenu.add( # MenuItem( # name='business_estimations', # label=u"Devis", # route_name=BUSINESS_ITEM_ESTIMATION_ROUTE, # icon=u"fa fa-files-o", # perm="list.estimations",
MenuItem, Menu, ) from autonomie.default_layouts import DefaultLayout from autonomie.views.business.routes import ( BUSINESS_ITEM_ROUTE, BUSINESS_ITEM_OVERVIEW_ROUTE, # BUSINESS_ITEM_ESTIMATION_ROUTE, BUSINESS_ITEM_INVOICE_ROUTE, BUSINESS_ITEM_FILE_ROUTE, ) logger = logging.getLogger(__name__) BusinessMenu = Menu(name="businessmenu") BusinessMenu.add( MenuItem( name='overview', label=u"Vue générale", route_name=BUSINESS_ITEM_OVERVIEW_ROUTE, icon="fa fa-line-chart", perm="view.business", ) ) # BusinessMenu.add( # MenuItem( # name='business_estimations', # label=u"Devis", # route_name=BUSINESS_ITEM_ESTIMATION_ROUTE, # icon=u"fa fa-files-o",
return label @colander.deferred def deferred_login_label(item, kw): """ Custom deferred label for the login sidebar entry """ current_user = kw['current_user'] if current_user.login: return u"Identifiants" else: return u"<em>Identifiants</em>" UserMenu = Menu(name="usermenu") UserMenu.add( MenuItem( name="user", label=u'Compte utilisateur', route_name=u'/users/{id}', icon=u'fa fa-user-o', perm='view.user', )) UserMenu.add( AttrMenuItem( name="login", label=deferred_login_label, route_name=u'/users/{id}/login', icon=u'fa fa-lock',
if current_user.login: return u"Identifiants" else: return u"<em>Identifiants</em>" def deferred_accounting_show_perm(item, kw): request = kw['request'] current_user = kw['current_user'] if current_user.login: return request.has_permission('admin_treasury') else: return False UserMenu = Menu(name="usermenu") UserMenu.add( MenuItem( name="user", label=u'Compte utilisateur', route_name=USER_ITEM_URL, icon=u'fa fa-user-o', perm='view.user', ) ) UserMenu.add( AttrMenuItem( name="login", label=deferred_login_label, route_name=USER_LOGIN_URL,