Skip to content

Commit

Permalink
[REF] website, website_*: migrate from deprecated t-esc to t-out
Browse files Browse the repository at this point in the history
This commit updates all instances of the deprecated t-esc attribute
within the website and website_* modules to use the recommended t-out
attribute.

It also intentionally avoids modifying an XPath expression targeting a
t-esc attribute in crm_lead_views.xml of the website_crm_partner_assign
module. This exception is made to prevent potential breakage of the
inherited view within the CRM module.

See also : odoo/design-themes#804

task-3573251
  • Loading branch information
SergeBayet committed Jun 5, 2024
1 parent 4cc6ca1 commit e2b64ed
Show file tree
Hide file tree
Showing 88 changed files with 419 additions and 419 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
<div class="w-100 px-2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="d-flex align-items-center">
<i class="text-primary" t-if="state.selectedType">
<t t-esc="state.getSelectedType(state.selectedType).label"/>
<t t-out="state.getSelectedType(state.selectedType).label"/>
</i>
<i class="fa fa-angle-down ms-auto ps-2" role="img"/>
</a>
</div>
<div t-attf-class="dropdown-menu border-0 shadow-lg {{state.selectedType ? 'o_step_completed' : 'o_step_todo show'}}" role="menu">
<t t-foreach="state.getWebsiteTypes()" t-as="type" t-key="type.name">
<a t-att-title="type.name" t-on-click="() => this.selectWebsiteType(type.id)" class="dropdown-item o_change_website_type" role="menuitem">
<t t-esc="type.label"/>
<t t-out="type.label"/>
</a>
</t>
</div>
Expand All @@ -70,15 +70,15 @@
<div class="w-100 px-2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="d-flex align-items-center">
<t t-if="state.selectedPurpose">
<t t-esc="state.getSelectedPurpose(state.selectedPurpose).label"/>
<t t-out="state.getSelectedPurpose(state.selectedPurpose).label"/>
</t>
<i class="fa fa-angle-down ms-auto ps-2" role="img"/>
</a>
</div>
<div class="dropdown-menu border-0 shadow-lg" role="menu">
<t t-foreach="state.getWebsitePurpose()" t-as="type" t-key="type.name">
<a t-att-title="type.name" t-on-click="() => this.selectWebsitePurpose(type.id)" class="dropdown-item o_change_website_purpose">
<t t-esc="type.label"/>
<t t-out="type.label"/>
</a>
</t>
</div>
Expand Down Expand Up @@ -174,10 +174,10 @@
<div t-attf-class="h2 mb-2 card-title d-flex align-items-center {{isInstalled ? 'text-muted' : ''}}">
<i t-attf-class="me-2 fa {{feature.icon}} {{isInstalled ? 'text-muted' : (feature.type == 'page' ? 'text-info' : 'text-warning')}}"/>
<h3 class="m-1">
<t t-esc="feature.name"/>
<t t-out="feature.name"/>
</h3>
</div>
<p class="small card-text text-muted" t-esc="feature.description"/>
<p class="small card-text text-muted" t-out="feature.description"/>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<t t-foreach="state.websites" t-as="website" t-key="website.id">
<button class="btn btn-secondary js_website" t-att-class="{'active': website.selected}"
t-on-click="() => this.state.website = website.id">
<t t-esc="website.name"/>
<t t-out="website.name"/>
</button>
</t>
</div>
Expand Down
6 changes: 3 additions & 3 deletions addons/website/static/src/components/dialog/dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
title="props.title">
<t t-set-slot="default">
<t t-if="props.slots and props.slots.default" t-slot="default"/>
<t t-else="" t-esc="props.body"/>
<t t-else="" t-out="props.body"/>
</t>
<t t-if="props.showFooter" t-set-slot="footer">
<t t-if="props.slots and props.slots.footer" t-slot="footer"/>
<t t-else="">
<button class="btn btn-primary" t-on-click="protectedClick(props.primaryClick)" t-att-disabled="state.disabled">
<t t-esc="props.primaryTitle"/>
<t t-out="props.primaryTitle"/>
</button>
<button t-if="props.showSecondaryButton" class="btn btn-secondary" t-on-click="protectedClick(props.secondaryClick)" t-att-disabled="state.disabled">
<t t-esc="props.secondaryTitle"/>
<t t-out="props.secondaryTitle"/>
</button>
</t>
</t>
Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/components/dialog/edit_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<span class="input-group-text bg-view fa fa-bars" role="img" aria-label="Dropdown menu" title="Dropdown menu"/>
<span class="form-control d-flex align-items-center bg-view">
<span class="js_menu_label o_text_overflow flex-grow-1">
<t t-esc="props.menu.fields['name']"/>
<t t-out="props.menu.fields['name']"/>
</span>
<span t-if="props.menu.fields['is_mega_menu']" class="badge text-bg-primary">Mega Menu</span>
<i t-if="props.menu.is_homepage" class="fa fa-home ms-3" role="img" aria-label="Home" title="Home"/>
Expand Down
10 changes: 5 additions & 5 deletions addons/website/static/src/components/dialog/page_properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<t t-if="props.type === 'key'">
<div t-att-data-bs-template="depTemplate" data-bs-html="true" title="Dependencies" t-ref="action">
It looks like your file is being called by
<a href="#" t-on-click="showDependencies"><t t-esc="depText" /></a>.
<a href="#" t-on-click="showDependencies"><t t-out="depText" /></a>.
Changing its name will break these calls.
</div>
</t>
<t t-else="">
<div t-att-data-bs-template="depTemplate" data-bs-html="true" title="Dependencies" t-ref="action">
(could be used in <a href="#" t-on-click="showDependencies"><t t-esc="state.depText" /></a>)
(could be used in <a href="#" t-on-click="showDependencies"><t t-out="state.depText" /></a>)
</div>
</t>
</t>
Expand All @@ -41,8 +41,8 @@
t-attf-href="#collapseDependencies{{ dependency_index }}"
aria-expanded="false">
<i class="fa fa-caret-right me-1"/>
<t t-esc="dependency"/>:
<span class="text-muted"> <t t-esc="dependency_value.length"/> found(s)</span>
<t t-out="dependency"/>:
<span class="text-muted"> <t t-out="dependency_value.length"/> found(s)</span>
</a>
<div t-attf-id="collapseDependencies{{ dependency_index }}" class="collapse" aria-expanded="false">
<ul>
Expand All @@ -61,7 +61,7 @@

