Browse Source

[ADD] Add support for swipe between form records on mobile devices

pull/732/head
Wolfgang Pichler 7 years ago
parent
commit
28df9e6d69
  1. 76
      web_gesture/README.rst
  2. 1
      web_gesture/__init__.py
  3. 22
      web_gesture/__manifest__.py
  4. 29
      web_gesture/static/src/js/gestures.js
  5. 2643
      web_gesture/static/src/lib/hammer.js
  6. 7
      web_gesture/static/src/lib/hammer.min.js
  7. 9
      web_gesture/views/assets.xml

76
web_gesture/README.rst

@ -0,0 +1,76 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
============
Web Gestures
============
This module does add swipe support on record form view for mobile devices
Installation
============
Just install the module
Configuration
=============
No Configuration needed
Usage
=====
Swipe left or right on mobile device when in record form view with more than 1 record
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/web/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Wolfgang Pichler <wpichler@callino.at> (http://www.callino.at/)
Do not contact contributors directly about support or help with technical issues.
This module does use the Hammer.JS Javascript implementation by Jorik Tangelder.
Funders
-------
The development of this module has been financially supported by:
* Callino Software Development
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

1
web_gesture/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

22
web_gesture/__manifest__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
{
"name" : "Web Gestures Support",
"version" : "10.0.1.0.0",
"author" : "Callino, Wolfgang Pichler"
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": 'Web',
'complexity': "easy",
'depends': ['web'],
"summary": """
This module does provide gesture support for odoo
It does support:
* Swipe in form view to get to the next / previous record
""",
'data': [
'views/assets.xml',
],
'website': 'http://www.callino.at',
'installable': True,
'auto_install': False,
}

29
web_gesture/static/src/js/gestures.js

@ -0,0 +1,29 @@
odoo.define('web_gestures', function (require) {
"use strict";
var core = require('web.core');
var QWeb = core.qweb;
var _t = core._t;
var Pager = require('web.Pager');
Pager.include({
start: function(){
var res = this._super.apply(this);
if ((!(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())))) {
// Do not initialize on desktop browsers
return;
}
var self = this;
var content = $(".o_content");
this.hammertime = new Hammer(content.get(0));
this.hammertime.on('swipeleft', function(ev) {
self.next();
});
this.hammertime.on('swiperight', function(ev) {
self.previous();
});
return res;
}
});
});

2643
web_gesture/static/src/lib/hammer.js
File diff suppressed because it is too large
View File

7
web_gesture/static/src/lib/hammer.min.js
File diff suppressed because it is too large
View File

9
web_gesture/views/assets.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="help.online.assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_gesture/static/src/lib/hammer.min.js"></script>
<script type="text/javascript" src="/web_gesture/static/src/js/gestures.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save