Ejemplo n.º 1
0
def get_action_icon(action_id):
    """
    Returns icons for action ids
    """
    icon_list = (
        'cut', 'copy', 'paste', 'delete', 'rename', 'ical_import_enable',
        'ical_import_disable',)

    if action_id and action_id in icon_list:
        return get_icon(action_id)
    else:
        return get_icon('star')
Ejemplo n.º 2
0
 def icon(self, idx):
     return get_icon(idx)
Ejemplo n.º 3
0
 def get_icon(self, icon):
     return get_icon(icon)
Ejemplo n.º 4
0
    def test_get_icon(self):
        from collective.sidebar.utils import get_icon
        self.assertEqual(get_icon('_unknown_icon_'), 'glyphicon glyphicon-menu-right')  # noqa
        self.assertEqual(get_icon('cut'), 'glyphicon glyphicon-scissors')

        api.portal.set_registry_record(name='collective.sidebar.icon_font', value='Fontello')  # noqa
        self.assertEqual(get_icon('_unknown_icon_'), 'icon menu-right')
        self.assertEqual(get_icon('cut'), 'icon cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font', value='Font Awesome')  # noqa
        self.assertEqual(get_icon('_unknown_icon_'), 'fas fa-angle-right')
        self.assertEqual(get_icon('cut'), 'fas fa-cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font', value='Font Awesome Pro')  # noqa
        self.assertEqual(get_icon('_unknown_icon_'), 'far fa-angle-right')
        self.assertEqual(get_icon('cut'), 'far fa-cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font', value='Font Awesome Light')  # noqa
        self.assertEqual(get_icon('_unknown_icon_'), 'fal fa-angle-right')
        self.assertEqual(get_icon('cut'), 'fal fa-cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font', value='Font Awesome Duotone')  # noqa
        self.assertEqual(get_icon('_unknown_icon_'), 'fad fa-angle-right')
        self.assertEqual(get_icon('cut'), 'fad fa-cut')
Ejemplo n.º 5
0
    def test_get_icon(self):
        from collective.sidebar.utils import get_icon
        self.assertEqual(get_icon('__prefix__'), 'glyphicon')
        self.assertEqual(get_icon('_unknown_icon_'),
                         'glyphicon _unknown_icon_')  # noqa
        self.assertEqual(get_icon('cut'), 'glyphicon glyphicon-scissors')

        api.portal.set_registry_record(name='collective.sidebar.icon_font',
                                       value='Fontello')  # noqa
        self.assertEqual(get_icon('__prefix__'), 'icon')
        self.assertEqual(get_icon('_unknown_icon_'), 'icon _unknown_icon_')
        self.assertEqual(get_icon('cut'), 'icon cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font',
                                       value='Font Awesome')  # noqa
        self.assertEqual(get_icon('__prefix__'), 'fas')
        self.assertEqual(get_icon('_unknown_icon_'), 'fas _unknown_icon_')
        self.assertEqual(get_icon('cut'), 'fas fa-cut')
        self.assertEqual(get_icon('paste'), 'far fa-clipboard')

        api.portal.set_registry_record(name='collective.sidebar.icon_font',
                                       value='Font Awesome Pro')  # noqa
        self.assertEqual(get_icon('__prefix__'), 'far')
        self.assertEqual(get_icon('_unknown_icon_'), 'far _unknown_icon_')
        self.assertEqual(get_icon('cut'), 'far fa-cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font',
                                       value='Font Awesome Light')  # noqa
        self.assertEqual(get_icon('__prefix__'), 'fal')
        self.assertEqual(get_icon('_unknown_icon_'), 'fal _unknown_icon_')
        self.assertEqual(get_icon('cut'), 'fal fa-cut')

        api.portal.set_registry_record(name='collective.sidebar.icon_font',
                                       value='Font Awesome Duotone')  # noqa
        self.assertEqual(get_icon('__prefix__'), 'fad')
        self.assertEqual(get_icon('_unknown_icon_'), 'fad _unknown_icon_')
        self.assertEqual(get_icon('cut'), 'fad fa-cut')