Пример #1
0
    def url(self, context=None):
        if self._url:
            return Action.url(self)

        endpoint = self.endpoint
        if endpoint:
            return endpoint
        else:
            return url_for("%s.index" % self.name)
Пример #2
0
    def url(self, context=None):
        if self._url:
            return Action.url(self)

        endpoint = self.endpoint
        if endpoint:
            return endpoint
        else:
            return url_for("%s.index" % self.name)
Пример #3
0
    def __init__(self, *args, **kwargs):
        if "permission" in kwargs:
            self.permission = kwargs.pop("permission")

        Action.__init__(self, *args, **kwargs)
Пример #4
0
    def __init__(self, *args, **kwargs):
        if 'permission' in kwargs:
            self.permission = kwargs.pop('permission')

        Action.__init__(self, *args, **kwargs)
Пример #5
0
# coding=utf-8

from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from jinja2 import Markup
from flask import Flask

from abilian.web.action import actions, Action, Glyphicon, StaticIcon
from abilian.testing import BaseTestCase

BASIC = Action('cat_1',
               'basic',
               'Basic Action',
               url='http://some.where',
               icon='ok')
CONDITIONAL = Action('cat_1',
                     'conditional',
                     'Conditional Action',
                     url='http://condition.al',
                     condition=lambda ctx: ctx['show_all'],
                     icon=Glyphicon('hand-right'),
                     button='warning')

OTHER_CAT = Action('cat_2:sub',
                   'other',
                   'Other Action',
                   url=lambda ctx: 'http://count?%d' % len(ctx),
                   icon=StaticIcon('icons/other.png', size=14),
                   css='custom-class')
Пример #6
0
from flask import Flask
from flask.ctx import AppContext, RequestContext
from jinja2 import Markup

from abilian.app import Application
from abilian.web.action import Action, Glyphicon, StaticIcon, actions

BASIC = Action("cat_1", "basic", "Basic Action", url="http://some.where", icon="ok")
CONDITIONAL = Action(
    "cat_1",
    "conditional",
    "Conditional Action",
    url="http://condition.al",
    condition=lambda ctx: ctx["show_all"],
    icon=Glyphicon("hand-right"),
    button="warning",
)

OTHER_CAT = Action(
    "cat_2:sub",
    "other",
    "Other Action",
    url=lambda ctx: f"http://count?{len(ctx)}",
    icon=StaticIcon("icons/other.png", size=14),
    css="custom-class",
)

ALL_ACTIONS = (BASIC, CONDITIONAL, OTHER_CAT)


def setup_actions(app: Application) -> None:
Пример #7
0
    def __init__(self, *args, **kwargs):
        if "permission" in kwargs:
            self.permission = kwargs.pop("permission")

        Action.__init__(self, *args, **kwargs)