forked from Techsystech/web
[IMP] Add default 'ribbon.name' configuration parameter
parent
d8837563cc
commit
db707ae89c
|
@ -17,7 +17,11 @@ Installation
|
||||||
Configuration
|
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
|
Usage
|
||||||
=====
|
=====
|
||||||
|
@ -30,7 +34,7 @@ Known issues / Roadmap
|
||||||
======================
|
======================
|
||||||
|
|
||||||
* Allow to define in some place (system parameter, configuration file...) the
|
* Allow to define in some place (system parameter, configuration file...) the
|
||||||
text for the ribbon and the ribbon color.
|
ribbon color.
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
'view/base_view.xml',
|
'view/base_view.xml',
|
||||||
|
'data/ribbon_data.xml',
|
||||||
],
|
],
|
||||||
"update_xml": [],
|
"update_xml": [],
|
||||||
"demo_xml": [],
|
"demo_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>
|
|
@ -22,13 +22,12 @@ openerp.web_environment_ribbon = function(instance) {
|
||||||
ribbon.hide();
|
ribbon.hide();
|
||||||
|
|
||||||
var model = new instance.web.Model('ir.config_parameter');
|
var model = new instance.web.Model('ir.config_parameter');
|
||||||
var query = [['key', '=', 'ribbon.name']];
|
var key = 'ribbon.name';
|
||||||
var fields = ['value'];
|
|
||||||
|
|
||||||
var res = model.call('search_read', [query, fields]).then(
|
var res = model.call('get_param', [key]).then(
|
||||||
function (result) {
|
function (name) {
|
||||||
if (result.length) {
|
if (name && name != 'False') {
|
||||||
ribbon.html(result[0].value);
|
ribbon.html(name);
|
||||||
ribbon.show();
|
ribbon.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
<!-- Add ribbon to page -->
|
<!-- Add ribbon to page -->
|
||||||
<template id="body_with_ribbon_test" name="ribbon_test web.webclient_bootstrap" inherit_id="web.webclient_bootstrap">
|
<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">
|
<xpath expr="//div[@class='openerp openerp_webclient_container']" position="before">
|
||||||
<div class="test-ribbon"><b>TEST</b></div>
|
<div class="test-ribbon"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
Loading…
Reference in New Issue