Ejemplo n.º 1
0
    def get_context(self):
        context = build_question_context(self.rendered_block, self.form)
        context["return_to_hub_url"] = self.get_return_to_hub_url()
        context[
            "last_viewed_question_guidance"] = self.get_last_viewed_question_guidance_context(
            )

        if "list_summary" in self.rendered_block:
            list_context = ListContext(
                self._language,
                self._schema,
                self._questionnaire_store.answer_store,
                self._questionnaire_store.list_store,
                self._questionnaire_store.progress_store,
                self._questionnaire_store.metadata,
            )

            context.update(
                list_context(
                    self.rendered_block["list_summary"]["summary"],
                    self.rendered_block["list_summary"]["for_list"],
                ))

        if self.form.errors or self.form.question_errors:
            self.page_title = gettext("Error: {page_title}").format(
                page_title=self.page_title)

        return context
def build_feedback_context(question_schema, form):
    block = {"question": question_schema}
    context = build_question_context(block, form)
    context["hide_sign_out_button"] = False
    context["question"] = question_schema
    context["sign_out_url"] = url_for("session.get_sign_out")

    return context
Ejemplo n.º 3
0
    def build_list_collector_context(self, list_collector_block, form):
        question_context = build_question_context(list_collector_block, form)
        list_collector_context = {
            "list": {
                "list_items": self.build_list_items_summary_context(
                    list_collector_block
                ),
                "editable": True,
            }
        }

        return {**question_context, **list_collector_context}
Ejemplo n.º 4
0
    def get_context(self):
        context = build_question_context(self.rendered_block, self.form)
        context["return_to_hub_url"] = self.get_return_to_hub_url()
        context[
            "last_viewed_question_guidance"
        ] = self.get_last_viewed_question_guidance_context()

        if "list_summary" in self.rendered_block:
            context.update(self.get_list_summary_context())

        if self.form.errors or self.form.question_errors:
            self.page_title = gettext("Error: {page_title}").format(
                page_title=self.page_title
            )

        if self._schema.has_address_lookup_answer(self.rendered_block["question"]) and (
            address_lookup_api_auth_token := get_address_lookup_api_auth_token()
        ):
            context["address_lookup_api_auth_token"] = address_lookup_api_auth_token
Ejemplo n.º 5
0
    def get_context(self):
        context = build_question_context(self.rendered_block, self.form)
        context["return_to_hub_url"] = self.get_return_to_hub_url()
        context[
            "last_viewed_question_guidance"] = self.get_last_viewed_question_guidance_context(
            )

        if "list_summary" in self.rendered_block:
            context.update(self.get_list_summary_context())
        # pylint: disable=no-member
        # wtforms Form parents are not discoverable in the 2.3.3 implementation
        if self.form.errors or self.form.question_errors:
            self.page_title = gettext("Error: {page_title}").format(
                page_title=self.page_title)

        if self._schema.has_address_lookup_answer(
                self.rendered_block["question"]) and (
                    address_lookup_api_auth_token :=
                    get_address_lookup_api_auth_token()):
            context[
                "address_lookup_api_auth_token"] = address_lookup_api_auth_token
    def get_context(self):
        context = build_question_context(self.rendered_block, self.form)
        context["return_to_hub_url"] = self.get_return_to_hub_url()

        if "list_summary" in self.rendered_block:
            list_context = ListContext(
                self._language,
                self._schema,
                self._questionnaire_store.answer_store,
                self._questionnaire_store.list_store,
                self._questionnaire_store.progress_store,
                self._questionnaire_store.metadata,
            )

            context.update(
                list_context(
                    self.rendered_block["list_summary"]["summary"],
                    self.rendered_block["list_summary"]["for_list"],
                )
            )

        return context
Ejemplo n.º 7
0
    def get_context(self):
        question_context = build_question_context(self.rendered_block,
                                                  self.form)

        list_context = ListContext(
            self._language,
            self._schema,
            self._questionnaire_store.answer_store,
            self._questionnaire_store.list_store,
            self._questionnaire_store.progress_store,
            self._questionnaire_store.metadata,
        )

        return {
            **question_context,
            **list_context(
                self.rendered_block["summary"],
                for_list=self.rendered_block["for_list"],
                edit_block_id=self.rendered_block["edit_block"]["id"],
                remove_block_id=self.rendered_block["remove_block"]["id"],
            ),
        }
Ejemplo n.º 8
0
    def get_context(self):
        context = build_question_context(self.rendered_block, self.form)
        context["return_to_hub_url"] = self.get_return_to_hub_url()

        if "list_summary" in self.rendered_block:
            list_collector_context = ListCollectorContext(
                language=self._language,
                schema=self._schema,
                answer_store=self._questionnaire_store.answer_store,
                list_store=self._questionnaire_store.list_store,
                progress_store=self._questionnaire_store.progress_store,
                metadata=self._questionnaire_store.metadata,
            )

            context["list"] = {
                "list_items":
                list_collector_context.build_list_items_summary_context(
                    self.rendered_block["list_summary"]),
                "editable":
                False,
            }

        return context
 def get_context(self):
     return build_question_context(self.rendered_block, self.form)