-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into task/update-config-for-unit-testing
- Loading branch information
Showing
21 changed files
with
192 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* This module enhances the template content text area with a switch to enable right-to-left text direction. | ||
*/ | ||
(function () { | ||
const checkbox = document.getElementById("text_direction_rtl"); | ||
const content = document.getElementById("template_content"); | ||
|
||
// update the dir attribute when checkbox is clicked | ||
if (checkbox) { | ||
checkbox.addEventListener("change", function () { | ||
content.dir = this.checked ? "rtl" : "ltr"; | ||
content.closest(".textbox-highlight-wrapper").dir = content.dir; | ||
}); | ||
|
||
// on page load, if the checkbox is checked, set the dir attribute | ||
if (checkbox.checked) { | ||
content.dir = "rtl"; | ||
} | ||
} | ||
})(); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% from "components/checkbox.html" import checkbox, checkbox_input %} | ||
{% from "components/textbox.html" import textbox %} | ||
|
||
{% macro template_content(content_field, checkbox_field) %} | ||
<!-- TODO: remove `use_styled_checkbox` and this if statement once we decide on the UI element to use here --> | ||
|
||
<fieldset class="contain-floats w-full" role="radiogroup"> | ||
<legend> | ||
<span>{{ _('Email message') }}</span> | ||
</legend> | ||
{% if config["FF_RTL"] %} | ||
<div class="p-2 bg-gray-300 flex items-center"> | ||
{{ checkbox_input(checkbox_field.id, checkbox_field.name, checkbox_field.data, class="h-8 w-8 mr-2", testid="template-rtl") }} | ||
<label class="pb-0 inline-block text-small" for="text_direction_rtl">{{ _('Display') }}<span class="sr-only"> {{ _('email content') }} </span> {{ _('right to left') }}</label> | ||
</div> | ||
{% endif %} | ||
|
||
{{ textbox(content_field, highlight_tags=True, width='w-full', rows=8, testid="template-content", label_class="sr-only" ) }} | ||
</fieldset> | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,19 +168,13 @@ def test_edit_email_template_cat_other_to_freshdesk( | |
"template_category_other": "hello", | ||
"reply_to_text": "[email protected]", | ||
"process_type": None, | ||
"text_direction_rtl": None, | ||
}, | ||
_follow_redirects=True, | ||
) | ||
|
||
mock_update_service_template.assert_called_with( | ||
fake_uuid, | ||
name, | ||
"sms", | ||
content, | ||
SERVICE_ONE_ID, | ||
None, | ||
None, | ||
DEFAULT_TEMPLATE_CATEGORY_LOW, | ||
fake_uuid, name, "sms", content, SERVICE_ONE_ID, None, None, DEFAULT_TEMPLATE_CATEGORY_LOW, False | ||
) | ||
assert mock_send_other_category_to_freshdesk.called is True | ||
mock_send_other_category_to_freshdesk.assert_called_once_with( | ||
|
@@ -1369,14 +1363,7 @@ def test_should_redirect_when_saving_a_template( | |
assert flash_banner == f"'{name}' template saved" | ||
# self, id_, name, type_, content, service_id, subject=None, process_type=None, template_category_id=None | ||
mock_update_service_template.assert_called_with( | ||
fake_uuid, | ||
name, | ||
"sms", | ||
content, | ||
SERVICE_ONE_ID, | ||
None, | ||
None, | ||
DEFAULT_TEMPLATE_CATEGORY_LOW, | ||
fake_uuid, name, "sms", content, SERVICE_ONE_ID, None, None, DEFAULT_TEMPLATE_CATEGORY_LOW, False | ||
) | ||
|
||
|
||
|
@@ -1416,6 +1403,7 @@ def test_should_edit_content_when_process_type_is_set_not_platform_admin( | |
None, | ||
process_type, | ||
TESTING_TEMPLATE_CATEGORY, | ||
False, | ||
) | ||
|
||
|
||
|
@@ -1773,6 +1761,7 @@ def test_should_redirect_when_saving_a_template_email( | |
subject, | ||
DEFAULT_PROCESS_TYPE, | ||
DEFAULT_TEMPLATE_CATEGORY_LOW, | ||
False, | ||
) | ||
|
||
|
||
|
@@ -1965,6 +1954,7 @@ def test_preview_should_update_and_redirect_on_save(client_request, mock_update_ | |
"process_type": DEFAULT_PROCESS_TYPE, | ||
"id": fake_uuid, | ||
"template_category_id": DEFAULT_TEMPLATE_CATEGORY_LOW, | ||
"text_direction_rtl": False, | ||
} | ||
mocker.patch( | ||
"app.main.views.templates.get_preview_data", | ||
|
@@ -1994,6 +1984,7 @@ def test_preview_should_update_and_redirect_on_save(client_request, mock_update_ | |
"test subject", | ||
DEFAULT_PROCESS_TYPE, | ||
DEFAULT_TEMPLATE_CATEGORY_LOW, | ||
False, | ||
) | ||
|
||
|
||
|
Oops, something went wrong.