Esempio n. 1
0
 def content_actions(self):
     return [
         Action(name=_('Overviews'),
                description=_('View overviews (login required).'),
                url=reverse('ddsc_management.overviews'),
                icon=''),
         Action(name=_('Admin'),
                description=_('Manage the database (login required).'),
                url=reverse('admin:index'),
                icon=''),
     ]
Esempio n. 2
0
 def content_actions(self):
     """Strip out the date range selector if we're not logged in."""
     actions = super(DefaultView, self).content_actions
     if not self.user_logged_in():
         # Strip out the date range selector.
         actions = [
             action for action in actions if action.klass not in
             ['popup-date-range', 'map-load-default-location']
         ]
     zoom_to_default = Action(
         name='',
         description=_('Zoom to default location'),
         url=reverse('lizard_map.map_location_load_default'),
         icon='icon-globe',
         klass='map-load-default-location')
     actions.insert(0, zoom_to_default)
     geolocation = Action(name='',
                          description=('Zoom to geo location'),
                          url="",
                          icon='icon-screenshot',
                          klass='geolocation-btn')
     actions.insert(0, geolocation)
     return actions
    def content_actions(self):
        """
        Add button for elevation profile
        """
        actions = super(ElevationProfile, self).content_actions
        activate_elevationprofile = Action(
            name='',
            description=_('Draw a line to select an elevation profile'),
            url="javascript:void(null)",
            icon='icon-bar-chart',
            klass='map-elevationprofile')
        actions.insert(0, activate_elevationprofile)

        return actions
Esempio n. 4
0
 def breadcrumbs(self):
     return [Action(name='Neerslagradar', url='/')]
Esempio n. 5
0
    def site_actions(self):
        """Return site actions.

        ``UI_SITE_ACTIONS`` are on the left, a login link (if
        ``UI_SHOW_LOGIN`` is True) on the right.

        """
        actions = copy(uisettings.SITE_ACTIONS)
        if uisettings.SHOW_LOGIN:
            query_string = urllib.urlencode({'next': self.request.path_info})
            if self.request.user.is_authenticated():
                # Name of the user. TODO: link to profile page.
                # The action is just text-with-an-icon right now.
                action = Action(icon='icon-user')
                action.name = self.request.user
                action.description = _('Your current username')
                actions.append(action)
                # Separate logout action.
                action = Action()
                if getattr(settings, 'SSO_ENABLED', False):
                    # point to the SSO logout page (which redirects
                    # to another server)
                    action.url = '%s?%s' % (reverse('logout'),
                                            query_string)
                else:
                    # fall back to the old (local) logout page
                    action.url = '%s?%s' % (reverse('lizard_ui.logout'),
                                            query_string)
                action.name = _('logout')
                action.description = _('Click here to logout')
                action.klass = 'ui-logout-link'
                actions.append(action)
            else:
                action = Action(icon='icon-user')
                if getattr(settings, 'SSO_ENABLED', False):
                    # point to the SSO login page (which redirects
                    # to another server)
                    action.url = '%s?%s' % (reverse('login'),
                                            query_string)
                else:
                    # fall back to the old (local) login form
                    action.url = '%s?%s' % (reverse('lizard_ui.login'),
                                            query_string)
                action.name = _('Login')
                action.description = _('Click here to login')
                if getattr(settings, 'SSO_ENABLED', False):
                    action.klass = 'ui-sso-login-link'
                else:
                    # fall back to the javascript login modal
                    action.klass = 'ui-login-link'
                actions.append(action)
        return actions
