def stream_actions(self, tva): """ Stream the actions available for the given tva object :param obj tva: Tva instance :returns: List of 5-uples (url, label, title, icon, disable) """ yield Link( self._get_item_url(tva), u"Voir/Modifier", icon=u"pencil", ) if tva.active: yield Link( self._get_item_url(tva, action='disable'), label=u"Désactiver", title=u"La TVA n'apparaitra plus dans l'interface", icon=u"remove", ) if not tva.default: yield Link( self._get_item_url(tva, action='set_default'), label=u"Définir comme Taux de Tva par défaut", title=u"La TVA sera sélectionnée par défaut dans les " u"formulaires", ) else: yield Link( self._get_item_url(tva, action='disable'), u"Activer", title=u"La TVA apparaitra plus dans l'interface", icon="fa fa-check", )
def stream_actions(self, company): yield Link( self.request.route_path('company', id=company.id), u"Voir/Modifier", title=u"Voir/Modifier l'enseigne", icon='fa fa-pencil', ) url = self.request.route_path( 'company', id=company.id, _query=dict(action="disable") ) if company.active: yield Link( url, u"Désactiver", title=u"Désactiver l'entreprise", icon='fa fa-book', ) else: yield Link( url, u"Activer", title=u"Activer l'entreprise", icon='fa fa-book', )
def stream_actions(self, item): yield Link(self._get_item_url(item), u"Télécharger", title=u"Télécharger le fichier odt", icon=u"download") yield Link(self._get_item_url(item, action='edit'), u"Modifier", title=u"Modifier le modèle", icon=u"pencil") if item.active: yield Link( self._get_item_url(item, action='disable'), u"Désactiver", title=u"Désactiver le modèle afin qu'il ne soit plus proposé", icon=u"remove") else: yield Link(self._get_item_url(item, action='disable'), u"Activer", title=u"Activer le modèle afin qu'il soit proposé dans " u"l'interface", icon=u"check") yield Link( self._get_item_url(item, action='delete'), u"Supprimer", title=u"Supprimer définitivement le modèle", confirm=u"Êtes-vous sûr de vouloir supprimer ce modèle ?", icon=u"trash", css="label-warning", )
def stream_actions(request, item): """ Collect actions available for the given item """ if request.has_permission('edit.file', item): yield Link( request.route_path('file', id=item.id), u"Voir le détail / Modifier", icon='pencil', ) if request.has_permission('view.file', item): yield Link( request.route_path('file', id=item.id, _query=dict(action='download')), u"Télécharger", icon="download", ) if request.context.id == item.parent_id: if request.has_permission('delete.file', item): yield Link( request.route_path('file', id=item.id, _query=dict(action='delete')), u"Supprimer", confirm=u"Êtes-vous sûr de vouloir définitivement supprimer " u"ce fichier ?", icon="trash", )
def stream_actions(self, type_): if type_.editable: yield Link( self._get_item_url(type_), u"Voir/Modifier", icon=u"pencil", ) if type_.active: yield Link( self._get_item_url(type_, action='disable'), u"Désactiver", title=u"Ce type de sous-projet ne sera plus proposé aux " u"utilisateurs", icon=u"remove", ) else: yield Link( self._get_item_url(type_, action='disable'), u"Activer", title=u"Ce type de sous-projet sera proposé aux utilisateurs", icon=u"check-square-o", ) if not type_.is_used(): yield Link( self._get_item_url(type_, action='delete'), u"Supprimer", title=u"Supprimer ce type de sous-projet", icon=u"trash", confirm=u"Êtes-vous sûr de vouloir supprimer cet élément ?" )
def stream_actions(self, item): yield Link( self._get_item_url(item), u"Voir/Modifier", icon=u"pencil", ) if item.active: yield Link( self._get_item_url(item, action='disable'), u"Désactiver", title=u"Ce type de document ne sera plus proposé dans les " u"formulaires", icon=u"remove", ) else: yield Link( self._get_item_url(item, action='disable'), u"Activer", icon=u"check-square-o", ) if not item.is_used: yield Link( self._get_item_url(item, action='delete'), u"Supprimer", icon=u"trash", )
def _stream_actions(request, item): """ Return actions that will be rendered in a dropdown """ yield Link(request.route_path("/%ss/{id}" % item.type_, id=item.id), u"Voir / Modifier", icon="fa fa-pencil") yield Link(request.route_path("/%ss/{id}.pdf" % item.type_, id=item.id), u"PDF", title=u"Enregistrer le PDF", icon="fa fa-file-pdf-o") if request.has_permission('duplicate.%s' % item.type_, item): yield Link(request.route_path("/%ss/{id}/duplicate" % item.type_, id=item.id), u"Dupliquer", icon="fa fa-copy") if request.has_permission('delete.%s' % item.type_, item): yield Link(request.route_path("/%ss/{id}/delete" % item.type_, id=item.id), u"Supprimer", confirm=u"Êtes-vous sûr de vouloir supprimer ce document ?", icon="fa fa-trash") for phase in request.context.phases: if phase.id != item.phase_id: yield Link( request.route_path("/%ss/{id}/move" % item.type_, id=item.id, _query={'phase': phase.id}), u"Déplacer vers le dossier %s" % phase.name, icon="fa fa-arrows-alt", )
def stream_actions(self, item): """ Stream actions available for the given item """ yield Link( self.request.route_path( USER_USERDATAS_EDIT_URL, id=item.user_id ), u"Voir", title=u"Voir / modifier les données de gestion sociales", icon=u"fa fa-pencil", ) yield Link( self.request.route_path( USERDATAS_ITEM_URL, id=item.id, _query={'action': 'delete'} ), u"Supprimer", title=u"Supprimer la fiche de gestion sociale", icon=u"fa fa-trash", confirm=u"En supprimant cette fiche de " u"gestion sociale, vous supprimerez également \n" u"les données associées (documents sociaux, " u"parcours, historiques...). \n\nContinuer ?" )
def stream_actions(self, career_stage): """ Stream the actions available for the given career_stage object :param obj career_stage: CareerStage instance :returns: List of 5-uples (url, label, title, icon, disable) """ yield Link( self._get_item_url(career_stage), u"Voir/Modifier", icon=u"pencil", ) if career_stage.active: yield Link( self._get_item_url(career_stage, action='disable'), label=u"Désactiver", title=u"L'étape n'apparaitra plus dans l'interface", icon=u"remove", ) else: yield Link( self._get_item_url(career_stage, action='disable'), u"Activer", title=u"L'étape apparaitra plus dans l'interface", icon="fa fa-check", )
def stream_actions(self, customer): """ Return action buttons with permission handling """ yield Link( self.request.route_path("customer", id=customer.id), u"Voir", title=u"Voir/Modifier ce client", icon=u"fa fa-pencil", ) yield Link( self.request.route_path(COMPANY_PROJECTS_ROUTE, id=customer.company.id, _query=dict(action="add", customer=customer.id)), u"Ajouter un projet", title=u"Ajouter un projet pour ce client", icon=u"fa fa-plus-circle", ) if customer.archived: label = u"Désarchiver" else: label = u"Archiver" yield Link( self.request.route_path( "customer", id=customer.id, _query=dict(action="archive"), ), label, icon="book", ) if self.request.has_permission('delete_customer', customer): yield Link( self.request.route_path( "customer", id=customer.id, _query=dict(action="archive"), ), u"Supprimer", title=u"Supprimer définitivement ce client", icon="fa fa-trash", confirm=u"Êtes-vous sûr de vouloir supprimer ce client ?")
def stream_actions(self, item): """ Compile the action description for the given item """ if self._has_operations(item): yield Link( self.request.route_path( '/accounting/operation_uploads/{id}', id=item.id, ), u"Voir le détail", title=u"Voir le détail des écritures importées", icon=u"pencil", ) yield Link( self.request.route_path( '/accounting/operation_uploads/{id}', id=item.id, _query={'action': u"compile"} ), u"Recalculer les indicateurs", title=u"Recalculer les indicateurs générés depuis ce fichier " u"(ex : vous avez changé la configuration des indicateurs)", icon=u"fa fa-calculator", ) yield Link( self.request.route_path( '/accounting/operation_uploads/{id}', id=item.id, _query={'action': 'delete'} ), u"Supprimer", title=u"Supprimer les écritures téléversées ainsi que les " u"indicateurs rattachés", icon="trash", confirm=u"Supprimer ce téléversement " u"entraînera la suppression : \n- Des indicateurs générés" u" depuis ce fichier\n" u"- Des écritures enregistrées provenant de ce fichier\n" u"Continuez ?" )
def stream_actions(self, item): yield Link(self.request.route_path( BUSINESS_ITEM_ROUTE, id=item.id, ), u"Voir la formation", icon="pencil") yield Link(self.request.route_path( "customer", id=item.tasks[0].customer.id, ), u"Voir le client {}".format(item.tasks[0].customer.label), icon="pencil") yield Link(self.request.route_path( "company", id=item.project.company.id, ), u"Voir l'enseigne {}".format(item.project.company.name), icon="pencil")
def get_navigation(cls, request): result = [] for child in cls.children: if getattr(child, 'route_name', None) is not None: result.append( Link( label=child.title, route_name=child.route_name, title=child.description, )) else: url = child.get_url(request) if url: result.append( Link( label=child.title, title=child.description, url=url, )) return result
def stream_actions(self, measure_type): """ Stream the actions available for the given measure_type object :param obj measure_type: TreasuryMeasureType instance :returns: List of 4-uples (url, label, title, icon,) """ yield Link( self._get_item_url(measure_type), u"Voir/Modifier", icon=u"pencil", )
def stream_actions(self, type_): if type_.editable: yield Link( self._get_item_url(type_), u"Voir/Modifier", icon=u"pencil", ) if type_.active: yield Link( self._get_item_url(type_, action='disable'), u"Désactiver", title=u"Ce type de projet ne sera plus proposé aux " u"utilisateurs", icon=u"remove", ) else: yield Link( self._get_item_url(type_, action='disable'), u"Activer", title=u"Ce type de projet sera proposé aux utilisateurs", icon=u"check-square-o", ) if not type_.default: yield Link( self._get_item_url(type_, action='set_default'), label=u"Définir comme type par défaut", title=u"Le type sera sélectionné par défaut à la création " u"d'un projet", ) if not type_.is_used(): yield Link( self._get_item_url(type_, action='delete'), u"Supprimer", title=u"Supprimer ce type de projet", icon=u"trash", confirm=u"Êtes-vous sûr de vouloir supprimer cet élément ?" )
def stream_actions(self, item): url = self.request.route_path( "/treasury_measure_grids/{id}", id=item.id ) return ( Link( url, u"Voir cet état", title=u"Voir le détail de cet état de trésorerie", icon=u"money", ), )
def get_breadcrumb(cls, request, is_leaf=False): """ Collect breadcrumb entries :param obj request: The Pyramid request :param bool is_leaf: Do we ask the leaf node :returns: A generator of 2-uples (title, url) """ if cls.parent_view is not None: for link in cls.parent_view.get_breadcrumb(request): yield link if getattr(cls, "tree_is_visible", None) is not None: visible = cls(request).tree_is_visible else: visible = True if not is_leaf: if visible: yield Link(cls.get_url(request), cls.get_title(request)) else: yield Link("", cls.get_title(request))
def more_template_vars(self, response_dict): """ Add template datas in the response dictionnary """ month_grids = response_dict['records'] logger.debug("MONTH : {}".format(month_grids.count())) types = self.get_types() year_turnover = self.context.get_turnover(self.year) grid = YearGlobalGrid(month_grids, types, year_turnover) grid.format_datas() response_dict['grid'] = grid response_dict['current_year'] = datetime.date.today().year response_dict['selected_year'] = int(self.year) response_dict['export_btns'] = [ Link( self.request.route_path( INCOME_STATEMENT_GRIDS_ROUTE_EXPORT, id=self.context.id, extension="ods", _query=self.request.GET, ), u"ODS", title=u"Exporter ces données au format Open Document", icon="fa fa-file-text-o", ), Link( self.request.route_path( INCOME_STATEMENT_GRIDS_ROUTE_EXPORT, id=self.context.id, extension="xls", _query=self.request.GET, ), u"Excel", title=u"Exporter ces données au format Xls", icon="fa fa-file-excel-o", ) ] return response_dict
def _stream_invoice_actions(self, item): """ Stream actions available for invoices :param obj request: The Pyramid request object :param obj item: The Invoice or CancelInvoice instance """ for i in self._stream_main_actions(item): yield i yield Link( self._get_item_url(item, subpath=".html", _anchor="payment"), u"Voir les encaissements", icon="money", ) if self.request.has_permission('add_payment.invoice', item): yield Link( self._get_item_url(item, subpath="/addpayment"), u"Enregistrer un encaissement", icon='money', popup=True, )
def get_actions(self, items): """ Return the description of additionnal main actions buttons :rtype: list """ yield Link( self.get_addurl() + "?is_total=1", u"Ajouter un total", title=u"Ajouter un indicateur de type total qui sera mis en " u"évidence dans l'interface", icon=u"plus-circle", css=u"btn btn-default secondary-action", )
def stream_actions(self, item): """ Stream actions on TemplatingHistory instances :param obj item: A TemplatingHistory instance :returns: A generator producing Link instances """ yield Link( self.request.route_path("/templatinghistory/{id}", id=item.id, _query={'action': 'delete'}), u"Supprimer", icon="fa fa-trash", )
def get_actions(self, items): """ Return the description of additionnal main actions buttons :rtype: generator """ current_year = datetime.date.today().year year = _get_year_from_request(self.request) # if we've got datas and we're not in the last year if items.count() > 0 and year != current_year + 1: yield Link(self._get_duplicate_url(), label=u"Dupliquer cette grille vers l'année suivante " u"(%s)" % (year + 1), icon=u"fa fa-copy", css=u"btn btn-default") # If previous year there were some datas configured if self.load_items(year - 1).count() > 0: yield Link(self._get_duplicate_from_previous_url(), label=u"Recopier la grille de l'année précédente " u"(%s)" % (year - 1), icon=u"fa fa-copy", css=u"btn btn-default")
def stream_actions(self, expense_type): """ Stream the actions available for the given expense_type object :param obj expense_type: ExpenseType instance :returns: List of 4-uples (url, label, title, icon,) """ yield Link( self._get_item_url(expense_type), u"Voir/Modifier", icon=u"pencil", ) if expense_type.active: yield Link( self._get_item_url(expense_type, action='disable'), u"Désactiver", title=u"La TVA n'apparaitra plus dans l'interface", icon=u"remove", ) else: yield Link( self._get_item_url(expense_type, action='disable'), u"Activer", title=u"La TVA apparaitra dans l'interface", )
def stream_actions(self, project): """ Stream actions available for the given project :param obj project: A Project instance :rtype: generator """ yield Link( self._get_item_url(project), u"Voir/Modifier", icon=u"pencil", ) if self.request.has_permission('add_estimation', project): yield Link( self.request.route_path( PROJECT_ITEM_ESTIMATION_ROUTE, id=project.id, _query={'action': 'add'}, ), u"Nouveau devis", icon=u"file", ) if self.request.has_permission('add_invoice', project): yield Link( self.request.route_path( PROJECT_ITEM_INVOICE_ROUTE, id=project.id, _query={'action': 'add'}, ), u"Nouvelle facture", icon=u"file", ) if self.request.has_permission('edit_project', project): if project.archived: yield Link( self._get_item_url(project, action='archive'), u"Désarchiver le projet", icon=u"book", ) else: yield Link( self._get_item_url(project, action='archive'), u"Archiver le projet", icon=u"book", ) if self.request.has_permission('delete_project', project): yield Link( self._get_item_url(project, action='delete'), u"Supprimer", icon=u"trash", confirm=u'Êtes-vous sûr de vouloir supprimer ce projet ?')
def stream_actions(self, category): """ Stream the actions available for the given category object :param obj catgegory: IncomeStatementMeasureTypeCategory instance :returns: List of 4-uples (url, label, title, icon,) """ if category.active: yield Link( self._get_item_url(category), u"Voir/Modifier", icon=u"pencil", ) move_url = self._get_item_url(category, action="move") if category.order > 0: yield Link(move_url + "&direction=up", u"Remonter", title=u"Remonter dans l'ordre des catégories", icon=u"arrow-circle-o-up") if category.order < self.max_order: yield Link(move_url + "&direction=down", u"Redescendre", title=u"Redescendre dans l'ordre des catégories", icon=u"arrow-circle-o-down") yield Link( self._get_item_url(category, action='disable'), u"Désactiver", title=u"Les informations associés aux indicateur de cette " u"catégorie ne seront plus affichées", icon=u"remove", ) else: yield Link( self._get_item_url(category, action='disable'), u"Activer", title=u"Les informations générés depuis les indicateurs de " u"cette catégorie seront affichées", icon=u"check-square-o", ) yield Link( self._get_item_url(category, action='delete'), u"Supprimer", title=u"Supprimer cet indicateurs et les entrées associées", icon=u"trash", confirm=u"Êtes-vous sûr de vouloir supprimer " u"cet élément ? Tous les éléments dans les comptes de résultat " u"ayant été générés depuis des indicateurs seront également " u"supprimés.", )
def _trainer_datas_links(self): result = [] for user in self.context.employees: if not self.request.has_permission('edit.trainerdatas', user): # Je ne peux pas éditer les infos formateurs de mes collègues continue if user.id == self.request.user.id: label = u"Voir ma fiche formateur" else: label = u"Voir la fiche formateur de {}".format( format_account(user)) result.append( Link( self.request.route_path(USER_TRAINER_EDIT_URL, id=user.id), label, icon="fa fa-search", popup=True, css='btn btn-default', )) return result
def stream_actions(self, item): yield Link( self._get_item_url(item), u"Voir/Modifier", icon=u"pencil", ) move_url = self._get_item_url(item, action="move") if item.active: if item.order > 0: yield Link( move_url + "&direction=up", u"Remonter", title=u"Remonter dans l'ordre des mentions", icon=u"arrow-circle-o-up" ) if item.order < self.max_order: yield Link( move_url + "&direction=down", u"Redescendre", title=u"Redescendre dans l'ordre des mentions", icon=u"arrow-circle-o-down" ) yield Link( self._get_item_url(item, action='disable'), u"Désactiver", title=u"Cette mention ne sera plus insérée dans les documents", icon=u"remove", ) else: yield Link( self._get_item_url(item, action='disable'), u"Activer", title=u"Cette mention sera insérée dans les documents", icon=u"check-square-o", ) if not item.is_used: yield Link( self._get_item_url(item, action='delete'), u"Supprimer", icon=u"remove", )
def _stream_main_actions(self, item): """ Yield common actions """ yield Link( self._get_item_url(item, subpath=".pdf"), u"PDF", icon='file-pdf-o', popup=True, ) yield Link( self._get_item_url(item), u"Voir le document", icon='pencil', ) if self.request.has_permission('add.file', item): yield Link( self._get_item_url(item, subpath="/addfile"), u"Ajouter un fichier", icon='file-text', popup=True, ) if self.is_admin_view: yield Link( self.request.route_path("company", id=item.company_id), u"Voir l'enseigne %s" % item.company.name, icon="user", ) yield Link( self.request.route_path("customer", id=item.customer_id), u"Voir le client %s" % item.customer.label, icon="building-o", ) if self.request.has_permission('delete.%s' % item.type_, item): yield Link( self._get_item_url(item, subpath="/delete"), u"Supprimer", icon='trash', confirm=u"Êtes-vous sûr de vouloir supprimer ce document ?")
def populate_actionmenu(self): return Link(self.back_url(), self.get_label())
def stream_actions(self, item): yield Link( self._get_item_url(item), u"Voir/Modifier", icon=u"pencil", )