Browse Source

[IMP] Add default 'ribbon.name' configuration parameter

pull/796/head
Sylvain Calador 9 years ago
committed by Pedro M. Baeza
parent
commit
a3c206ebc0
  1. 8
      web_environment_ribbon/README.rst
  2. 1
      web_environment_ribbon/__openerp__.py
  3. 12
      web_environment_ribbon/data/ribbon_data.xml
  4. 11
      web_environment_ribbon/static/src/js/ribbon.js
  5. 3
      web_environment_ribbon/view/base_view.xml

8
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
===========

1
web_environment_ribbon/__openerp__.py

@ -31,6 +31,7 @@
],
"data": [
'view/base_view.xml',
'data/ribbon_data.xml',
],
"update_xml": [],
"demo_xml": [],

12
web_environment_ribbon/data/ribbon_data.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Add ribbon name default configuration parameter -->
<record id="default_ribbon_name" model="ir.config_parameter">
<field name="key">ribbon.name</field>
<field name="value">TEST</field>
</record>
</data>
</openerp>

11
web_environment_ribbon/static/src/js/ribbon.js

@ -22,13 +22,12 @@ openerp.web_environment_ribbon = function(instance) {
ribbon.hide();
var model = new instance.web.Model('ir.config_parameter');
var query = [['key', '=', 'ribbon.name']];
var fields = ['value'];
var key = 'ribbon.name';
var res = model.call('search_read', [query, fields]).then(
function (result) {
if (result.length) {
ribbon.html(result[0].value);
var res = model.call('get_param', [key]).then(
function (name) {
if (name && name != 'False') {
ribbon.html(name);
ribbon.show();
}
}

3
web_environment_ribbon/view/base_view.xml

@ -13,10 +13,9 @@
<!-- Add ribbon to page -->
<template id="body_with_ribbon_test" name="ribbon_test web.webclient_bootstrap" inherit_id="web.webclient_bootstrap">
<xpath expr="//div[@class='openerp openerp_webclient_container']" position="before">
<div class="test-ribbon"><b>TEST</b></div>
<div class="test-ribbon"/>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save