-
Notifications
You must be signed in to change notification settings - Fork 3.1k
19.0 tutorial owl joemo #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
djoewie
wants to merge
33
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorial-owl-joemo
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
19.0 tutorial owl joemo #1250
Changes from 7 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
220c8f5
[IMP] awesome_owl: add counter on page
djoewie ba0852d
[MOV] awesome_owl: move counter to own class
djoewie ac3da2c
[IMP] awesome_owl: add card
djoewie d201888
[IMP] awesome_owl: markup in display
djoewie bb195b5
[IMP] awesome_owl: add prop validation
djoewie e5cf19c
[IMP] awesome_owl: add total of counters
djoewie 0233cdf
[IMP] awesome_owl: add visualisation of a todolist
djoewie 43be439
[IMP] awesome_owl: mark completed items
djoewie 4ccb0fc
[IMP] awesome_owl: make adding todo's possible
djoewie b1703e6
[IMP] awesome_owl: autofocus input field
djoewie 3bfc874
[IMP] awesome_owl: toggeling todos
djoewie 752c640
[CLN] awesome_owl: follow naming convention
djoewie c517440
[IMP] awesome_owl: make deleting todoitems possible
djoewie 09e67bb
[IMP] awesome_owl: introduction to slots
djoewie 206c82e
[IMP] awesome_owl: add option to hide card content
djoewie 64a8839
[IMP] awesome_dashboard: a new layout
djoewie a758675
[IMP] awesome_dashboard: Add some buttons for quick navigation
djoewie 73580ef
[IMP] awesome_dashboard: add dashboard items
djoewie f8efc82
[IMP] awesome_dashboard: add statistics on dashboard
djoewie 949c551
[IMP] awesome_dashboard: caching the results
djoewie 2affcf3
[IMP] awesome_dashboard: add pie-chart
djoewie cf78101
[CLN] awesome_owl: code convention camelcase for refs
djoewie 286bd29
[CLN] awesome_dashboard: coding convention
djoewie 1f1e971
[FIX] awesome_dashboard: piechart need to be destroyed before creatin…
djoewie dc7faf0
[IMP] awesome_dashboard: real life update
djoewie f127f24
[IMP] awesome_dashboard: lazy loading of module
djoewie 416de43
[IMP] awesome_dashboard: make dashboard generic
djoewie 0ede26b
[CLN] awesome_dashboard: improve readability of pie_chart
djoewie 8b8558a
[IMP] awesome_dashboard: use a registry for the dashboard items
djoewie 6dfb3d4
[IMP] awesome_dashboard: make dashboard items hideable
djoewie 61531ba
[IMP] awesome_dashboard: add dutch translations
djoewie 0dc5636
[CLN] estate: add a webcontroller
djoewie 483de30
[MOV] estate: dashboard in its own file
djoewie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { Component } from "@odoo/owl"; | ||
|
|
||
| export class Card extends Component { | ||
| static template = "awesome_owl.card"; | ||
| static props = ['title', 'content'] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this line |
||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.card"> | ||
| <div class="card d-inline-block m-2" style="width: 18rem;"> | ||
| <div class="card-body"> | ||
| <h5 class="card-title"><t t-out="props.title"/></h5> | ||
| <p class="card-text"> | ||
| <t t-out="props.content"/> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Component, useState } from "@odoo/owl"; | ||
|
|
||
| export class Counter extends Component { | ||
| static template = "awesome_owl.counter"; | ||
| static props = { | ||
| "onChange": {type: Function, optional: true} | ||
| }; | ||
|
|
||
| setup() { | ||
| this.state = useState({value: 0}); | ||
| } | ||
|
|
||
| increment() { | ||
| this.state.value++; | ||
| if (this.props.onChange) { | ||
| this.props.onChange(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| <templates xml:space="preserve"> | ||||
|
|
||||
| <t t-name="awesome_owl.counter"> | ||||
| <div class="m-1 p-1 border d-inline-block"> | ||||
| <span class="me-1">Counter: <t t-esc="state.value"/></span> | ||||
| <button class="btn btn-primary active" t-on-click="increment" type="button">Increment</button> | ||||
| </div> | ||||
| </t> | ||||
|
|
||||
| </templates> | ||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| import { Component } from "@odoo/owl"; | ||
| import { Component, markup, useState } from "@odoo/owl"; | ||
| import { Counter } from "./counter/counter"; | ||
| import { Card } from "./card/card"; | ||
| import { TodoList } from "./todo/todo_list"; | ||
|
|
||
| export class Playground extends Component { | ||
| static template = "awesome_owl.playground"; | ||
| static components = {Counter, Card, TodoList}; | ||
|
|
||
| setup() { | ||
| this.content1 = "<div class='text-primary'>some content</div>"; | ||
| this.content2 = markup("<div class='text-primary'>some content</div>"); | ||
| this.state = useState({sum: 0}); | ||
| } | ||
|
|
||
| increment_total() { | ||
| this.state.sum++; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| import { Component } from "@odoo/owl"; | ||||||
|
|
||||||
| export class TodoItem extends Component { | ||||||
| static template = "awesome_owl.todo_item"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| static props = { | ||||||
| "todo": { | ||||||
| type: Object, | ||||||
| shape: { | ||||||
| id: Number, | ||||||
| description: String, | ||||||
| isCompleted: Boolean | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| } | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.todo_item"> | ||
| <div> | ||
| <t t-esc="props.todo.id"/>. | ||
| <t t-esc="props.todo.description"/> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { Component, useState } from "@odoo/owl"; | ||
| import { TodoItem } from "./todo_item"; | ||
|
|
||
| export class TodoList extends Component { | ||
| static template = "awesome_owl.todo_list"; | ||
| static components = {TodoItem}; | ||
|
|
||
| setup() { | ||
| this.todos = useState([{id: 3, description: "buy milk", isCompleted: false}]); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_owl.todo_list"> | ||
| <div class="border d-inline-block p-2 m-2" style="width: 18rem;"> | ||
| <t t-foreach="todos" t-as="todo" t-key="todo"> | ||
| <TodoItem todo="todo"/> | ||
| </t> | ||
| </div> | ||
| </t> | ||
|
|
||
| </templates> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name for the template is usually camel case