Before this commit and since [1] when the website builder was moved from the "frontend" to the "backend" of Odoo in Odoo 16, the option to enable URL redirect when updating a page URL was "compressed": - The toggle/switch element has not enough room to be displayed entirely if there were too many dependencies - The toggle/switch label was split in multiple lines, words could even be split in 2. Step to reproduce: - Go to / in the website builder (so the / finds a lot of dependencies) - Open page property - Change the URL field, you see the redirect url field appear with the mentioned issues. Note: - In other languages, the switch label could be even longer, splitting the line makes even more sense - Removing a class is generally something to be avoided in stable, but this type of class should not be xpath'd anyway. And given the template structure, it's unlikely someone would have xpath it as it's easy to xpath any element without relying on classes. One solution would have been to add a new class to cancel the first one but it seems overkill in this case. [1]: https://github.com/odoo/odoo/commit/2ef7e788263b4742a8e0788f47673b7b31da3726 closes odoo/odoo#146244 X-original-commit: 8c17c487e6632192874133a2ce4265a0f1eaf6fb Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com> Signed-off-by: Romain Derie (rde) <rde@odoo.com>
56 lines
2.2 KiB
XML
56 lines
2.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<templates>
|
|
|
|
<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] || ''"/>
|
|
</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"
|
|
/>
|
|
<input
|
|
class="o_input"
|
|
type="text"
|
|
t-att-placeholder="props.placeholder"
|
|
t-att-required="props.required"
|
|
t-att-id="props.id"
|
|
t-model="state.url"
|
|
t-ref="input"
|
|
/>
|
|
</div>
|
|
<div t-if="enableRedirect">
|
|
<div class="mt-4">
|
|
<Switch
|
|
extraClasses="'me-auto'"
|
|
label="'Redirect Old URL'"
|
|
value="state.redirect_old_url"
|
|
onChange="(value) => this.onChangeRedirectOldUrl(value)"
|
|
/>
|
|
<PageDependencies resIds="[props.record.resId]" resModel="'website.page'" mode="'popover'"/>
|
|
</div>
|
|
<div t-if="state.redirect_old_url" class="d-flex mt-4">
|
|
<label class="my-0 me-4 fw-bold" for="redirect_type">Type</label>
|
|
<select class="o_input w-50" id="redirect_type" t-model="state.redirect_type" t-on-change="updateValues">
|
|
<option value="301">301 Moved permanently</option>
|
|
<option value="302">302 Moved temporarily</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
|
|
<t t-name="website.FieldImageRadio">
|
|
<div class="d-flex">
|
|
<t t-foreach="values" t-as="option" t-key="option">
|
|
<div class="flex-fill text-center">
|
|
<img t-attf-class="o_image_radio_option w-50 {{option[0] === props.record.data[props.name] ? 'active' : ''}}" t-att-src="option[2]" t-on-click="() => this.onSelectValue(option[0])"/>
|
|
</div>
|
|
</t>
|
|
</div>
|
|
</t>
|
|
|
|
</templates>
|