<t t-name="website.PageDependencies.Tooltip">
<t t-foreach="dependencies" t-as="dependency" t-key="dependency">
<b><t t-esc="dependency"/></b>
<b><t t-out="dependency"/></b>
<ul>
<li t-foreach="dependency_value" t-as="item" t-key="item_index">
<a t-att-href="item.link" t-att-title="item.record_name" class="o_text_overflow" target="_blank">
Expand Down
24 changes: 12 additions & 12 deletions addons/website/static/src/components/dialog/seo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<div class="card-header">Social Preview</div>
<img class="card-img-top o_meta_active_img" t-att-src="activeMetaImage"/>
<div class="card-body px-3 py-2">
<h6 class="text-primary card-title mb0"><t t-esc="title"/></h6>
<small class="card-subtitle text-muted"><t t-esc="props.url"/></small>
<p t-esc="description"/>
<h6 class="text-primary card-title mb0"><t t-out="title"/></h6>
<small class="card-subtitle text-muted"><t t-out="props.url"/></small>
<p t-out="description"/>
</div>
</div>
</div>
Expand All @@ -38,7 +38,7 @@

<t t-name="website.Keyword">
<tr>
<td t-esc="props.keyword"/>
<td t-out="props.keyword"/>
<td class="text-center"><i t-if="usedInH1" class="fa fa-check" t-att-title="props.keyword + ' is used in page first level heading'"/></td>
<td class="text-center"><i t-if="usedInH2" class="fa fa-check" t-att-title="props.keyword + ' is used in page second level heading'"/></td>
<td class="text-center"><i t-if="usedInTitle" class="fa fa-check" t-att-title="props.keyword + ' is used in page title'"/></td>
Expand All @@ -49,7 +49,7 @@
<span t-if="!state.suggestions.length">Loading...</span>
<t t-foreach="state.suggestions" t-as="suggestion" t-key="suggestion">
<li class="list-inline-item" t-on-click="() => props.addKeyword(suggestion)">
<span class="o_seo_suggestion badge text-bg-info" t-att-title="'Add ' + suggestion" t-esc="suggestion"/>
<span class="o_seo_suggestion badge text-bg-info" t-att-title="'Add ' + suggestion" t-out="suggestion"/>
</li>
</t>
</ul>
Expand All @@ -69,7 +69,7 @@
<select title="The language of the keyword and related keywords."
t-model="state.language" class="btn btn-outline-primary pe-5 form-select">
<t t-foreach="languages" t-as="lang" t-key="lang[0]">
<option t-att-value="lang[0]"><t t-esc="lang[2]"/></option>
<option t-att-value="lang[0]"><t t-out="lang[2]"/></option>
</t>
</select>
<button t-on-click="() => this.addKeyword(state.keyword)" t-att-disabled="isFull" class="btn btn-primary" type="button">Add</button>
Expand Down Expand Up @@ -101,10 +101,10 @@
<div class="oe_seo_preview_g">
<div class="rc">
<t t-if="props.isIndexed">
<div class="r"><t t-esc="props.title"/></div>
<div class="r"><t t-out="props.title"/></div>
<div class="s">
<div class="kv mb-1 text-muted"><t t-esc="props.url"/></div>
<div class="st text-black"><t t-esc="description"/></div>
<div class="kv mb-1 text-muted"><t t-out="props.url"/></div>
<div class="st text-black"><t t-out="description"/></div>
</div>
</t>
<t t-else="">
Expand Down Expand Up @@ -132,7 +132,7 @@
</label>
<textarea t-model="seoContext.description" t-att-disabled="!props.canEditDescription" name="website_meta_description" placeholder="Keep empty to use default value" class="form-control"/>
<div t-if="descriptionWarning.length" class="alert alert-warning mt16 mb0 small">
<span t-esc="descriptionWarning"/>
<span t-out="descriptionWarning"/>
</div>
</div>
<div class="mb-3" t-if='props.canEditUrl'>
Expand All @@ -141,12 +141,12 @@
</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text seo_name_pre" t-esc="seoNamePre"/>
<span class="input-group-text seo_name_pre" t-out="seoNamePre"/>
</div>
<input type="text" class="form-control" t-att-placeholder="props.seoNameDefault"
t-on-input="_updateInputValue" t-att-value="seoContext.seoName"/>
<div class="input-group-append" title="Unalterable unique identifier">
<span class="input-group-text seo_name_post" t-esc="seoNamePost"/>
<span class="input-group-text seo_name_post" t-out="seoNamePost"/>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions addons/website/static/src/components/fields/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

