Ejemplo n.º 1
0
 class Meta:
     sortable = False
     actions = dict(
         a=Action(display_name='Foo',
                  attrs__href='/foo/',
                  include=lambda table, **_: table.rows is not rows),
         b=Action(display_name='Bar',
                  attrs__href='/bar/',
                  include=lambda table, **_: table.rows is rows),
         c=Action(display_name='Baz',
                  attrs__href='/bar/',
                  group='Other'),
         d=dict(display_name='Qux', attrs__href='/bar/', group='Other'),
         e=Action.icon('icon_foo',
                       display_name='Icon foo',
                       attrs__href='/icon_foo/'),
         f=Action.icon('icon_bar',
                       icon_classes=['lg'],
                       display_name='Icon bar',
                       attrs__href='/icon_bar/'),
         g=Action.icon('icon_baz',
                       icon_classes=['one', 'two'],
                       display_name='Icon baz',
                       attrs__href='/icon_baz/'),
     )
Ejemplo n.º 2
0
def test_render_icon():
    submit = Action.icon(
        icon='flower',
        display_name='Name',
    ).bind()
    assert_renders(submit, '''
       <a> <i class="fa fa-flower"> </i> Name </a>
    ''')
Ejemplo n.º 3
0
def test_icon_action_with_icon_classes():
    assert Action.icon('foo', display_name='dn', icon_classes=['a', 'b']).bind(request=None).__html__() == '<a><i class="fa fa-foo fa-a fa-b"></i> dn</a>'
Ejemplo n.º 4
0
def test_icon_action():
    assert Action.icon('foo', display_name='dn').bind(request=None).__html__() == '<a><i class="fa fa-foo"></i> dn</a>'