def get_context(self, category_name, diagnosis_previous_choices):
        category_name = category_name.replace("-", " ").capitalize()

        # force english as knowledge base languages are in english
        with override_locale("en"):
            category, name, desc = category_option_from_name(category_name)

            if category is None:
                abort(404)

            name = unicode(name)

            category_name = ORGANISATION_CATEGORY_MAPPING.get(name, name)
        trans_category_name = next(c[1] for c in CATEGORIES
                                   if c[0] == category)

        ineligible_reasons = session.stored.get("ineligible_reasons", [])

        organisations = get_organisation_list(
            article_category__name=category_name)

        params = {
            "organisations": organisations,
            "category": category,
            "category_name": trans_category_name,
            "ELIGIBILITY_REASONS": ELIGIBILITY_REASONS,
            "ineligible_reasons": ineligible_reasons,
            "truncate": 5,
        }
        params.update(
            get_cait_params(category_name,
                            organisations,
                            diagnosis_previous_choices,
                            truncate=params["truncate"]))
        return params
 def category_slug(self):
     # force english translation for slug
     cat_name = self.category_name
     if cat_name:
         with override_locale("en"):
             slug = cat_name.lower().replace(" ", "-")
         return slug
Ejemplo n.º 3
0
    def get_context(self, category_name, diagnosis_previous_choices):
        category_name = category_name.replace("-", " ").capitalize()

        # force english as knowledge base languages are in english
        with override_locale("en"):
            category, name, desc = category_option_from_name(category_name)

            if category is None:
                abort(404)

            name = unicode(name)

            category_name = ORGANISATION_CATEGORY_MAPPING.get(name, name)
        trans_category_name = next(c[1] for c in CATEGORIES if c[0] == category)

        ineligible_reasons = session.stored.get("ineligible_reasons", [])

        organisations = get_organisation_list(article_category__name=category_name)

        params = {
            "organisations": organisations,
            "category": category,
            "category_name": trans_category_name,
            "ELIGIBILITY_REASONS": ELIGIBILITY_REASONS,
            "ineligible_reasons": ineligible_reasons,
            "truncate": 5,
        }
        params.update(
            get_cait_params(category_name, organisations, diagnosis_previous_choices, truncate=params["truncate"])
        )
        return params
Ejemplo n.º 4
0
 def get_category(self, response_json):
     category = response_json["category"]
     if not category:
         category_name = response_json["nodes"][0]["key"]
         with override_locale("en"):
             category, name, desc = category_option_from_name(category_name)
     return category
Ejemplo n.º 5
0
 def category_slug(self):
     # force english translation for slug
     cat_name = self.category_name
     if cat_name:
         with override_locale("en"):
             slug = cat_name.lower().replace(" ", "-")
         return slug
Ejemplo n.º 6
0
 def get_category(self, response_json):
     category = response_json["category"]
     if not category:
         category_name = Markup(
             response_json["nodes"][0]["label"]).striptags()
         with override_locale("en"):
             category, name, desc = category_option_from_name(category_name)
     return category
Ejemplo n.º 7
0
def interstitial():
    """
    Interstitial page after passing scope test
    """
    if not session or not session.is_current or not session.checker.category:
        return redirect(url_for("base.session_expired"))

    category = session.checker.category
    category_name = session.checker.category_name
    with override_locale("en"):
        category_name_english = unicode(session.checker.category_name)

    organisations = get_organisation_list(article_category__name=category_name_english)
    show_laalaa = category in ["family", "housing"]

    context = {
        "category": category,
        "category_name": category_name,
        "organisations": organisations,
        "show_laalaa": show_laalaa,
    }
    return render_template("interstitial.html", **context)
def interstitial():
    """
    Interstitial page after passing scope test
    """
    if not session or not session.is_current or not session.checker.category:
        return redirect(url_for("base.session_expired"))

    category = CATEGORY_ID_MAPPING.get(session.checker.category,
                                       session.checker.category)
    category_name = session.checker.category_name
    with override_locale("en"):
        category_name_english = unicode(session.checker.category_name)

    organisations = get_organisation_list(
        article_category__name=category_name_english)

    context = {
        "category": category,
        "category_name": category_name,
        "organisations": organisations
    }
    return render_template("interstitial.html", **context)
Ejemplo n.º 9
0
def interstitial():
    """
    Interstitial page after passing scope test
    """
    if not session or not session.is_current or not session.checker.category:
        return redirect(url_for("base.session_expired"))

    category = session.checker.category
    category_name = session.checker.category_name
    with override_locale("en"):
        category_name_english = unicode(session.checker.category_name)

    organisations = get_organisation_list(
        article_category__name=category_name_english)
    show_laalaa = category in ["family", "housing"]

    context = {
        "category": category,
        "category_name": category_name,
        "organisations": organisations,
        "show_laalaa": show_laalaa,
    }
    return render_template("interstitial.html", **context)