<t t-name="website.PageUrlField">
<t t-if="props.readonly">
<a class="o_form_uri o_text_overflow" t-att-href="props.record.data[props.name]" t-esc="props.record.data[props.name] || ''"/>
<a class="o_form_uri o_text_overflow" t-att-href="props.record.data[props.name]" t-out="props.record.data[props.name] || ''"/>
</t>
<t t-else="">
<div class="d-flex">
<div
class="input-group-text rounded-start text-lowercase border-0"
t-esc="serverUrl.length > 30 ? serverUrl.slice(0,14) + '..' + serverUrl.slice(-14) : serverUrl"
t-out="serverUrl.length > 30 ? serverUrl.slice(0,14) + '..' + serverUrl.slice(-14) : serverUrl"
/>
<input
class="o_input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<div class="o_stat_info">
<span class="o_stat_text o_hover"
t-att-class="props.record.data[props.name] ? 'text-danger' : 'text-success'"
t-esc="props.record.data[props.name] ? unpublish : publish"/>
t-out="props.record.data[props.name] ? unpublish : publish"/>
<span class="o_stat_text o_not_hover"
t-att-class="props.record.data[props.name] ? 'text-success' : 'text-danger'"
t-esc="props.record.data[props.name] ? published : unpublished"/>
t-out="props.record.data[props.name] ? published : unpublished"/>
</div>
</t>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<div class="o_resource_editor_title">
<div class="btn-group o_resource_editor_type_switcher">
<Dropdown>
<button class="btn btn-info"><t t-esc="types[state.type]"/></button>
<button class="btn btn-info"><t t-out="types[state.type]"/></button>
<t t-set-slot="content">
<t t-foreach="Object.keys(types)" t-as="type" t-key="type">
<DropdownItem onSelected="() => this.onFileTypeChange(type)">
<t t-esc="types[type]"/>
<t t-out="types[type]"/>
</DropdownItem>
</t>
</t>
Expand All @@ -35,7 +35,7 @@
<t t-set-slot="content">
<t t-foreach="Object.keys(xmlFilters)" t-as="filter" t-key="filter">
<CheckboxItem class="{ selected: state.xmlFilter === filter }" checked="state.xmlFilter === filter" onSelected="() => this.onFilterChange('xml', filter)">
<t t-esc="xmlFilters[filter]"/>
<t t-out="xmlFilters[filter]"/>
</CheckboxItem>
</t>
</t>
Expand All @@ -49,7 +49,7 @@
<t t-set-slot="content">
<t t-foreach="Object.keys(scssFilters)" t-as="filter" t-key="filter">
<CheckboxItem class="{ selected: state.scssFilter === filter }" checked="state.scssFilter === filter" onSelected="() => this.onFilterChange('scss', filter)">
<t t-esc="scssFilters[filter]"/>
<t t-out="scssFilters[filter]"/>
</CheckboxItem>
</t>
</t>
Expand All @@ -69,7 +69,7 @@
</button>
<button t-if="state.type === 'xml'" type="button" class="btn btn-sm btn-link" t-on-click="onFormat">Format</button>
</div>
<span class="o_resource_editor_resource_info" t-esc="resourceInfo"/>
<span class="o_resource_editor_resource_info" t-out="resourceInfo"/>
</div>
<div t-if="state.currentResource" id="resource-editor" t-ref="editor">
<CodeEditor
Expand All @@ -86,7 +86,7 @@

