[IMP] Chatter widgets: cleaned some name and templates, added some comments, cleaned a bit the draft of sending message embedded form view.
bzr revid: tde@openerp.com-20120615083656-mdyl8c49htxr5hq9
This commit is contained in:
@@ -9,6 +9,17 @@
|
||||
background: white;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_wall_main {
|
||||
float: left;
|
||||
width: 560px;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_wall_aside {
|
||||
margin-left: 565px;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_wall_act {
|
||||
padding: 8px;
|
||||
background: #eee;
|
||||
@@ -21,18 +32,6 @@
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* 2 columns view */
|
||||
.openerp div.oe_mail_wall_left {
|
||||
float: left;
|
||||
width: 560px;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_wall_right {
|
||||
margin-left: 565px;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_wall_threads {
|
||||
margin-top: 8px;
|
||||
}
|
||||
@@ -86,6 +85,16 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_recthread_main {
|
||||
float: left;
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_recthread_aside {
|
||||
float: right;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
/* Left-side CSS */
|
||||
.openerp div.oe_mail_recthread_actions {
|
||||
margin-bottom: 8px;
|
||||
@@ -101,17 +110,6 @@
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
/* RecordThread: 2 columns view */
|
||||
.openerp div.oe_mail_recthread_left {
|
||||
float: left;
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_recthread_right {
|
||||
float: right;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.openerp div.oe_mail_recthread_actions button {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ openerp.mail = function(session) {
|
||||
var mail = session.mail = {};
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------
|
||||
* Global variables for the Chatter
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -21,72 +24,78 @@ openerp.mail = function(session) {
|
||||
var mail_msg_struct = mail.chatter_message_structure = {}; // TODO: USE IT OR NOT :)
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------
|
||||
* ComposeMessage widget
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
* This widget handles the display of a form to compose a new message.
|
||||
* This form is an OpenERP form_view, build on a mail.compose.message
|
||||
* wizard.
|
||||
*/
|
||||
|
||||
/* Add ComposeMessage widget to registry */
|
||||
session.web.form.widgets.add('compose_message', 'openerp.mail.ComposeMessage');
|
||||
session.web.form.widgets.add('mail.compose_message', 'openerp.mail.ComposeMessage');
|
||||
|
||||
/* ComposeMessage is an extension of a Widget */
|
||||
mail.compose_message = session.web.Widget.extend({
|
||||
mail.ComposeMessage = session.web.Widget.extend({
|
||||
template: 'mail.compose_message',
|
||||
|
||||
init: function(parent, params) {
|
||||
this._super(parent);
|
||||
console.log(params);
|
||||
this.ds_compose = new session.web.DataSetSearch(this, 'mail.compose.message');
|
||||
this.form_view = new session.web.FormView(this, this.ds_compose, false, {
|
||||
/*action_buttons: false,
|
||||
pager: false,*/
|
||||
action_buttons: false,
|
||||
pager: false,
|
||||
initial_mode: 'edit',
|
||||
}
|
||||
);
|
||||
this.form_view.on_button_cancel = function() {
|
||||
console.log('cacaprout');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* widget start function
|
||||
* - builds and initializes the form view
|
||||
*/
|
||||
start: function(parent, params) {
|
||||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
console.log('start');
|
||||
console.log(this);
|
||||
var node = this.$element.find('div.caca');
|
||||
var node = this.$element.find('p');
|
||||
console.log(node);
|
||||
return $.when(this.form_view.appendTo(node)).pipe(function() {
|
||||
var main_node = this.$element;
|
||||
|
||||
return $.when(this.form_view.appendTo(main_node)).pipe(function() {
|
||||
self.form_view.do_show();
|
||||
//self.form_view.on_button_cancel = function() {
|
||||
//console.log('cacaprout');
|
||||
//};
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function(parent, params) {
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
//on_button_cancel: function() {
|
||||
//console.log('boudin noir');
|
||||
//},
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Thread widget: this widget handles the display of a thread of
|
||||
* messages. The [thread_level] parameter sets the thread level number:
|
||||
* ------------------------------------------------------------
|
||||
* Thread Widget
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
* This widget handles the display of a thread of messages. The
|
||||
* [thread_level] parameter sets the thread level number:
|
||||
* - root message
|
||||
* - - sub message (parent_id = root message)
|
||||
* - - - sub sub message (parent id = sub message)
|
||||
* - - sub message (parent_id = root message)
|
||||
* This widget has 2 ways of initialization, either you give records to be rendered,
|
||||
* either it will fetch [limit] messages related to [res_model]:[res_id].
|
||||
* This widget has 2 ways of initialization, either you give records
|
||||
* to be rendered, either it will fetch [limit] messages related to
|
||||
* [res_model]:[res_id].
|
||||
*/
|
||||
|
||||
/* Add ThreadDisplay widget to registry */
|
||||
session.web.form.widgets.add( 'Thread', 'openerp.mail.Thread');
|
||||
session.web.form.widgets.add('Thread', 'openerp.mail.Thread');
|
||||
|
||||
/* Thread is an extension of a Widget */
|
||||
mail.Thread = session.web.Widget.extend({
|
||||
@@ -147,11 +156,11 @@ openerp.mail = function(session) {
|
||||
// customize display
|
||||
$.when(display_done).then(this.proxy('do_customize_display'));
|
||||
|
||||
// add form view
|
||||
this.caca = new mail.compose_message();
|
||||
this.caca.appendTo(this.$element.find('div.oe_mail_thread_act'));
|
||||
// add message composition form view
|
||||
this.compose_message = new mail.ComposeMessage();
|
||||
var compose_done = this.compose_message.appendTo(this.$element.find('div.oe_mail_thread_act'));
|
||||
|
||||
return display_done
|
||||
return display_done && compose_done;
|
||||
},
|
||||
|
||||
do_customize_display: function() {
|
||||
@@ -503,14 +512,29 @@ openerp.mail = function(session) {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------
|
||||
* mail_thread Widget
|
||||
* ------------------------------------------------------------
|
||||
*
|
||||
* This widget handles the display of a thread of messages. The
|
||||
* [thread_level] parameter sets the thread level number:
|
||||
* - root message
|
||||
* - - sub message (parent_id = root message)
|
||||
* - - - sub sub message (parent id = sub message)
|
||||
* - - sub message (parent_id = root message)
|
||||
* This widget has 2 ways of initialization, either you give records
|
||||
* to be rendered, either it will fetch [limit] messages related to
|
||||
* [res_model]:[res_id].
|
||||
*/
|
||||
|
||||
/* Add ThreadView widget to registry */
|
||||
session.web.form.widgets.add( 'ThreadView', 'openerp.mail.RecordThread');
|
||||
// session.web.page.readonly.add( 'ThreadView', 'openerp.mail.RecordThread');
|
||||
session.web.form.widgets.add('ThreadView', 'openerp.mail.RecordThread');
|
||||
|
||||
/* ThreadView widget: thread of comments */
|
||||
mail.RecordThread = session.web.form.AbstractField.extend({
|
||||
// QWeb template to use when rendering the object
|
||||
template: 'RecordThread',
|
||||
template: 'mail.record_thread',
|
||||
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
@@ -556,11 +580,11 @@ openerp.mail = function(session) {
|
||||
// fetch followers
|
||||
var fetch_sub_done = this.fetch_subscribers();
|
||||
// create and render Thread widget
|
||||
this.$element.find('div.oe_mail_recthread_left').empty();
|
||||
this.$element.find('div.oe_mail_recthread_main').empty();
|
||||
if (this.thread) this.thread.destroy();
|
||||
this.thread = new mail.Thread(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid,
|
||||
'thread_level': this.params.thread_level, 'show_post_comment': true, 'limit': 15});
|
||||
var thread_done = this.thread.appendTo(this.$element.find('div.oe_mail_recthread_left'));
|
||||
var thread_done = this.thread.appendTo(this.$element.find('div.oe_mail_recthread_main'));
|
||||
return fetch_sub_done && thread_done;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,37 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
|
||||
<div t-name="Wall" class="oe_mail_wall">
|
||||
<!--
|
||||
wall main template
|
||||
Template used to display the communication history in the
|
||||
wall.
|
||||
-->
|
||||
<div t-name="mail.wall" class="oe_mail_wall">
|
||||
<table class="oe_view_manager_header">
|
||||
<tr class="oe_header_row">
|
||||
<td><h2 class="oe_view_title">All Feeds</h2></td>
|
||||
<td><div class="oe_view_manager_view_search" t-opentag="true"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="oe_mail_wall_left">
|
||||
<div class="oe_mail_wall_main">
|
||||
<div class="oe_mail_wall_act">
|
||||
<img class="oe_mail_msg_image oe_left" alt="User img"/>
|
||||
<textarea class="oe_mail oe_mail_wall_action_textarea" placeholder="What are you working on?"/>
|
||||
<button class="oe_right oe_mail_wall_button_comment" type="button">Post comment</button>
|
||||
</div>
|
||||
<div class="oe_clear"></div>
|
||||
<div class="oe_clear"/>
|
||||
<div class="oe_mail_wall_threads">
|
||||
<!-- contains threads -->
|
||||
</div>
|
||||
<div class="oe_mail_wall_more">
|
||||
<button class="oe_mail_wall_button_more" type="button">See more discussions</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_mail_wall_right"></div>
|
||||
<div class="oe_mail_wall_aside">
|
||||
<!-- contains currently nothing -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t t-name="WallThreadContainer">
|
||||
<!--
|
||||
thread_container template for the wall
|
||||
Each discussion thread is be contained inside this template
|
||||
-->
|
||||
<t t-name="mail.wall.thread_container">
|
||||
</t>
|
||||
|
||||
<div t-name="RecordThread" class="oe_mail_recthread">
|
||||
<!--
|
||||
record_thread main template
|
||||
Template used to display the communciation history in documents
|
||||
form view.
|
||||
-->
|
||||
<div t-name="mail.record_thread" class="oe_mail_recthread">
|
||||
<h4>History and Comments</h4>
|
||||
<div class="oe_mail_recthread_left">
|
||||
<div class="oe_mail_recthread_main">
|
||||
<!-- contains the document thread -->
|
||||
</div>
|
||||
<div class="oe_mail_recthread_right">
|
||||
<div class="oe_mail_recthread_aside">
|
||||
<div class="oe_mail_recthread_actions">
|
||||
<button type="button" class="oe_mail_button_follow oe_mail_button_mouseout">Not following</button>
|
||||
<button type="button" class="oe_mail_button_unfollow oe_mail_button_mouseout">Following</button>
|
||||
@@ -44,9 +62,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
compose_message template
|
||||
This template holds the composition form to write a note or send
|
||||
an e-mail.
|
||||
-->
|
||||
<t t-name="mail.compose_message">
|
||||
<div class="caca"><p>cacaproutboudin</p>
|
||||
<div class="oe_mail_compose_message">
|
||||
<!-- contains the composition form -->
|
||||
</div>
|
||||
<div class="oe_clear"/>
|
||||
</t>
|
||||
|
||||
<ul t-name="Thread" class="oe_mail oe_mail_thread">
|
||||
|
||||
Reference in New Issue
Block a user