Esempio n. 6
0
    def site_actions(self):
        """Return site actions.

        ``UI_SITE_ACTIONS`` are on the left, a login link (if
        ``UI_SHOW_LOGIN`` is True) on the right.

        """
        actions = copy(uisettings.SITE_ACTIONS)

        if uisettings.SHOW_LANGUAGE_PICKER:
            languages = settings.LANGUAGES
            if len(languages) > 1:
                language_code = get_language()  # current language code
                language_name = _('Language')  # sort of default
                try:
                    language_name = dict(settings.LANGUAGES)[language_code.lower()]
                except KeyError:
                    for code, name in languages:
                        if language_code.lower().startswith(code):
                            language_name = name
                            break
                query_string = urllib.urlencode(
                    {'next': self.request.path_info})
                lang_action = Action(icon='icon-flag')
                lang_action.url = '%s?%s' % (
                    reverse('lizard_ui.change_language'), query_string)
                lang_action.name = language_name
                lang_action.description = _('Pick a language')
                lang_action.klass = 'ui-change-language-link'
                actions.append(lang_action)

        if uisettings.SHOW_LOGIN:
            query_string = urllib.urlencode({'next': self.request.path_info})
            if self.request.user.is_authenticated():
                # Name of the user. TODO: link to profile page.
                # The action is just text-with-an-icon right now.
                action = Action(icon='icon-user')
                action.name = self.request.user
                action.description = _('Your current username')
                actions.append(action)
                # Separate logout action.
                action = Action()
                if getattr(settings, 'SSO_ENABLED', False):
                    # point to the SSO logout page (which redirects
                    # to another server)
                    action.url = '%s?%s' % (reverse('logout'),
                                            query_string)
                else:
                    # fall back to the old (local) logout page
                    action.url = '%s?%s' % (reverse('lizard_ui.logout'),
                                            query_string)
                action.name = _('logout')
                action.description = _('Click here to logout')
                action.klass = 'ui-logout-link'
                actions.append(action)
            else:
                action = Action(icon='icon-user')
                if getattr(settings, 'SSO_ENABLED', False):
                    # point to the SSO login page (which redirects
                    # to another server)
                    action.url = '%s?%s' % (reverse('login'),
                                            query_string)
                else:
                    # fall back to the old (local) login form
                    action.url = '%s?%s' % (reverse('lizard_ui.login'),
                                            query_string)
                action.name = _('Login')
                action.description = _('Click here to login')
                if getattr(settings, 'SSO_ENABLED', False):
                    action.klass = 'ui-sso-login-link'
                else:
                    # fall back to the javascript login modal
                    action.klass = 'ui-login-link'
                actions.append(action)
        return actions
Esempio n. 7
0
    def site_actions(self):
        """Return site actions.

        ``UI_SITE_ACTIONS`` are on the left, a login link (if
        ``UI_SHOW_LOGIN`` is True) on the right.

        """
        actions = copy(uisettings.SITE_ACTIONS)
        if uisettings.SHOW_LOGIN:
            query_string = urllib.urlencode({'next': self.request.path_info})
            if self.request.user.is_authenticated():
                # Name of the user. TODO: link to profile page.
                # The action is just text-with-an-icon right now.
                action = Action(icon='icon-user')
                action.name = self.request.user
                action.description = _('Your current username')
                actions.append(action)
                # Separate logout action.
                action = Action()
                action.url = '%s?%s' % (reverse('lizard_ui.logout'),
                                        query_string)
                action.name = _('logout')
                action.description = _('Click here to logout')
                action.klass = 'ui-logout-link'
                actions.append(action)
            else:
                action = Action(icon='icon-user')
                action.url = '%s?%s' % (reverse('lizard_ui.login'),
                                        query_string)
                action.name = _('Login')
                action.description = _('Click here to login')
                action.klass = 'ui-login-link'
                actions.append(action)
        return actions
Esempio n. 8
0
# TODO: Put your real url here to configure Sentry.
# override me in localsettings
SENTRY_DSN = None

# override me in localsettings
UI_GAUGES_SITE_ID = ''

LIZARD_SITE = 'http://dijkdata.nl/'
MANAGEMENT_SITE = 'http://beheer.dijkdata.nl/'

UI_SITE_ACTIONS = [
    Action(
        name="Kaart",
        url=LIZARD_SITE + '#map',
        # description="",
        # icon="icon-info-sign",
        # klass="has_popover_south"
    ),
    Action(
        name="Grafieken",
        url=LIZARD_SITE + '#graphs',
    ),
    Action(
        name="Beheer",
        url=MANAGEMENT_SITE,
        # description="",
        # icon="icon-info-sign",
        # klass="has_popover_south"
    ),
]