Exemplo n.º 1
0
    def init_with_context(self, context):

        admin_site_name = get_admin_site_name(context)

        if 'django.contrib.sites' in settings.INSTALLED_APPS:
            from django.contrib.sites.models import Site
            site_name = Site.objects.get_current().name
            site_url = 'http://' + Site.objects.get_current().domain
        else:
            site_name = _('Site')
            site_url = '/'

        self.children += [
            items.MenuItem(
                title=site_name,
                url=site_url,
                icon='fa-bullseye',
                css_styles='font-size: 1.5em;',
            ),
            items.MenuItem(
                title=_('Dashboard'),
                icon='fa-tachometer',
                url=reverse('%s:index' % admin_site_name),
                description=_('Dashboard'),
            ),
            items.UserTools(
                css_styles='float: right;',
                is_user_allowed=lambda user: user.is_staff,
            ),
        ]
Exemplo n.º 2
0
 def init_with_context(self, context):
     self.children += [
         items.MenuItem(
             title=admin.site.site_header,
             url=None,
             icon='fa-gears',
             css_styles='font-size: 1.5em;',
         ),
         items.UserTools(
             css_styles='float: right;',
             is_user_allowed=lambda user: user.is_active and user.is_staff,
         ),
     ]
Exemplo n.º 3
0
    def init_with_context(self, context):

        admin_site_name = get_admin_site_name(context)

        if 'django.contrib.sites' in settings.INSTALLED_APPS:
            from django.contrib.sites.models import Site
            site_name = Site.objects.get_current().name
            site_url = 'http://' + Site.objects.get_current().domain
        else:
            site_name = _('Site')
            site_url = '/'

        self.children += [
            items.MenuItem(
                title=site_name,
                url=site_url,
                icon='fa-bullseye',
                css_styles='font-size: 1.5em;',
            ),
            items.MenuItem(
                title=_('Dashboard'),
                icon='fa-tachometer',
                url=reverse('%s:index' % admin_site_name),
                description=_('Dashboard'),
            ),
        ]

        if self.my_user_check(context.get('request').user):
            self.children += [
                items.AppList(
                    title=_('Applications'),
                    icon='fa-tasks',
                    exclude=('django.contrib.*', ),
                ),
                items.AppList(
                    title=_('Administration'),
                    icon='fa-cog',
                    models=('django.contrib.*', ),
                ),
                items.UserTools(css_styles='float: right;', ),
            ]

        self.children += [
            items.MenuItem(
                title=_('Color theme'),
                icon='fa-paint-brush',
                description=_('Change color theme'),
                css_styles='float: right;',
                children=[
                    items.MenuItem(
                        title='Blue',
                        url='javascript:change_color_theme("blue");',
                    ),
                    items.MenuItem(
                        title='Coffee',
                        url='javascript:change_color_theme("coffee");',
                    ),
                    items.MenuItem(
                        title='Default',
                        url='javascript:change_color_theme("default");',
                    ),
                    items.MenuItem(
                        title='Ectoplasm',
                        url='javascript:change_color_theme("ectoplasm");',
                    ),
                    items.MenuItem(
                        title='Light',
                        url='javascript:change_color_theme("light");',
                    ),
                    items.MenuItem(
                        title='Milo',
                        url='javascript:change_color_theme("milo");',
                    ),
                    items.MenuItem(
                        title='Milo Light',
                        url='javascript:change_color_theme("milo-light");',
                    ),
                    items.MenuItem(
                        title='Midnight',
                        url='javascript:change_color_theme("midnight");',
                    ),
                    items.MenuItem(
                        title='Ocean',
                        url='javascript:change_color_theme("ocean");',
                    ),
                    items.MenuItem(
                        title='Sunrise',
                        url='javascript:change_color_theme("sunrise");',
                    ),
                ]),
        ]