Files
web/web_help/static/src/components/help_button/help_button.esm.js
tarteo d6068076d7 [ADD] web_help
[FIX] web_help: Run pre-commit

[FIX] web_help: Run pre-commit

[FIX] web_help: Run pre-commit

[FIX] web_help: Run pre-commit

[IMP] Easy changeable template and buttons texts, more demo, fixed readme.

[IMP] Easy changeable template and buttons texts, more demo, fixed readme.

[IMP] Easy changeable template and buttons texts, more demo, fixed readme.

[FIX] Grammar
2023-02-28 13:31:54 +01:00

29 lines
903 B
JavaScript

/** @odoo-module **/
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 {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,
});
}
onClick() {
const TripClass = this.state.TripClass;
const trip = new TripClass(this.env);
trip.setup();
trip.start();
}
}
HelpButton.template = "web_help.HelpButton";
Object.assign(ControlPanel.components, {HelpButton});
Object.assign(LegacyControlPanel.components, {HelpButton});
Object.assign(ActionDialog.components, {HelpButton});