diff --git a/web_environment_ribbon/README.rst b/web_environment_ribbon/README.rst index 92cf6da5..a3ecc310 100644 --- a/web_environment_ribbon/README.rst +++ b/web_environment_ribbon/README.rst @@ -17,7 +17,11 @@ Installation Configuration ============= - * No special setup + * 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 ===== @@ -30,7 +34,7 @@ Known issues / Roadmap ====================== * Allow to define in some place (system parameter, configuration file...) the - text for the ribbon and the ribbon color. + ribbon color. Bug Tracker =========== diff --git a/web_environment_ribbon/__openerp__.py b/web_environment_ribbon/__openerp__.py index 7252107f..3544d77c 100644 --- a/web_environment_ribbon/__openerp__.py +++ b/web_environment_ribbon/__openerp__.py @@ -31,6 +31,7 @@ ], "data": [ 'view/base_view.xml', + 'data/ribbon_data.xml', ], "update_xml": [], "demo_xml": [], diff --git a/web_environment_ribbon/data/ribbon_data.xml b/web_environment_ribbon/data/ribbon_data.xml new file mode 100644 index 00000000..9ce2b3e6 --- /dev/null +++ b/web_environment_ribbon/data/ribbon_data.xml @@ -0,0 +1,12 @@ + + + + + + + ribbon.name + TEST + + + + 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 00000000..48848fc8 --- /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 index 09a7caf4..6d9efc9c 100644 --- a/web_environment_ribbon/view/base_view.xml +++ b/web_environment_ribbon/view/base_view.xml @@ -6,16 +6,16 @@