-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] figure: unify chart and image menus
Before this commit, the chart and image menus were handled separately in `figure_chart.ts` and `figure_image.ts`. This led to a lot of duplicated code since they both do 80% the same thing. Now the figure menu is handled in `figure.ts`, and a `menuRegistryBuilder` was added to `figureRegistry`. Odoo task 3199007 closes #2091 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
- Loading branch information
1 parent
cd919f0
commit c8dd315
Showing
10 changed files
with
276 additions
and
282 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,30 +1,11 @@ | ||
<templates> | ||
<t t-name="o-spreadsheet-ChartFigure" owl="1"> | ||
<div | ||
class="o-chart-container w-100 h-100" | ||
t-ref="chartContainer" | ||
t-on-contextmenu.prevent.stop="(ev) => !env.isDashboard() and this.onContextMenu(ev)"> | ||
<div class="o-figure-menu" t-if="!env.isDashboard()"> | ||
<div | ||
class="o-figure-menu-item" | ||
t-on-click="showMenu" | ||
t-ref="menuButton" | ||
t-on-contextmenu.prevent.stop="showMenu"> | ||
<t t-call="o-spreadsheet-Icon.LIST"/> | ||
</div> | ||
</div> | ||
<div class="o-chart-container w-100 h-100"> | ||
<t | ||
t-component="chartComponent" | ||
figure="this.props.figure" | ||
t-key="this.props.figure.id + '-' + chartType" | ||
/> | ||
|
||
<Menu | ||
t-if="menuState.isOpen" | ||
position="menuState.position" | ||
menuItems="menuState.menuItems" | ||
onClose="() => this.menuState.isOpen=false" | ||
/> | ||
</div> | ||
</t> | ||
</templates> |
This file contains 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 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,25 +1,5 @@ | ||
<templates> | ||
<t t-name="o-spreadsheet-ImageFigure" owl="1"> | ||
<div class="o-figure-menu" t-if="!env.isDashboard()"> | ||
<div | ||
class="o-figure-menu-item" | ||
t-on-click="showMenu" | ||
t-ref="menuButton" | ||
t-on-contextmenu.prevent.stop="showMenu"> | ||
<t t-call="o-spreadsheet-Icon.LIST"/> | ||
</div> | ||
</div> | ||
<img | ||
t-ref="o-image" | ||
t-att-src="getImagePath" | ||
class="w-100 h-100" | ||
t-on-contextmenu.prevent.stop="(ev) => !env.isDashboard() and this.onContextMenu(ev)" | ||
/> | ||
<Menu | ||
t-if="menuState.isOpen" | ||
position="menuState.position" | ||
menuItems="menuItems" | ||
onClose="() => this.menuState.isOpen=false" | ||
/> | ||
<img t-att-src="getImagePath" class="w-100 h-100"/> | ||
</t> | ||
</templates> |
Oops, something went wrong.