Ejemplo n.º 1
0
    def page_title(self):
        """Heading to display above the search results."""

        if IQuestionSet.providedBy(self.context):
            return _('Questions matching "${search_text}"',
                     mapping=dict(search_text=self.search_text))

        replacements = dict(context=self.context.displayname,
                            search_text=self.search_text)
        # Check if the set of selected status has a special title.
        status_set_title = self.status_title_map.get(
            frozenset(self.status_filter))
        if status_set_title:
            replacements['status'] = status_set_title
            if self.search_text:
                return _(
                    '${status} questions matching "${search_text}" '
                    'for ${context}',
                    mapping=replacements)
            else:
                return _('${status} questions for ${context}',
                         mapping=replacements)
        else:
            if self.search_text:
                return _(
                    'Questions matching "${search_text}" for '
                    '${context}',
                    mapping=replacements)
            else:
                return _('Questions for ${context}', mapping=replacements)
Ejemplo n.º 2
0
    def template(self):
        """The template to render the presentation.

        Subclasses can redefine this property to choose their own template.
        """
        if IQuestionSet.providedBy(self.context):
            return self.default_template
        involvement = getMultiAdapter((self.context, self.request), name="+get-involved")
        if service_uses_launchpad(involvement.answers_usage):
            # Primary contexts that officially use answers have a
            # search and listing presentation.
            return self.default_template
        else:
            # Primary context that do not officially use answers have an
            # an explanation about about the current state.
            return self.unknown_template
Ejemplo n.º 3
0
    def template(self):
        """The template to render the presentation.

        Subclasses can redefine this property to choose their own template.
        """
        if IQuestionSet.providedBy(self.context):
            return self.default_template
        involvement = getMultiAdapter((self.context, self.request),
                                      name='+get-involved')
        if service_uses_launchpad(involvement.answers_usage):
            # Primary contexts that officially use answers have a
            # search and listing presentation.
            return self.default_template
        else:
            # Primary context that do not officially use answers have an
            # an explanation about about the current state.
            return self.unknown_template
Ejemplo n.º 4
0
    def page_title(self):
        """Heading to display above the search results."""

        if IQuestionSet.providedBy(self.context):
            return _('Questions matching "${search_text}"', mapping=dict(search_text=self.search_text))

        replacements = dict(context=self.context.displayname, search_text=self.search_text)
        # Check if the set of selected status has a special title.
        status_set_title = self.status_title_map.get(frozenset(self.status_filter))
        if status_set_title:
            replacements["status"] = status_set_title
            if self.search_text:
                return _('${status} questions matching "${search_text}" ' "for ${context}", mapping=replacements)
            else:
                return _("${status} questions for ${context}", mapping=replacements)
        else:
            if self.search_text:
                return _('Questions matching "${search_text}" for ' "${context}", mapping=replacements)
            else:
                return _("Questions for ${context}", mapping=replacements)