Skip to content

Commit

Permalink
[REF] test_website, *: migrate from deprecated t-esc to t-out
Browse files Browse the repository at this point in the history
*: website, website_*

This commit updates all instances of the deprecated t-esc attribute
within the web_unsplash and website modules to use the
recommended t-out attribute. The JavaScript side remains untouched.

See also : odoo/design-themes#804

task-3573251
  • Loading branch information
SergeBayet committed Aug 26, 2024
1 parent 9f516c4 commit c03ccb2
Show file tree
Hide file tree
Showing 66 changed files with 542 additions and 370 deletions.
4 changes: 2 additions & 2 deletions addons/test_website/data/test_website_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@

<!-- RECORDS FOR REDIRECT TESTS -->
<template id="test_redirect_view">
<t t-esc="country.name"/>
<t t-if="not request.env.user._is_public()" t-esc="'Logged In'"/>
<t t-out="country.name"/>
<t t-if="not request.env.user._is_public()" t-out="'Logged In'"/>
<!-- `href` is send through `url_for` for non editor users -->
<a href="/test_website/country/andorra-1">I am a link</a>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="oe_kanban_global_click d-flex flex-column">
<div class="row mb-auto">
<strong class="col-8">
<span class="o_text_overflow" t-esc="record.name.value"/>
<span class="o_text_overflow" t-out="record.name.value"/>
<div class="text-muted" t-if="record.website_id.value" groups="website.group_multi_website">
<i class="fa fa-globe me-1" title="Website"/>
<field name="website_id"/>
Expand Down
2 changes: 1 addition & 1 deletion addons/test_website/views/test_model_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="oe_kanban_global_click d-flex flex-column">
<div class="row mb-auto">
<strong class="col-8">
<span class="o_text_overflow" t-esc="record.name.value"/>
<span class="o_text_overflow" t-out="record.name.value"/>
</strong>
</div>
<div class="border-top mt-2 pt-2">
Expand Down
40 changes: 20 additions & 20 deletions addons/website/data/website_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@
<div class="col-8">
<h2>Badge</h2>
<t t-foreach="bs_theme_colors" t-as="color">
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></span>
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></span>
</t>
<h3 class="mt-2 h6">Link</h3>
<t t-foreach="bs_theme_colors" t-as="color">
<a href="#" t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></a>
<a href="#" t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></a>
</t>
<h3 class="mt-2 h6">Autosizing</h3>
<div class="h3">
<t t-foreach="bs_theme_colors" t-as="color">
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></span>
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></span>
</t>
</div>