<t t-name="website.ResourceEditor.ResourceLabel">
<i t-if="resource.customized or resource.dirty" t-att-class="{ 'fa fa-floppy-o mr8': true, 'text-warning': resource.dirty, 'text-success': resource.customized }"/>
<t t-esc="label"/>
<t t-out="label"/>
</t>

</templates>
2 changes: 1 addition & 1 deletion addons/website/static/src/components/switch/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Switch extends Component {
<label t-att-class="'o_switch' + extraClasses">
<input type="checkbox" t-att-checked="props.value" t-att-disabled="props.disabled" t-on-change="(ev) => props.onChange(ev.target.checked)"/>
<span/>
<span t-if="props.label" t-esc="props.label" class="ms-2"/>
<span t-if="props.label" t-out="props.label" class="ms-2"/>
</label>
`;

Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/components/views/page_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<CheckboxItem class="{ o_menu_item: true, selected: state.activeWebsite.id === website.id }"
checked="state.activeWebsite.id === website.id"
closingMode="'none'"
t-esc="website.name"
t-out="website.name"
onSelected="() => this.onSelectWebsite(website)"
/>
<div t-if="!website.id" class="dropdown-divider"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="btn-group">
<Dropdown items="websiteNames">
<button class="btn btn-secondary">
<span t-esc="props.websites.selected"/>
<span t-out="props.websites.selected"/>
</button>
</Dropdown>
</div>
Expand Down
Loading

0 comments on commit e2b64ed

Please sign in to comment.