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" ProjectMenu.add( MenuItem( name="project_businesses", label=deferred_business_list_label, route_name=PROJECT_ITEM_BUSINESS_ROUTE, icon=u'fa fa-folder-open', perm='list.businesses', ) ) ProjectMenu.add( MenuItem( name="project_phases", label=u"Document rangés par dossiers", route_name=PROJECT_ITEM_PHASE_ROUTE, icon=u'fa fa-folder-open', perm='view.project', ) ) ProjectMenu.add( MenuItem(
""" Check if the phase menu should be shown """ proj = kw['current_project'] request = kw['request'] if proj.project_type.name in ('training', 'construction'): return False else: return True and request.has_permission('view.project') ProjectMenu.add( MenuItem( name="project_businesses", label=u"Liste des affaies", route_name=PROJECT_ITEM_BUSINESS_ROUTE, icon=u'fa fa-folder-open', perm=deferred_business_list_show_perms, ) ) ProjectMenu.add( MenuItem( name="project_phases", label=u"Document rangés par dossiers", route_name=PROJECT_ITEM_PHASE_ROUTE, icon=u'fa fa-folder-open', perm=deferred_phase_show_perms, ) ) ProjectMenu.add( MenuItem(
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", # ) # ) BusinessMenu.add( MenuItem( name='business_invoices',
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', icon=u'fa fa-lock', disable_attribute='login', perm_context_attribute="login", perm='view.login', ), )
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, icon=u'fa fa-lock', disable_attribute='login', perm_context_attribute="login", perm='view.login', ), )