Merge PR #2366 into 16.0

Signed-off-by pedrobaeza
pull/2400/head
OCA-git-bot 2022-12-21 07:51:46 +00:00
commit dea6b48c32
10 changed files with 90 additions and 32 deletions

View File

@ -19,9 +19,9 @@ Web Refresher
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_refresher
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/16.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -51,6 +51,7 @@ Authors
~~~~~~~
* Compassion Switzerland
* Tecnativa
Contributors
~~~~~~~~~~~~
@ -59,6 +60,8 @@ Contributors
* `Tecnativa <https://www.tecnativa.com>`__:
* João Marques
* Alexandre D. Díaz
* Carlos Roca
* Thanakrit Pintana
* `Factorlibre <https://www.factorlibre.com>`__:

View File

@ -1,11 +1,19 @@
{
"name": "Web Refresher",
"version": "16.0.1.0.0",
"author": "Compassion Switzerland, Odoo Community Association (OCA)",
"author": "Compassion Switzerland, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"installable": True,
"auto_install": False,
"assets": {"web.assets_backend": ["web_refresher/static/src/xml/pager_button.xml"]},
"assets": {
"web.assets_backend": [
"web_refresher/static/src/scss/refresher.scss",
"web_refresher/static/src/js/refresher.esm.js",
"web_refresher/static/src/js/pager.esm.js",
"web_refresher/static/src/xml/refresher.xml",
"web_refresher/static/src/xml/pager.xml",
],
},
}

View File

@ -2,6 +2,8 @@
* `Tecnativa <https://www.tecnativa.com>`__:
* João Marques
* Alexandre D. Díaz
* Carlos Roca
* Thanakrit Pintana
* `Factorlibre <https://www.factorlibre.com>`__:

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<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>
<style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_refresher"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_refresher"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_refresher"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_refresher"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/web&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Adds a button next to the pager (in trees/kanban views) to refresh the displayed list.</p>
<img alt="https://raw.githubusercontent.com/OCA/web/16.0/web_refresher/static/description/refresh.png" src="https://raw.githubusercontent.com/OCA/web/16.0/web_refresher/static/description/refresh.png" />
<p><strong>Table of contents</strong></p>
@ -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>
<ul class="simple">
<li>Compassion Switzerland</li>
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
@ -404,6 +405,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Samuel Fringeli</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>João Marques</li>
<li>Alexandre D. Díaz</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>Thanakrit Pintana</li>

View File

@ -0,0 +1,9 @@
/** @odoo-module **/
/* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
import {Pager} from "@web/core/pager/pager";
import {Refresher} from "./refresher.esm";
Pager.components = Object.assign({}, Pager.components, {
Refresher,
});

View File

@ -0,0 +1,16 @@
/** @odoo-module **/
/* Copyright 2022 Tecnativa - Alexandre D. Díaz
* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
const {Component} = owl;
export class Refresher extends Component {
_doRefresh() {
// Note: here we use the pager props, see xml
const {limit, offset} = this.props;
this.props.onUpdate({offset, limit});
}
}
Refresher.template = "web_refresher.Button";

View File

@ -0,0 +1,7 @@
.oe_cp_refresher {
margin: auto 0 auto auto;
padding-left: 5px;
text-align: right;
user-select: none;
flex-grow: 1;
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2022 Tecnativa - Carlos Roca
License AGPL-3.0 or later (http://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">
<div class="oe_cp_refresher" role="search" t-ref="refresher">
<Refresher t-props="props" />
</div>
</xpath>
</t>
</template>

View File

@ -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.stop="() => this.navigate(0)"
style="margin-right: 5px;"
/>
</span>
</xpath>
</t>
</template>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2022 Tecnativa - Alexandre Díaz
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<template>
<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>