<h2 class="mt-4">Button</h2>
<t t-foreach="bs_theme_colors" t-as="color">
<button type="button" t-attf-class="btn mb-1 btn-#{color[0]}"><t t-esc="color[1]"/></button>
<button type="button" t-attf-class="btn mb-1 btn-#{color[0]}"><t t-out="color[1]"/></button>
</t>
<h6 class="mt-2">Outline</h6>
<t t-foreach="bs_theme_colors" t-as="color">
<button type="button" t-attf-class="btn mb-1 btn-outline-#{color[0]}"><t t-esc="color[1]"/></button>
<button type="button" t-attf-class="btn mb-1 btn-outline-#{color[0]}"><t t-out="color[1]"/></button>
</t>
<h6 class="mt-2">Small</h6>
<t t-foreach="bs_theme_colors" t-as="color">
<button type="button" t-attf-class="btn mb-1 btn-sm btn-#{color[0]}"><t t-esc="color[1]"/></button>
<button type="button" t-attf-class="btn mb-1 btn-sm btn-#{color[0]}"><t t-out="color[1]"/></button>
</t>
<h6 class="mt-2">Large</h6>
<t t-foreach="bs_theme_colors" t-as="color">
<button type="button" t-attf-class="btn mb-1 btn-lg btn-#{color[0]}"><t t-esc="color[1]"/></button>
<button type="button" t-attf-class="btn mb-1 btn-lg btn-#{color[0]}"><t t-out="color[1]"/></button>
</t>
<h6 class="mt-2">Group</h6>
<div class="btn-group" role="group" aria-label="Basic example">
Expand Down Expand Up @@ -314,7 +314,7 @@
<div class="col-6">
<t t-foreach="bs_theme_colors" t-as="color">
<div t-attf-class="alert alert-#{color[0]}">
This is a "<t t-esc="color[1]"/>" alert with a <a href="#" class="alert-link">link</a>.
This is a "<t t-out="color[1]"/>" alert with a <a href="#" class="alert-link">link</a>.
</div>
</t>
</div>
Expand Down Expand Up @@ -363,42 +363,42 @@
<div class="row g-0">
<t t-foreach="odoo_theme_colors" t-as="color">
<div t-attf-class="col-auto bg-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
<div class="row g-0 mt-2">
<t t-foreach="bs_theme_colors" t-as="color">
<div t-attf-class="col-auto text-bg-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
<div class="row g-0 mt-2">
<t t-foreach="bs_gray_colors" t-as="color">
<div t-attf-class="col-auto bg-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
<div class="row g-0 mt-4">
<t t-foreach="odoo_theme_colors" t-as="color">
<div t-attf-class="col-auto text-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
<div class="row g-0 mt-2">
<t t-foreach="bs_theme_colors" t-as="color">
<div t-attf-class="col-auto text-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
<div class="row g-0 mt-2">
<t t-foreach="bs_gray_colors" t-as="color">
<div t-attf-class="col-auto text-#{color[0]}">
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
<div class="py-1 px-3"><t t-out="color[1]"/></div>
</div>
</t>
</div>
Expand Down Expand Up @@ -484,7 +484,7 @@
<div class="d-flex">
<span t-attf-class="border p-3 me-1 bg-o-color-#{i}"></span>
<div class="flex-grow-1 align-self-center">
<h5 class="m-0">o-color-<t t-esc="i"/></h5>
<h5 class="m-0">o-color-<t t-out="i"/></h5>
</div>
</div>
</td>
Expand All @@ -495,7 +495,7 @@
<div class="d-flex">
<span t-attf-class="border p-3 me-1 bg-#{i}"></span>
<div class="flex-grow-1 align-self-center">
<h5 class="m-0" t-esc="i"></h5>
<h5 class="m-0" t-out="i"></h5>
</div>
</div>
</td>
Expand All @@ -510,7 +510,7 @@
<div class="row">
<div class="col-7">
<h2>
Preset <t t-esc="i"/>
Preset <t t-out="i"/>
</h2>
<p>Paragraph text. Lorem <b>ipsum dolor sit amet</b>, consectetur adipiscing elit. <i>Integer posuere erat a ante</i>. <a href="#">Link text</a></p>
<p class="text-muted">Text muted. Lorem <b>ipsum dolor sit amet</b>, consectetur.</p>
Expand Down Expand Up @@ -540,7 +540,7 @@
<p class="card-text">Paragraph. <a href="#">text link</a></p>

<t t-foreach="['primary','secondary', 'info', 'warning', 'danger', 'success']" t-as="btn">
<a href="#" t-attf-class="mb-2 btn-sm btn btn-#{btn}" t-esc="'btn-' + btn"/>
<a href="#" t-attf-class="mb-2 btn-sm btn btn-#{btn}" t-out="'btn-' + btn"/>
</t>
</div>
</div>
Expand Down Expand Up @@ -569,8 +569,8 @@
</div>
<div class="col-5 border-start">
<div t-foreach="['info', 'warning', 'danger', 'success']" t-as="btn">
<a href="#" t-attf-class="mb-2 btn-block btn btn-#{btn}" t-esc="'btn-' + btn"/>
<a href="#" t-attf-class="mb-3 btn-block btn btn-outline-#{btn}" t-esc="'btn-outline-' + btn"/>
<a href="#" t-attf-class="mb-2 btn-block btn btn-#{btn}" t-out="'btn-' + btn"/>
<a href="#" t-attf-class="mb-3 btn-block btn btn-outline-#{btn}" t-out="'btn-outline-' + btn"/>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/snippets/s_searchbar/000.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class="o_dropdown_menu show position-absolute w-100">
<t t-if="fuzzySearch and results.length">
<span class="dropdown-item-text">
<span class="text-muted">No results found for '<t t-esc="search"/>'. Showing results for '<a href="#" class="s_searchbar_fuzzy_submit" t-esc="fuzzySearch"/>'.</span>
<span class="text-muted">No results found for '<t t-out="search"/>'. Showing results for '<a href="#" class="s_searchbar_fuzzy_submit" t-out="fuzzySearch"/>'.</span>
</span>
</t>
<t t-elif="!results.length">
Expand Down
8 changes: 4 additions & 4 deletions addons/website/static/src/xml/website.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<div class="modal-dialog">
<div class="modal-content">
<header class="modal-header" t-if="window_title">
<h3 class="modal-title"><t t-esc="window_title"/></h3>
<h3 class="modal-title"><t t-out="window_title"/></h3>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</header>
<main class="modal-body">
<form role="form" t-att-id="id">
<div class="row mb0">
<label for="page-name" class="col-md-3 col-form-label">
<t t-esc="field_name"/>
<t t-out="field_name"/>
</label>
<div class="col-md-9">
<input t-if="field_type == 'input'" type="text" class="form-control" required="required"/>
Expand All @@ -23,8 +23,8 @@
</form>
</main>
<footer class="modal-footer">
<button type="button" class="btn btn-primary btn-continue"><t t-esc="btn_primary_title"/></button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Cancel"><t t-esc="btn_secondary_title"/></button>
<button type="button" class="btn btn-primary btn-continue"><t t-out="btn_primary_title"/></button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Cancel"><t t-out="btn_secondary_title"/></button>
</footer>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/xml/website_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<t t-name="website.s_website_form_status_error">
<span id="s_website_form_result" class="me-2 small text-danger">
<i class="fa fa-close me-1" role="img" aria-hidden="true" title="Error"/>
<t t-esc="message"/>
<t t-out="message"/>
</span>
</t>

