def organisation_preview_email_branding(org_id):

    branding_style = request.args.get('branding_style', None)
    form = PreviewBranding(branding_style=branding_style)

    default_branding_is_french = None

    if form.branding_style.data == FieldWithLanguageOptions.ENGLISH_OPTION_VALUE:
        default_branding_is_french = False
    elif form.branding_style.data == FieldWithLanguageOptions.FRENCH_OPTION_VALUE:
        default_branding_is_french = True

    if form.validate_on_submit():
        if default_branding_is_french is not None:
            organisations_client.update_organisation(
                org_id,
                email_branding_id=None,
                default_branding_is_french=default_branding_is_french
            )
        else:
            organisations_client.update_organisation(
                org_id,
                email_branding_id=form.branding_style.data
            )
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/preview-email-branding.html',
        form=form,
        action=url_for('main.organisation_preview_email_branding', org_id=org_id),
    )
Exemple #2
0
def service_preview_email_branding(service_id):
    branding_style = request.args.get('branding_style', None)

    form = PreviewBranding(branding_style=branding_style)

    default_branding_is_french = None

    if form.branding_style.data == FieldWithLanguageOptions.ENGLISH_OPTION_VALUE:
        default_branding_is_french = False
    elif form.branding_style.data == FieldWithLanguageOptions.FRENCH_OPTION_VALUE:
        default_branding_is_french = True

    if form.validate_on_submit():
        if default_branding_is_french is not None:
            current_service.update(
                email_branding=None,
                default_branding_is_french=default_branding_is_french)
        else:
            current_service.update(email_branding=form.branding_style.data)
        return redirect(url_for('.service_settings', service_id=service_id))

    return render_template(
        'views/service-settings/preview-email-branding.html',
        form=form,
        service_id=service_id,
        action=url_for('main.service_preview_email_branding',
                       service_id=service_id),
    )
Exemple #3
0
def organisation_preview_letter_branding(org_id):
    branding_style = request.args.get("branding_style")

    form = PreviewBranding(branding_style=branding_style)

    if form.validate_on_submit():
        organisations_client.update_organisation(org_id, letter_branding_id=form.branding_style.data)
        return redirect(url_for(".organisation_settings", org_id=org_id))

    return render_template(
        "views/organisations/organisation/settings/preview-letter-branding.html",
        form=form,
        action=url_for("main.organisation_preview_letter_branding", org_id=org_id),
    )
def service_preview_letter_branding(service_id):
    branding_style = request.args.get('branding_style')

    form = PreviewBranding(branding_style=branding_style)

    if form.validate_on_submit():
        current_service.update(letter_branding=form.branding_style.data)
        return redirect(url_for('.service_settings', service_id=service_id))

    return render_template(
        'views/service-settings/preview-letter-branding.html',
        form=form,
        service_id=service_id,
        action=url_for('main.service_preview_letter_branding',
                       service_id=service_id),
    )
def organisation_preview_email_branding(org_id):

    branding_style = request.args.get('branding_style', None)

    form = PreviewBranding(branding_style=branding_style)

    if form.validate_on_submit():
        organisations_client.update_organisation(
            org_id, email_branding_id=form.branding_style.data)
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/preview-email-branding.html',
        form=form,
        action=url_for('main.organisation_preview_email_branding',
                       org_id=org_id),
    )
def organisation_preview_letter_branding(org_id):
    branding_style = request.args.get('branding_style')

    form = PreviewBranding(branding_style=branding_style)

    if form.validate_on_submit():
        current_organisation.update(
            letter_branding_id=form.branding_style.data,
            delete_services_cache=True,
        )
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/preview-letter-branding.html',
        form=form,
        action=url_for('main.organisation_preview_letter_branding', org_id=org_id),
    )