From 55857ea5a43ff4d7bf5ffd808a87da3b42e163a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Fri, 7 Feb 2020 02:43:49 +0100 Subject: [PATCH] [IMP] web_widget_numeric_step: Better CSS and supports mobile layouts --- web_widget_numeric_step/README.rst | 53 ++- web_widget_numeric_step/__manifest__.py | 14 +- .../demo/res_users_view.xml | 17 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 6 +- web_widget_numeric_step/readme/USAGE.rst | 6 +- .../static/description/index.html | 37 ++- .../static/src/css/numeric_step.scss | 3 + .../static/src/js/numeric_step.js | 302 +++++++++++++----- .../static/src/scss/numeric_step.scss | 29 -- .../static/src/xml/numeric_step.xml | 21 +- ...web_widget_numeric_step.xml => assets.xml} | 4 +- 12 files changed, 349 insertions(+), 147 deletions(-) create mode 100644 web_widget_numeric_step/demo/res_users_view.xml create mode 100644 web_widget_numeric_step/static/src/css/numeric_step.scss delete mode 100644 web_widget_numeric_step/static/src/scss/numeric_step.scss rename web_widget_numeric_step/view/{web_widget_numeric_step.xml => assets.xml} (90%) diff --git a/web_widget_numeric_step/README.rst b/web_widget_numeric_step/README.rst index 4e45fa408..f61c24b4f 100644 --- a/web_widget_numeric_step/README.rst +++ b/web_widget_numeric_step/README.rst @@ -13,15 +13,23 @@ Web Widget Numeric Step .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-quentinDupont%2Fweb-lightgray.png?logo=github - :target: https://github.com/quentinDupont/web/tree/12.0_ADD_web_widget_ux_choice/web_widget_numeric_step - :alt: quentinDupont/web +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_widget_numeric_step + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_numeric_step + :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/12.0 + :alt: Try me on Runbot -|badge1| |badge2| |badge3| +|badge1| |badge2| |badge3| |badge4| |badge5| -This widget changes input number field and make it easier to incremente the number thanks to 2 buttons (+ and -). +This widget changes input number field and make it easier to increment the number thanks to 2 buttons (+ and -). Use JS native logic for input number, so you can use the options ``min``, ``max``, ``step``, ``placeholder``. +Demo available at `Settings > Users & Companies > Users > *Select One* > See 'Credit Limit' field` + **Table of contents** .. contents:: @@ -34,7 +42,7 @@ In your xml view, add ``widget="numeric_step"`` This will add the 2 buttons "+" and "-" just next to the input field in edit mode. Iteration step by default is 1. -.. figure:: https://raw.githubusercontent.com/quentinDupont/web/12.0_ADD_web_widget_ux_choice/web_widget_numeric_step/static/description/add_two_buttons.png +.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/add_two_buttons.png **Optional** @@ -43,27 +51,29 @@ Add an option to choose the step iteration and limits (min and max values). Example for an 0.25 step, min to -1 and max to 10 : -`` days`` +.. code:: xml + + days **Examples** Iteration with 0.25 step, min to -1 and max to 10. -Start to incremente with button, continue incrementing with scrolling mouse. +Start to increment with button, continue incrementing with scrolling mouse. -.. figure:: https://raw.githubusercontent.com/quentinDupont/web/12.0_ADD_web_widget_ux_choice/web_widget_numeric_step/static/description/step0,25andlimits.gif +.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/step0,25andlimits.gif Iteration with 10 step, max limit 15, placeholder with onchange -.. figure:: https://raw.githubusercontent.com/quentinDupont/web/12.0_ADD_web_widget_ux_choice/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif +.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -74,6 +84,7 @@ Authors ~~~~~~~ * GRAP +* Tecnativa Contributors ~~~~~~~~~~~~ @@ -82,9 +93,23 @@ Contributors * Quentin DUPONT +* `Tecnativa `_: + + * Alexandre Díaz + Maintainers ~~~~~~~~~~~ -This module is part of the `quentinDupont/web `_ project on GitHub. +This module is maintained by the OCA. -You are welcome to contribute. +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_numeric_step/__manifest__.py b/web_widget_numeric_step/__manifest__.py index 7830c8688..092fc003f 100644 --- a/web_widget_numeric_step/__manifest__.py +++ b/web_widget_numeric_step/__manifest__.py @@ -1,21 +1,25 @@ -# Odoo, Open Source Web Widget Numeric Step -# -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).# +# Copyright 2019 GRAP - Quentin DUPONT +# Copyright 2020 Tecnativa - Alexandre Díaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + { 'name': "Web Widget Numeric Step", 'category': "web", 'version': "12.0.1.0.0", - 'author': "GRAP, " + 'author': "GRAP, Tecnativa, " "Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'https://github.com/OCA/web', 'depends': ['web'], 'data': [ - 'view/web_widget_numeric_step.xml' + 'view/assets.xml' ], 'qweb': [ 'static/src/xml/numeric_step.xml', ], + 'demo': [ + 'demo/res_users_view.xml' + ], 'auto_install': False, 'installable': True, } diff --git a/web_widget_numeric_step/demo/res_users_view.xml b/web_widget_numeric_step/demo/res_users_view.xml new file mode 100644 index 000000000..521affed0 --- /dev/null +++ b/web_widget_numeric_step/demo/res_users_view.xml @@ -0,0 +1,17 @@ + + + + + + res.users + + + + + + + + + + diff --git a/web_widget_numeric_step/readme/CONTRIBUTORS.rst b/web_widget_numeric_step/readme/CONTRIBUTORS.rst index 65f8f81d1..de2b473bd 100644 --- a/web_widget_numeric_step/readme/CONTRIBUTORS.rst +++ b/web_widget_numeric_step/readme/CONTRIBUTORS.rst @@ -1,3 +1,7 @@ * `GRAP `_: * Quentin DUPONT + +* `Tecnativa `_: + + * Alexandre Díaz diff --git a/web_widget_numeric_step/readme/DESCRIPTION.rst b/web_widget_numeric_step/readme/DESCRIPTION.rst index f4906b4ab..4f251db10 100644 --- a/web_widget_numeric_step/readme/DESCRIPTION.rst +++ b/web_widget_numeric_step/readme/DESCRIPTION.rst @@ -1,2 +1,4 @@ -This widget changes input number field and make it easier to incremente the number thanks to 2 buttons (+ and -). -Use JS native logic for input number, so you can use the options ``min``, ``max``, ``step``, ``placeholder``. \ No newline at end of file +This widget changes input number field and make it easier to increment the number thanks to 2 buttons (+ and -). +Use JS native logic for input number, so you can use the options ``min``, ``max``, ``step``, ``placeholder``. + +Demo available at `Settings > Users & Companies > Users > *Select One* > See 'Credit Limit' field` diff --git a/web_widget_numeric_step/readme/USAGE.rst b/web_widget_numeric_step/readme/USAGE.rst index 47aaf790c..e272b8022 100644 --- a/web_widget_numeric_step/readme/USAGE.rst +++ b/web_widget_numeric_step/readme/USAGE.rst @@ -11,13 +11,15 @@ Add an option to choose the step iteration and limits (min and max values). Example for an 0.25 step, min to -1 and max to 10 : -`` days`` +.. code:: xml + + days **Examples** Iteration with 0.25 step, min to -1 and max to 10. -Start to incremente with button, continue incrementing with scrolling mouse. +Start to increment with button, continue incrementing with scrolling mouse. .. figure:: ../static/description/step0,25andlimits.gif diff --git a/web_widget_numeric_step/static/description/index.html b/web_widget_numeric_step/static/description/index.html index c838ff91f..ea4b4c5ed 100644 --- a/web_widget_numeric_step/static/description/index.html +++ b/web_widget_numeric_step/static/description/index.html @@ -3,7 +3,7 @@ - + Web Widget Numeric Step