Expand Down
16 changes: 8 additions & 8 deletions addons/website/static/src/xml/website_form_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
</t>

<t t-name="website.form_label_content">
<span class="s_website_form_label_content" t-esc="field.string"/>
<span class="s_website_form_label_content" t-out="field.string"/>
<t t-if="field.required or field.modelRequired">
<span class="s_website_form_mark" t-if="field.formatInfo.requiredMark" t-esc="' ' + field.formatInfo.mark"/>
<span class="s_website_form_mark" t-if="field.formatInfo.requiredMark" t-out="' ' + field.formatInfo.mark"/>
</t>
<t t-else="">
<span class="s_website_form_mark" t-if="field.formatInfo.optionalMark" t-esc="' ' + field.formatInfo.mark"/>
<span class="s_website_form_mark" t-if="field.formatInfo.optionalMark" t-out="' ' + field.formatInfo.mark"/>
</t>
</t>

Expand All @@ -73,7 +73,7 @@
not make sense to try and change it over there anyway).
-->
<div t-if="default_description" class="s_website_form_field_description small form-text text-muted" contenteditable="true">
<t t-esc="default_description"/>
<t t-out="default_description"/>
</div>
</t>

Expand Down Expand Up @@ -131,7 +131,7 @@
t-att-placeholder="field.placeholder"
t-att-id="field.id"
t-att-rows="field.rows || 3"
t-esc="field.value"
t-out="field.value"
/>
</t>
</t>
Expand Down Expand Up @@ -266,7 +266,7 @@
t-att-required="field.required || field.modelRequired || None"
/>
<label class="form-check-label s_website_form_check_label" t-att-for="recordId">
<t t-esc="record.display_name"/>
<t t-out="record.display_name"/>
</label>
</div>
</div>
Expand All @@ -283,7 +283,7 @@
<t t-call="website.form_field">
<select class="form-select s_website_form_input" t-att-name="field.name" t-att-required="field.required || field.modelRequired || None" t-att-id="field.id">
<t t-foreach="field.records" t-as="record" t-key="record_index">
<option t-esc="record.display_name" t-att-id="field.id + record_index" t-att-value="record.id" t-att="{selected: record.selected and 'selected' or None}"/>
<option t-out="record.display_name" t-att-id="field.id + record_index" t-att-value="record.id" t-att="{selected: record.selected and 'selected' or None}"/>
</t>
</select>
</t>
Expand Down Expand Up @@ -335,7 +335,7 @@
t-att-required="field.required || field.modelRequired || None"
/>
<label class="form-check-label s_website_form_check_label" t-att-for="recordId">
<t t-esc="record.display_name"/>
<t t-out="record.display_name"/>
</label>
</div>
</div>
Expand Down
Loading

0 comments on commit c03ccb2

Please sign in to comment.