add awesome owl module

This commit is contained in:
hoangvv 2025-02-13 10:22:31 +07:00
parent e87a143169
commit 73cb3bd36c
9 changed files with 104 additions and 4 deletions

3
awesome_owl/__init__.py Normal file
View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
{
'name': "Awesome Owl",
'summary': """
Starting module for "Discover the JS framework, chapter 1: Owl components"
""",
'description': """
Starting module for "Discover the JS framework, chapter 1: Owl components"
""",
'author': "Odoo",
'website': "https://www.odoo.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Tutorials',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'web'],
'application': True,
'installable': True,
'data': [
'views/templates.xml',
],
'assets': {
'awesome_owl.assets_playground': [
('include', 'web._assets_helpers'),
'web/static/src/scss/pre_variables.scss',
'web/static/lib/bootstrap/scss/_variables.scss',
'web/static/lib/bootstrap/scss/_maps.scss',
('include', 'web._assets_bootstrap'),
('include', 'web._assets_core'),
'web/static/src/libs/fontawesome/css/font-awesome.css',
'awesome_owl/static/src/**/*',
],
},
'license': 'AGPL-3'
}

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

View File

@ -0,0 +1,10 @@
from odoo import http
from odoo.http import request, route
class OwlPlayground(http.Controller):
@http.route(['/awesome_owl'], type='http', auth='public')
def show_playground(self):
"""
Renders the owl playground page
"""
return request.render('awesome_owl.playground')

View File

@ -0,0 +1,11 @@
import { whenReady } from "@odoo/owl";
import { mountComponent } from "@web/env";
import { Playground } from "./playground";
const config = {
dev: true,
name: "Owl Tutorial",
};
// Mount the Playground component when the document.body is ready
whenReady(() => mountComponent(Playground, document.body, config));

View File

@ -0,0 +1,7 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class Playground extends Component {
static template = "awesome_owl.playground";
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_owl.playground">
<div class="p-3">
hello world
</div>
</t>
</templates>

View File

@ -0,0 +1,15 @@
<odoo>
<data>
<template id="awesome_owl.playground" name="Awesome T-Shirt thank you">
<html>
<head>
<link type="image/x-icon" rel="shortcut icon" href="/web/static/img/favicon.ico"/>
<t t-call-assets="awesome_owl.assets_playground"/>
</head>
<body>
</body>
</html>
</template>
</data>
</odoo>

View File

@ -20,7 +20,8 @@
# any module necessary for this one to work correctly
'depends': ['base','theme_common'],
'application': True,
'installable': True,
# always loaded
'data': [
'security/ir.model.access.csv',
@ -29,9 +30,6 @@
'views/templates.xml',
],
'assets': {
'web.assets_backend': [
'web/static/src/xml/**/*',
],
'web.assets_common': [
'web/static/lib/bootstrap/**/*',
],
@ -54,4 +52,5 @@
'todo_app/static/src/todo_app/**/*',
],
},
'license': 'AGPL-3'
}