[WIP] add dropdown to show/hide employees in the portal's contact page
this is achieved by extending the many2many_kanban widget and adding it a few events bzr revid: abo@openerp.com-20120706143401-z8zjla7kbiklbua5
This commit is contained in:
parent
4eba8c2290
commit
622c7f2ad4
|
@ -43,7 +43,7 @@ portal_crm (which creates the contact page) are installed.
|
|||
'static/src/css/portal_hr_employees.css',
|
||||
],
|
||||
'js': [
|
||||
'static/lib/jquery.expander/portal_hr_employees.js',
|
||||
'static/src/js/portal_hr_employees.js',
|
||||
],
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@class='oe_portal_crm_team']" position="inside">
|
||||
<h1>Meet the team</h1>
|
||||
<field name="employee_ids" widget="many2many_kanban">
|
||||
<field name="employee_ids" widget="many2many_kanban_custom">
|
||||
<kanban>
|
||||
<field name="visibility"/>
|
||||
|
||||
|
@ -35,9 +35,9 @@
|
|||
<div class="oe_employee_vignette">
|
||||
<span class="oe_dropdown_toggle oe_dropdown_arrow">
|
||||
<ul class="oe_dropdown_menu">
|
||||
<li t-if="record.visibility.raw_value != 'private'"><a href="#" t-attf-data-id='{record.id}' class="oe_employee_make_private">Hide this employee</a></li>
|
||||
<li t-if="record.visibility.raw_value != 'public'"><a href="#" t-attf-data-id='{record.id}' class="oe_employee_make_public">Make this employee visible for everyone</a></li>
|
||||
<li t-if="record.visibility.raw_value != 'portal'"><a href="#" t-attf-data-id='{record.id}' class="oe_employee_make_portal">Make this employee visible for portal users</a></li>
|
||||
<li t-if="record.visibility.raw_value != 'private'"><a href="#" t-attf-data-id='{record.id.raw_value}' class="oe_employee_make_private">Hide this employee</a></li>
|
||||
<li t-if="record.visibility.raw_value != 'public'"><a href="#" t-attf-data-id='{record.id.raw_value}' class="oe_employee_make_public">Make this employee visible for everyone</a></li>
|
||||
<li t-if="record.visibility.raw_value != 'portal'"><a href="#" t-attf-data-id='{record.id.raw_value}' class="oe_employee_make_portal">Make this employee visible for portal users</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -1,3 +1,40 @@
|
|||
openerp.portal_hr_employees = function(session) {
|
||||
/*
|
||||
* Extend the many2many_kanban widget and add it a few things such
|
||||
* as delegates.
|
||||
*/
|
||||
|
||||
}
|
||||
// phe: short name for "portal hr employees"
|
||||
var phe = session.portal_hr_employees = {};
|
||||
|
||||
phe.many2many_kanban_custom = session.web.form.FieldMany2ManyKanban.extend({
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// add events
|
||||
this.add_events();
|
||||
},
|
||||
add_events: function() {
|
||||
var self = this;
|
||||
|
||||
// event: make an employee public
|
||||
this.$element.delegate('a.oe_employee_make_public', 'click', function (e) {
|
||||
console.log('make employee#'+$(this).attr('data-id')+' public');
|
||||
});
|
||||
|
||||
// event: make an employee private
|
||||
this.$element.delegate('a.oe_employee_make_private', 'click', function (e) {
|
||||
console.log('make employee#'+$(this).attr('data-id')+' private');
|
||||
});
|
||||
|
||||
// event: make an employee portal
|
||||
this.$element.delegate('a.oe_employee_make_portal', 'click', function (e) {
|
||||
console.log('make employee#'+$(this).attr('data-id')+' portal');
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
session.web.form.widgets.add('many2many_kanban_custom', 'openerp.portal_hr_employees.many2many_kanban_custom');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue