예제 #1
0
    def update(self):
        context = aq_inner(self.context)

        context_helper = getMultiAdapter((context, self.request),
                                         name="plone_context_state")

        portal_helper = getMultiAdapter((context, self.request),
                                        name="plone_portal_state")

        canonical = context_helper.canonical_object()

        parent = aq_parent(canonical)

        breadcrumbs_view = getView(self.context, self.request,
                                   'breadcrumbs_view')
        breadcrumbs = breadcrumbs_view.breadcrumbs()

        if (len(breadcrumbs) == 1):
            self.backTitle = _(u"Home")
        else:
            if hasattr(parent, "Title"):
                self.backTitle = parent.Title()
            else:
                self.backTitle = _(u"Back")

        if hasattr(parent, "absolute_url"):
            self.backUrl = parent.absolute_url()
        else:
            self.backUrl = portal_helper.portal_url()

        self.isHome = len(breadcrumbs) == 0
    def update(self):
        context = aq_inner(self.context)

        context_helper = getMultiAdapter((context, self.request), name="plone_context_state")

        portal_helper = getMultiAdapter((context, self.request), name="plone_portal_state")

        canonical = context_helper.canonical_object()

        parent = aq_parent(canonical)

        breadcrumbs_view = getView(self.context, self.request, "breadcrumbs_view")
        breadcrumbs = breadcrumbs_view.breadcrumbs()

        if len(breadcrumbs) == 1:
            self.backTitle = _(u"Home")
        else:
            if hasattr(parent, "Title"):
                self.backTitle = parent.Title()
            else:
                self.backTitle = _(u"Back")

        if hasattr(parent, "absolute_url"):
            self.backUrl = parent.absolute_url()
        else:
            self.backUrl = portal_helper.portal_url()

        self.isHome = len(breadcrumbs) == 0
예제 #3
0
    Override document actions. Document actions (like) print is directly
    called from many templates. Thus, it is likely this viewlet leaks
    to mobile code. We don't want print in mobile.

    This viewlet is registered in configure.zcml.
    """
    def update(self):
        pass

    def render(self):
        return u""


# Translatable strings used in theme JS.
js_i18n_strings = {
    'search_field_default_text': _(u"Search..."),
}


class JSTranslations(MobileViewletBase):
    """
    Used to pass translated strings to JS.
    """

    grok.name('gomobiletheme.basic.viewlets.JSTranslations')

    def update(self):
        pass

    def render(self):
        try:
    Override document actions. Document actions (like) print is directly
    called from many templates. Thus, it is likely this viewlet leaks
    to mobile code. We don't want print in mobile.

    This viewlet is registered in configure.zcml.
    """

    def update(self):
        pass

    def render(self):
        return u""


# Translatable strings used in theme JS.
js_i18n_strings = {"search_field_default_text": _(u"Search...")}


class JSTranslations(MobileViewletBase):
    """
    Used to pass translated strings to JS.
    """

    grok.name("gomobiletheme.basic.viewlets.JSTranslations")

    def update(self):
        pass

    def render(self):
        try:
            lang = self.request.get("LANGUAGE", "en")
예제 #5
0
    called from many templates. Thus, it is likely this viewlet leaks
    to mobile code. We don't want print in mobile.

    This viewlet is registered in configure.zcml.
    """

    def update(self):
        pass

    def render(self):
        return u""


# Translatable strings used in theme JS.
js_i18n_strings = {
    'search_field_default_text': _(u"Search..."),
}
    
class JSTranslations(MobileViewletBase):
    """
    Used to pass translated strings to JS.
    """
    
    grok.name('gomobiletheme.basic.viewlets.JSTranslations')
        
    def update(self):
        pass
    def render(self):
        try:
            lang = self.request.get('LANGUAGE', 'en')
        except AttributeError: