mirror of https://github.com/OCA/web.git
commit
354a323a8f
|
@ -51,6 +51,7 @@ Authors
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
* Compassion Switzerland
|
* Compassion Switzerland
|
||||||
|
* Tecnativa
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
@ -59,6 +60,7 @@ Contributors
|
||||||
* `Tecnativa <https://www.tecnativa.com>`__:
|
* `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* João Marques
|
* João Marques
|
||||||
|
* Alexandre D. Díaz
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "Web Refresher",
|
"name": "Web Refresher",
|
||||||
"version": "14.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"author": "Compassion Switzerland, Odoo Community Association (OCA)",
|
"author": "Compassion Switzerland, Tecnativa, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"qweb": ["templates/pager_button.xml"],
|
"data": ["templates/assets.xml"],
|
||||||
|
"qweb": ["static/src/xml/refresher.xml"],
|
||||||
"depends": ["web"],
|
"depends": ["web"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"auto_install": False,
|
"auto_install": False,
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
* `Tecnativa <https://www.tecnativa.com>`__:
|
* `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* João Marques
|
* João Marques
|
||||||
|
* Alexandre D. Díaz
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||||
<title>Web Refresher</title>
|
<title>Web Refresher</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
@ -396,6 +396,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
|
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Compassion Switzerland</li>
|
<li>Compassion Switzerland</li>
|
||||||
|
<li>Tecnativa</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="contributors">
|
<div class="section" id="contributors">
|
||||||
|
@ -404,6 +405,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<li>Samuel Fringeli</li>
|
<li>Samuel Fringeli</li>
|
||||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||||
<li>João Marques</li>
|
<li>João Marques</li>
|
||||||
|
<li>Alexandre D. Díaz</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* Copyright 2022 Tecnativa - Alexandre D. Díaz
|
||||||
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||||
|
odoo.define("refresher.Refresher", function (require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const ControlPanel = require("web.ControlPanel");
|
||||||
|
|
||||||
|
const {Component, hooks} = owl;
|
||||||
|
const {useRef} = hooks;
|
||||||
|
|
||||||
|
class Refresher extends Component {
|
||||||
|
_doRefresh() {
|
||||||
|
// Note: here we use the pager props, see xml
|
||||||
|
const {limit, currentMinimum} = this.props;
|
||||||
|
this.trigger("pager-changed", {currentMinimum, limit});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Refresher.template = "web_refresher.Button";
|
||||||
|
|
||||||
|
// Patch control panel to initialize refresher component
|
||||||
|
ControlPanel.components = Object.assign({}, ControlPanel.components, {
|
||||||
|
Refresher,
|
||||||
|
});
|
||||||
|
ControlPanel.patch("web_refresher.ControlPanel", (T) => {
|
||||||
|
class ControlPanelRefresher extends T {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
if ("cp_content" in this.props) {
|
||||||
|
const content = this.props.cp_content || {};
|
||||||
|
if ("$refresher" in content) {
|
||||||
|
this.additionalContent.refresher = content.$refresher;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.contentRefs.refresher = useRef("refresher");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ControlPanelRefresher;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Refresher;
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
.oe_cp_refresher {
|
||||||
|
margin: auto 0 auto auto;
|
||||||
|
padding-left: 5px;
|
||||||
|
text-align: right;
|
||||||
|
user-select: none;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!-- Copyright 2022 Tecnativa - Alexandre Díaz
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<t
|
||||||
|
t-name="web_refresher.ControlPanel"
|
||||||
|
t-inherit="web.ControlPanel"
|
||||||
|
t-inherit-mode="extension"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<xpath expr="//div[hasclass('o_cp_pager')]" position="before">
|
||||||
|
<div class="oe_cp_refresher" role="search" t-ref="refresher">
|
||||||
|
<Refresher t-props="props.pager" />
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t
|
||||||
|
t-name="web_refresher.ControlPanelX2Many"
|
||||||
|
t-inherit="web.ControlPanelX2Many"
|
||||||
|
t-inherit-mode="extension"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<xpath expr="//div[hasclass('o_cp_pager')]" position="before">
|
||||||
|
<div class="oe_cp_refresher" role="search" t-ref="refresher">
|
||||||
|
<Refresher t-props="props.pager" />
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="web_refresher.Button" owl="1">
|
||||||
|
<nav class="oe_refresher" aria-label="Pager">
|
||||||
|
<span aria-atomic="true">
|
||||||
|
<button
|
||||||
|
class="fa fa-refresh btn btn-icon oe_pager_refresh"
|
||||||
|
aria-label="Refresh"
|
||||||
|
t-on-click="_doRefresh"
|
||||||
|
title="Refresh"
|
||||||
|
tabindex="-1"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</nav>
|
||||||
|
</t>
|
||||||
|
</template>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<template id="page_refresher" name="Refresh button" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr=".">
|
||||||
|
<link
|
||||||
|
type="text/css"
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/web_refresher/static/src/scss/refresher.scss"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
src="/web_refresher/static/src/js/refresher.js"
|
||||||
|
type="text/javascript"
|
||||||
|
/>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</odoo>
|
|
@ -1,25 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!-- Copyright 2021 Tecnativa - João Marques
|
|
||||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
|
||||||
<template>
|
|
||||||
<t
|
|
||||||
t-name="web_refresher.Pager"
|
|
||||||
t-inherit="web.Pager"
|
|
||||||
t-inherit-mode="extension"
|
|
||||||
owl="1"
|
|
||||||
>
|
|
||||||
<xpath expr="//span[hasclass('o_pager_counter')]" position="before">
|
|
||||||
<span class="btn-group" aria-atomic="true">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="fa fa-refresh btn btn-secondary o_pager_refresh"
|
|
||||||
aria-label="Refresh"
|
|
||||||
title="Refresh"
|
|
||||||
tabindex="-1"
|
|
||||||
t-on-click="_changeSelection(0)"
|
|
||||||
style="margin-right: 5px;"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</xpath>
|
|
||||||
</t>
|
|
||||||
</template>
|
|
Loading…
Reference in New Issue