[REF] *: BS5: Migrate btn-block

Due to the removal of btn-block we need to change the display to grid

> Dropped .btn-block for utilities. Instead of using .btn-block on the
> .btn, wrap your buttons with .d-grid and a .gap-* utility to space
> them as needed

https://getbootstrap.com/docs/5.1/migration/#buttons

Task ID: 2766483

Part-of: odoo/odoo#95450
This commit is contained in:
Romeo Fragomeli
2022-07-07 13:30:23 +02:00
parent 3880a3a604
commit eee625bbb0
12 changed files with 24 additions and 29 deletions
@@ -66,10 +66,10 @@
<xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('o_download_pdf')]" position="before">
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/>
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider in ('none', 'transfer'))"/>
<div>
<div class="d-grid">
<a href="#" t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids or invoice.amount_paid &lt; invoice.amount_total)"
class="btn btn-primary btn-block mb-2" data-toggle="modal" data-target="#pay_with">
class="btn btn-primary mb-2" data-toggle="modal" data-target="#pay_with">
<i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
</a>
<div t-if="tx_ids and not pending_manual_txs and not invoice.amount_residual and invoice.payment_state not in ('paid', 'in_payment')" class="alert alert-info py-1 mb-2" >
@@ -50,8 +50,8 @@
</p>
<input type="hidden" name="redirect" t-att-value="redirect"/>
<input type="hidden" name="token" t-att-value="token"/>
<div class="text-center oe_login_buttons pt-3">
<button type="submit" class="btn btn-primary btn-block"> Sign up</button>
<div class="text-center oe_login_buttons d-grid pt-3">
<button type="submit" class="btn btn-primary"> Sign up</button>
<a t-attf-href="/web/login?{{ keep_query() }}" class="btn btn-link btn-sm" role="button">Already have an account?</a>
<div class="o_login_auth"/>
</div>
@@ -90,8 +90,8 @@
</p>
<input type="hidden" name="redirect" t-att-value="redirect"/>
<input type="hidden" name="token" t-att-value="token"/>
<div class="clearfix oe_login_buttons">
<button type="submit" class="btn btn-primary btn-block">Reset Password</button>
<div class="clearfix oe_login_buttons d-grid mt-3">
<button type="submit" class="btn btn-primary">Reset Password</button>
<div class="d-flex justify-content-between align-items-center small mt-2">
<a t-if="not token" t-attf-href="/web/login?{{ keep_query() }}">Back to Login</a>
<a t-if="invalid_token" href="/web/login">Back to Login</a>
+2 -2
View File
@@ -27,8 +27,8 @@
<input type="checkbox" name="remember" id="switch-remember" value="1"/>
<label for="switch-remember">Don't ask again on this device</label>
</div>
<div t-attf-class="clearfix oe_login_buttons text-center mb-1">
<button type="submit" class="btn btn-primary btn-block">
<div t-attf-class="clearfix oe_login_buttons text-center d-grid mb-1">
<button type="submit" class="btn btn-primary">
Login
</button>
</div>
@@ -52,8 +52,8 @@
</ul>
</div>
<div class="dropdown-divider m-0"/>
<div role="menuitem" class="o_schedule_activity dropdown-header p-0 text-center">
<button class="btn btn-secondary btn-block p-3">
<div role="menuitem" class="o_schedule_activity d-grid dropdown-header p-0 text-center">
<button class="btn btn-secondary p-3">
<i class="fa fa-plus fa-fw"></i><strong>Schedule an activity</strong>
</button>
</div>
+2 -2
View File
@@ -2,8 +2,8 @@
<templates>
<t t-extend="mail.systray.ActivityMenu.Previews">
<t t-jquery="t[t-foreach*='activities'][t-as*='activity']" t-operation="after">
<div class="o_note_show">
<a role="button" class="btn btn-block text-center">Add new note</a>
<div class="o_note_show d-grid">
<a role="button" class="btn text-center">Add new note</a>
</div>
<div class="o_note o_mail_preview d-none">
<div class="o_mail_preview_image o_mail_preview_app">
@@ -1187,7 +1187,7 @@ function _getMatchedCSSRules(node, cssRules) {
}
};
if (processedStyle.display === 'block' && !(node.classList && node.classList.contains('btn-block'))) {
if (processedStyle.display === 'block') {
delete processedStyle.display;
}
if (!processedStyle['box-sizing']) {
@@ -766,7 +766,7 @@ QUnit.module('convert_inline', {}, function () {
$styleSheet.remove();
});
QUnit.test('remove unsupported styles', async function (assert) {
assert.expect(10);
assert.expect(9);
const $styleSheet = $('<style type="text/css" title="test-stylesheet"/>');
document.head.appendChild($styleSheet[0])
@@ -804,7 +804,7 @@ QUnit.module('convert_inline', {}, function () {
"should have removed border initial");
styleSheet.deleteRule(0);
// display: block (except for .btn-block)
// display: block
styleSheet.insertRule(`
.test-block {
display: block;
@@ -815,11 +815,6 @@ QUnit.module('convert_inline', {}, function () {
assert.strictEqual($editable.html(),
`<div class="test-block" style="box-sizing:border-box;"></div>`,
"should have removed display block");
$editable = $(`<div>${`<div class="btn-block"></div>`}</div>`);
convertInline.classToStyle($editable, convertInline.getCSSRules($editable[0].ownerDocument));
assert.strictEqual($editable.html(),
`<div class="btn-block" style="box-sizing:border-box;width:100%;display:block;" width="100%"></div>`,
"should not have removed display block for .btn-block");
styleSheet.deleteRule(0);
// !important
@@ -54,8 +54,8 @@
<span class="o_wbooth_registration_error_message"/>
</div>
<div class="form-group">
<div class="col-sm-6 offset-sm-3 mt-5">
<button type="submit" class="btn btn-primary btn-block font-weight-bold o_wbooth_registration_confirm">
<div class="d-grid col-sm-6 offset-sm-3 mt-5">
<button type="submit" class="btn btn-primary font-weight-bold o_wbooth_registration_confirm">
Book my Booths
</button>
</div>
@@ -17,7 +17,7 @@
</div>
</div>
<div class="o_comparelist_button" style='display:none'>
<a role="button" class="btn btn-primary btn-block" href="#"><i class="fa fa-exchange mr-2"/>Compare</a>
<a role="button" class="btn btn-primary d-block" href="#"><i class="fa fa-exchange mr-2"/>Compare</a>
</div>
</span>
</span>
@@ -126,7 +126,7 @@
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<input name="product_id" t-att-value="product.id" type="hidden"
t-att-data-product-tracking-info="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))"/>
<a role="button" class="btn btn-primary btn-block a-submit" href="#"><i class="fa fa-shopping-cart mr-2"></i>Add to Cart</a>
<a role="button" class="btn btn-primary d-block a-submit" href="#"><i class="fa fa-shopping-cart mr-2"></i>Add to Cart</a>
</form>
</div>
</td>
@@ -121,7 +121,7 @@
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<input type="hidden" class="product_id" name="product_id" t-att-value="channel.product_id.id"/>
<a id="add_to_cart" role="button" href="#"
class="btn btn-primary btn-block js_check_product o_js_add_to_cart a-submit"
class="btn btn-primary d-block js_check_product o_js_add_to_cart a-submit"
data-animation-selector=".o_wslides_course_pict">
<i class="fa fa-shopping-cart"></i> Add to Cart
</a>
@@ -280,8 +280,8 @@
</tr>
</table>
<div class="mt-3 o_not_editable">
<button role="button" class="btn btn-link btn-block" title="Share Channel"
<div class="mt-3 d-grid o_not_editable">
<button role="button" class="btn btn-link" title="Share Channel"
aria-label="Share Channel"
data-toggle="modal" t-att-data-target="'#slideChannelShareModal_%s' % channel.id">
<i class="fa fa-share-square fa-fw"/> Share
@@ -292,9 +292,9 @@
</template>
<template id="course_join">
<div class="o_wslides_js_course_join flex-grow-1">
<div class="o_wslides_js_course_join flex-grow-1 d-grid">
<a t-if="not channel.is_member and channel.enroll == 'public'" role="button"
class="btn btn-primary btn-block o_wslides_js_course_join_link"
class="btn btn-primary o_wslides_js_course_join_link"
title="Start Course" aria-label="Start Course Channel"
t-att-href="'#'"
t-att-data-channel-id="channel.id"