[CLEAN] mail.js: cleaned Wall and RecordThread. Deleted code in wall related to message_fetch, display and fetch more. Deleted dead XML and CSS.
bzr revid: tde@openerp.com-20120821114128-mwu6av0n52r2tbww
This commit is contained in:
parent
5872ed6bd3
commit
c277a22f4d
|
@ -19,30 +19,6 @@
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.openerp div.oe_mail_wall_action {
|
|
||||||
padding: 8px;
|
|
||||||
background: #eee;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.openerp div.oe_mail_wall_action:after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.openerp div.oe_mail_wall_action .oe_mail_msg_content {
|
|
||||||
width: 484px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.openerp div.oe_mail_wall_action textarea.oe_mail_compose_textarea,
|
|
||||||
.openerp div.oe_mail_wall_action div.oe_mail_compose_message_body textarea {
|
|
||||||
width: 474px;
|
|
||||||
height: 60px;
|
|
||||||
padding: 4px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.openerp ul.oe_mail_wall_threads {
|
.openerp ul.oe_mail_wall_threads {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
@ -79,11 +55,6 @@
|
||||||
width: 440px;
|
width: 440px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.openerp div.oe_mail_wall_more {
|
|
||||||
text-align: center;
|
|
||||||
/*display: none;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/* RecordThread
|
/* RecordThread
|
||||||
|
@ -152,7 +123,7 @@
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
||||||
.openerp div.oe_mail_thread_action {
|
.openerp div.oe_mail_thread_action {
|
||||||
/*display: none;*/
|
display: none;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
background: #eee;
|
background: #eee;
|
||||||
|
@ -198,7 +169,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.openerp div.oe_mail_thread_more {
|
.openerp div.oe_mail_thread_more {
|
||||||
/*display: none;*/
|
display: none;
|
||||||
border-bottom: 1px solid #D2D9E7;
|
border-bottom: 1px solid #D2D9E7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +362,7 @@
|
||||||
|
|
||||||
/* Attachments list */
|
/* Attachments list */
|
||||||
.openerp ul.oe_mail_msg_attachments {
|
.openerp ul.oe_mail_msg_attachments {
|
||||||
/*display: none;*/
|
display: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-top: 1px solid #CCC;
|
border-top: 1px solid #CCC;
|
||||||
margin: .5em 0 0 0;
|
margin: .5em 0 0 0;
|
||||||
|
|
|
@ -724,43 +724,54 @@ openerp.mail = function(session) {
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.params = this.options || {};
|
this.options.domain = this.options.domain || [];
|
||||||
this.params.thread_level = this.params.thread_level || 0;
|
this.options.context = {'res_model': 'mail.thread', 'res_id': false, 'parent_id': false};
|
||||||
this.thread = null;
|
this.options.thread_level = this.options.thread_level || 0;
|
||||||
|
this.thread_list = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
// this._super.apply(this, arguments);
|
||||||
// NB: all the widget should be modified to check the actual_mode property on view, not use
|
// NB: all the widget should be modified to check the actual_mode property on view, not use
|
||||||
// any other method to know if the view is in create mode anymore
|
// any other method to know if the view is in create mode anymore
|
||||||
this.view.on("change:actual_mode", this, this._check_visibility);
|
this.view.on("change:actual_mode", this, this._check_visibility);
|
||||||
this._check_visibility();
|
this._check_visibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
_check_visibility: function() {
|
_check_visibility: function() {
|
||||||
this.$element.toggle(this.view.get("actual_mode") !== "create");
|
this.$element.toggle(this.view.get("actual_mode") !== "create");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
for (var i in this.thread_list) { this.thread_list[i].destroy(); }
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
set_value: function() {
|
set_value: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
if (! this.view.datarecord.id ||
|
if (! this.view.datarecord.id || session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) {
|
||||||
session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) {
|
this.$el.find('oe_mail_thread').hide();
|
||||||
this.$element.find('.oe_mail_thread').hide();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// update context
|
||||||
|
this.options.context['res_id'] = this.view.datarecord.id;
|
||||||
|
this.options.context['res_model'] = this.view.model;
|
||||||
// create and render Thread widget
|
// create and render Thread widget
|
||||||
this.$element.find('div.oe_mail_recthread_main').empty();
|
this.$element.find('div.oe_mail_recthread_main').empty();
|
||||||
if (this.thread) this.thread.destroy();
|
for (var i in this.thread_list) { this.thread_list[i].destroy(); }
|
||||||
this.thread = new mail.Thread(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid,
|
var thread = new mail.Thread(this, {
|
||||||
'thread_level': this.params.thread_level, 'show_post_comment': true, 'limit': 15});
|
'context': this.options.context, 'uid': this.session.uid,
|
||||||
var thread_done = this.thread.appendTo(this.$element.find('div.oe_mail_recthread_main'));
|
'thread_level': this.options.thread_level, 'show_header_compose': true,
|
||||||
return thread_done;
|
'show_delete': true, 'composer': true });
|
||||||
|
this.thread_list.push(thread);
|
||||||
|
return thread.appendTo(this.$element.find('div.oe_mail_recthread_main'));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
* WallView Widget
|
* Wall Widget
|
||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* This widget handles the display of the Chatter on the Wall.
|
* This widget handles the display of the Chatter on the Wall.
|
||||||
|
@ -775,19 +786,16 @@ openerp.mail = function(session) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} parent parent
|
* @param {Object} parent parent
|
||||||
* @param {Object} [params]
|
* @param {Object} [options]
|
||||||
* @param {Number} [params.limit=20] number of messages to show and fetch
|
* @param {Number} [options.domain] domain on the Wall, is an array.
|
||||||
* @var {Array} comments_structure (see chatter utils)
|
* @param {Number} [options.domain] context, is an object. It should
|
||||||
|
* contain res_model, res_id, parent_id, to give it to the threads.
|
||||||
*/
|
*/
|
||||||
init: function (parent, options) {
|
init: function (parent, options) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this.options.domain = options.domain || [];
|
this.options.domain = options.domain || [];
|
||||||
this.options.context = options.context || {};
|
this.options.context = options.context || {};
|
||||||
// TDE: default values in thread
|
|
||||||
// this.options.context.res_model = options.res_model || 'mail.thread';
|
|
||||||
// this.options.context.parent_id = options.parent_id || false;
|
|
||||||
// this.options.context.res_id = options.res_id || false;
|
|
||||||
this.options.thread_level = options.thread_level || 1;
|
this.options.thread_level = options.thread_level || 1;
|
||||||
this.thread_list = [];
|
this.thread_list = [];
|
||||||
this.ds_msg = new session.web.DataSet(this, 'mail.message');
|
this.ds_msg = new session.web.DataSet(this, 'mail.message');
|
||||||
|
@ -798,44 +806,21 @@ openerp.mail = function(session) {
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
// this.bind_events();
|
|
||||||
// load mail.message search view
|
|
||||||
var search_view_ready = this.load_search_view({}, false);
|
var search_view_ready = this.load_search_view({}, false);
|
||||||
// load composition form
|
|
||||||
// var compose_done = this.instantiate_composition_form();
|
|
||||||
// fetch first threads
|
|
||||||
// var messages_fetched = this.message_fetch();
|
|
||||||
var thread_displayed = this.display_thread();
|
var thread_displayed = this.display_thread();
|
||||||
// return (search_view_ready && compose_done && messages_fetched);
|
|
||||||
return (search_view_ready && thread_displayed);
|
return (search_view_ready && thread_displayed);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
|
for (var i in this.thrad_list) { this.thread_list[i].destroy(); }
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
if (this.thread_list) {
|
|
||||||
// #TODO: destroy threads
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// TDE: move to thread
|
|
||||||
// instantiate_composition_form: function(mode, msg_id) {
|
|
||||||
// if (this.compose_message_widget) {
|
|
||||||
// this.compose_message_widget.destroy();
|
|
||||||
// }
|
|
||||||
// this.compose_message_widget = new mail.ComposeMessage(this, {
|
|
||||||
// 'extended_mode': false, 'uid': this.session.uid, 'res_model': this.options.res_model,
|
|
||||||
// 'res_id': this.options.res_id, 'mode': mode || 'comment', 'msg_id': msg_id });
|
|
||||||
// var composition_node = this.$element.find('div.oe_mail_wall_action');
|
|
||||||
// composition_node.empty();
|
|
||||||
// var compose_done = this.compose_message_widget.appendTo(composition_node);
|
|
||||||
// return compose_done;
|
|
||||||
// },
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override-hack of do_action: automatically reload the chatter.
|
* Override-hack of do_action: automatically reload the chatter.
|
||||||
* Normally it should be called only when clicking on 'Post/Send'
|
* Normally it should be called only when clicking on 'Post/Send'
|
||||||
* in the composition form. */
|
* in the composition form. */
|
||||||
|
//TDE: still useful ? TO CHECK
|
||||||
do_action: function(action, on_close) {
|
do_action: function(action, on_close) {
|
||||||
if (this.compose_message_widget) {
|
if (this.compose_message_widget) {
|
||||||
this.compose_message_widget.reinit(); }
|
this.compose_message_widget.reinit(); }
|
||||||
|
@ -844,16 +829,6 @@ openerp.mail = function(session) {
|
||||||
return this._super(action, on_close);
|
return this._super(action, on_close);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TDE: move to thread
|
|
||||||
// /** Bind events */
|
|
||||||
// bind_events: function () {
|
|
||||||
// var self = this;
|
|
||||||
// // Click on 'show more'
|
|
||||||
// this.$element.find('button.oe_mail_wall_button_more').click(function () {
|
|
||||||
// return self.do_fetch_more();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the mail.message search view
|
* Load the mail.message search view
|
||||||
* @param {Object} defaults ??
|
* @param {Object} defaults ??
|
||||||
|
@ -895,23 +870,6 @@ openerp.mail = function(session) {
|
||||||
this.$element.find('ul.oe_mail_wall_threads').empty();
|
this.$element.find('ul.oe_mail_wall_threads').empty();
|
||||||
},
|
},
|
||||||
|
|
||||||
// TDE: move to thread
|
|
||||||
// /** Fetch messages
|
|
||||||
// * @param {Array} domain
|
|
||||||
// * @param {Array} context
|
|
||||||
// */
|
|
||||||
// message_fetch: function (additional_domain, additional_context) {
|
|
||||||
// this.search['domain'] = _.union(this.options.domain, this.search_results.domain);
|
|
||||||
// this.search['context'] = _.extend(this.options.context, this.search_results.context);
|
|
||||||
// if (additional_domain) var fetch_domain = this.search['domain'].concat(additional_domain);
|
|
||||||
// else var fetch_domain = this.search['domain'];
|
|
||||||
// if (additional_context) var fetch_context = _.extend(this.search['context'], additional_context);
|
|
||||||
// else var fetch_context = this.search['context'];
|
|
||||||
// return this.ds_msg.call('message_read',
|
|
||||||
// [false, fetch_domain, this.options.thread_level, fetch_context]
|
|
||||||
// ).then(this.proxy('display_comments'));
|
|
||||||
// },
|
|
||||||
|
|
||||||
/** Display comments
|
/** Display comments
|
||||||
* @param {Array} records tree structure of records
|
* @param {Array} records tree structure of records
|
||||||
*/
|
*/
|
||||||
|
@ -929,57 +887,5 @@ openerp.mail = function(session) {
|
||||||
thread.appendTo(this.$element.find('li.oe_mail_wall_thread:last'));
|
thread.appendTo(this.$element.find('li.oe_mail_wall_thread:last'));
|
||||||
this.thread_list.push(thread);
|
this.thread_list.push(thread);
|
||||||
},
|
},
|
||||||
|
|
||||||
// TDE: move to thread
|
|
||||||
// /** Display comments
|
|
||||||
// * @param {Array} records tree structure of records
|
|
||||||
// */
|
|
||||||
// display_comments: function (records) {
|
|
||||||
// console.log(records);
|
|
||||||
// // debugger
|
|
||||||
// var self = this;
|
|
||||||
// var _expendable = false;
|
|
||||||
// _(records).each(function (root_record) {
|
|
||||||
// /* expandable type: add a 'Show more button' */
|
|
||||||
// if (root_record.type == 'expandable') {
|
|
||||||
// _expendable = true;
|
|
||||||
// self.update_fetch_more(true);
|
|
||||||
// self.fetch_more_domain = root_record.domain;
|
|
||||||
// self.fetch_more_context = root_record.context;
|
|
||||||
// }
|
|
||||||
// // display classic root record
|
|
||||||
// else {
|
|
||||||
// var render_res = session.web.qweb.render('mail.wall_thread_container', {});
|
|
||||||
// $('<li class="oe_mail_wall_thread">').html(render_res).appendTo(self.$element.find('ul.oe_mail_wall_threads'));
|
|
||||||
// var thread = new mail.Thread(self, {
|
|
||||||
// 'res_model': root_record.model, 'res_id': root_record.res_id,
|
|
||||||
// 'uid': self.session.uid, 'records': [root_record],
|
|
||||||
// 'parent_id': false, 'thread_level': self.options.thread_level,
|
|
||||||
// 'show_hide': true, 'is_wall': true
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// self.thread_list.push(thread);
|
|
||||||
// thread.appendTo(self.$element.find('li.oe_mail_wall_thread:last'));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// if (! _expendable) {
|
|
||||||
// self.update_fetch_more(false);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
// TDE: move to thread
|
|
||||||
// /** Display 'show more' button */
|
|
||||||
// update_fetch_more: function (new_value) {
|
|
||||||
// if (new_value) {
|
|
||||||
// this.$element.find('div.oe_mail_wall_more:last').show();
|
|
||||||
// } else {
|
|
||||||
// this.$element.find('div.oe_mail_wall_more:last').hide();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
// /** Action: 'shows more' to fetch new messages */
|
|
||||||
// do_fetch_more: function () {
|
|
||||||
// return this.message_fetch(this.fetch_more_domain, this.fetch_more_context);
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,19 +28,9 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="oe_mail_wall_main">
|
<div class="oe_mail_wall_main">
|
||||||
<!-- TDe: delegated to thread -->
|
|
||||||
<!-- <div class="oe_mail_wall_action"> -->
|
|
||||||
<!-- call the composition form -->
|
|
||||||
<!-- <t t-call ="mail.compose_message"/>
|
|
||||||
</div>
|
|
||||||
<div class="oe_clear"/> -->
|
|
||||||
<ul class="oe_mail_wall_threads">
|
<ul class="oe_mail_wall_threads">
|
||||||
<!-- contains threads -->
|
<!-- contains threads -->
|
||||||
</ul>
|
</ul>
|
||||||
<!-- TDE: delegated to thread -->
|
|
||||||
<!-- <div class="oe_mail_wall_more">
|
|
||||||
<button class="oe_mail_wall_button_more" type="button">See more...</button>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_mail_wall_aside">
|
<div class="oe_mail_wall_aside">
|
||||||
<!-- contains currently nothing -->
|
<!-- contains currently nothing -->
|
||||||
|
|
Loading…
Reference in New Issue