mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
web_help: Improve helpers
web_help: Improve helpers fix layout issue fix layout issue
This commit is contained in:
@@ -2,21 +2,24 @@
|
||||
import LegacyControlPanel from "web.ControlPanel";
|
||||
import {ControlPanel} from "@web/search/control_panel/control_panel";
|
||||
import {findTrip} from "@web_help/helpers.esm";
|
||||
import {Component, useState} from "@odoo/owl";
|
||||
import {Component, onWillStart, useState} from "@odoo/owl";
|
||||
import {ActionDialog} from "@web/webclient/actions/action_dialog";
|
||||
|
||||
export class HelpButton extends Component {
|
||||
setup() {
|
||||
const foundTrip = findTrip(this.props.resModel, this.props.viewType);
|
||||
this.state = useState({
|
||||
TripClass: foundTrip,
|
||||
TripClass: null,
|
||||
});
|
||||
onWillStart(async () => {
|
||||
const foundTrip = await findTrip(this.props.resModel, this.props.viewType);
|
||||
this.state.TripClass = foundTrip;
|
||||
});
|
||||
}
|
||||
|
||||
onClick() {
|
||||
async onClick() {
|
||||
const TripClass = this.state.TripClass;
|
||||
const trip = new TripClass(this.env);
|
||||
trip.setup();
|
||||
await trip.setup();
|
||||
trip.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,16 @@
|
||||
<t t-name="web_help.HelpButton" owl="1">
|
||||
<button
|
||||
class="btn ml-2 js_web_help_btn"
|
||||
t-att-class="props.btnClass || 'btn-secondary'"
|
||||
t-att-class="props.btnClass || 'btn-light'"
|
||||
t-on-click="onClick"
|
||||
tabindex="-1"
|
||||
t-if="state.TripClass"
|
||||
>
|
||||
<i class="fa fa-question" />
|
||||
</button>
|
||||
</t>
|
||||
<t t-inherit="web.ControlPanel.Regular" t-inherit-mode="extension">
|
||||
<xpath expr="//div[hasclass('o_cp_bottom')]" t-operation="inside">
|
||||
<xpath expr="//div[hasclass('o_cp_bottom_right')]" t-operation="inside">
|
||||
<nav class="btn-group">
|
||||
<HelpButton
|
||||
resModel="env.searchModel.resModel"
|
||||
@@ -21,7 +22,7 @@
|
||||
</xpath>
|
||||
</t>
|
||||
<t t-inherit="web.ControlPanel.Small" t-inherit-mode="extension">
|
||||
<xpath expr="//div[hasclass('o_cp_bottom')]" t-operation="inside">
|
||||
<xpath expr="//div[hasclass('o_cp_bottom_right')]" t-operation="inside">
|
||||
<nav class="btn-group">
|
||||
<HelpButton
|
||||
resModel="env.searchModel.resModel"
|
||||
|
||||
Reference in New Issue
Block a user