diff --git a/web_environment_ribbon/README.rst b/web_environment_ribbon/README.rst new file mode 100644 index 0000000..a3ecc31 --- /dev/null +++ b/web_environment_ribbon/README.rst @@ -0,0 +1,69 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Web Environment Ribbon +====================== + +Mark a Test Environment with a red ribbon on the top left corner in every page + +.. image:: /web_environment_ribbon/static/description/screenshot.png + :alt: Screenshot + +Installation +============ + + * No special setup + +Configuration +============= + + * You can change the ribbon's name ("TEST") by editing + the default system parameter "ribbon.name" + (in the menu Settings > Parameters > System Parameters) + To hide the ribbon, set this parameter to "False" or + delete it. + +Usage +===== + +To use this module, you need only to install it. After installation, a red +ribbon will be visible on top left corner of every Odoo backend page + + +Known issues / Roadmap +====================== + +* Allow to define in some place (system parameter, configuration file...) the + ribbon color. + +Bug Tracker +=========== + +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 +`here `_. + + +Credits +======= + +Contributors +------------ + +* Francesco Apruzzese + +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 http://odoo-community.org. diff --git a/web_environment_ribbon/__init__.py b/web_environment_ribbon/__init__.py new file mode 100644 index 0000000..5d2935f --- /dev/null +++ b/web_environment_ribbon/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Francesco OpenCode Apruzzese () +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## diff --git a/web_environment_ribbon/__openerp__.py b/web_environment_ribbon/__openerp__.py new file mode 100644 index 0000000..a6cbbd8 --- /dev/null +++ b/web_environment_ribbon/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Francesco OpenCode Apruzzese () +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': "Web Environment Ribbon", + 'version': '8.0.0.1.0', + 'category': 'Web', + 'author': 'Francesco OpenCode Apruzzese,Odoo Community Association (OCA),Thibault Francois', + 'website': 'https://it.linkedin.com/in/francescoapruzzese', + 'license': 'AGPL-3', + "depends": [ + 'web', + ], + "data": [ + 'view/base_view.xml', + 'data/ribbon_data.xml', + ], + "update_xml": [], + "demo_xml": [], + "auto_install": False, + 'installable': True, +} diff --git a/web_environment_ribbon/data/ribbon_data.xml b/web_environment_ribbon/data/ribbon_data.xml new file mode 100644 index 0000000..9ce2b3e --- /dev/null +++ b/web_environment_ribbon/data/ribbon_data.xml @@ -0,0 +1,12 @@ + + + + + + + ribbon.name + TEST + + + + diff --git a/web_environment_ribbon/static/description/icon.png b/web_environment_ribbon/static/description/icon.png new file mode 100644 index 0000000..78b52ae Binary files /dev/null and b/web_environment_ribbon/static/description/icon.png differ diff --git a/web_environment_ribbon/static/description/screenshot.png b/web_environment_ribbon/static/description/screenshot.png new file mode 100644 index 0000000..3024565 Binary files /dev/null and b/web_environment_ribbon/static/description/screenshot.png differ diff --git a/web_environment_ribbon/static/src/css/ribbon.css b/web_environment_ribbon/static/src/css/ribbon.css new file mode 100644 index 0000000..627bd85 --- /dev/null +++ b/web_environment_ribbon/static/src/css/ribbon.css @@ -0,0 +1,24 @@ +.test-ribbon{ + width: 200px; + background: #e43; + position: absolute; + top: 50px; + left: -50px; + text-align: center; + line-height: 50px; + letter-spacing: 1px; + color: #f0f0f0; + -webkit-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + transform: rotate(-45deg); + z-index: 1000; + position: fixed; + box-shadow: 0 0 3px rgba(0,0,0,.3); + background: rgba(255, 0, 0, .6);; +} + +.test-ribbon b { + font-size: 20px; +} diff --git a/web_environment_ribbon/static/src/js/ribbon.js b/web_environment_ribbon/static/src/js/ribbon.js new file mode 100644 index 0000000..48848fc --- /dev/null +++ b/web_environment_ribbon/static/src/js/ribbon.js @@ -0,0 +1,35 @@ +/****************************************************************************** + Copyright (C) 2015 Akretion (http://www.akretion.com) + @author Sylvain Calador + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +******************************************************************************/ + +openerp.web_environment_ribbon = function(instance) { + + var ribbon = $(document).find('.test-ribbon'); + ribbon.hide(); + + var model = new instance.web.Model('ir.config_parameter'); + var key = 'ribbon.name'; + + var res = model.call('get_param', [key]).then( + function (name) { + if (name && name != 'False') { + ribbon.html(name); + ribbon.show(); + } + } + ); +} diff --git a/web_environment_ribbon/view/base_view.xml b/web_environment_ribbon/view/base_view.xml new file mode 100644 index 0000000..17a66f9 --- /dev/null +++ b/web_environment_ribbon/view/base_view.xml @@ -0,0 +1,21 @@ + + + + + +