[IMP] use the default openerp dropdown menu implementation.

also improve markup (ul.oe_mail_wall_threads is now a list of li.oe_mail_wall_thread)
more markup and css improvements to come

bzr revid: abo@openerp.com-20120621124843-klk1oy2rxdcd08uh
This commit is contained in:
Antonin Bourguignon 2012-06-21 14:48:43 +02:00
parent db6a717716
commit c8e5450ba3
3 changed files with 34 additions and 89 deletions

View File

@ -170,7 +170,7 @@
margin-left: 66px;
}
.openerp div.oe_mail_thread_subthread li.oe_mail_thread_msg:last-child {
.openerp div.oe_mail_thread_subthread .oe_mail_thread_msg:last-child {
margin-bottom: 8px;
}
@ -179,13 +179,13 @@
border-bottom: 1px solid #D2D9E7;
}
.openerp li.oe_mail_thread_msg:after {
.openerp .oe_mail_thread_msg:after {
content: "";
display: block;
clear: both;
}
.openerp li.oe_mail_thread_msg > div:after {
.openerp .oe_mail_thread_msg > div:after {
content: "";
display: block;
clear: both;
@ -246,15 +246,6 @@
/* Styling (should be openerp) */
/* ------------------------------ */
.openerp ul.oe_mail {
padding: 0;
margin: 0;
}
.openerp li.oe_mail {
list-style-type: none;
}
.openerp input.oe_mail, textarea.oe_mail {
width: 432px;
padding: 4px;
@ -291,7 +282,7 @@
}
/* ------------------------------ */
/* New layouts' style */
/* Messages layout */
/* ------------------------------ */
.openerp .oe_mail_msg .oe_mail_msg_title {
@ -325,64 +316,20 @@
font-weight: bold;
}
/* Gear menu */
.openerp .oe_mail_msg_content a.oe_gear_menuaction {
/* Dropdown menu */
.openerp .oe_mail_msg_content .oe_dropdown_toggle {
position: absolute;
top: 0px;
right: 3px;
display: none;
color: #4c4c4c;
cursor: pointer;
}
.openerp .oe_mail_msg_content:hover .oe_gear_menuaction {
display: block;
.openerp .oe_mail_msg_content .oe_dropdown_arrow:after {
border-top: 4px solid transparent;
}
.openerp .oe_mail_msg_content a.oe_gear_menuaction:hover {
text-decoration: none;
}
.openerp .oe_mail_msg_content ul.oe_gear_menu {
list-style-type: none;
display: none;
position: absolute;
top: 30px;
right: -140px;
padding: 4px;
border: 1px solid #afafb6;
min-width: 160px;
overflow-x: hidden;
z-index: 900;
background: white;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.openerp .oe_mail_msg_content ul.oe_gear_menu > li {
float: none;
}
.openerp .oe_mail_msg_content .oe_gear_menu > li > a {
display: block;
padding: 3px 6px;
line-height: 14px;
color: #4c4c4c;
text-decoration: none;
}
.openerp .oe_mail_msg_content .oe_gear_menu > li > a:hover {
background: #f0f0fa;
background: -moz-linear-gradient(#f0f0fa, #eeeef6);
background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
background: -webkit-linear-gradient(#f0f0fa, #eeeef6);
-moz-box-shadow: none;
-webkit-box-shadow: none;
-box-shadow: none;
}
.openerp .oe_mail_msg_content .oe_gear_menu p {
margin-left: 12px;
.openerp .oe_mail_msg_content:hover .oe_dropdown_arrow:after {
border-top: 4px solid #404040;
}
/* Attachments */
/* Attachments list */
.openerp ul.oe_mail_msg_attachments {
display: none;
width: 100%;
@ -397,6 +344,3 @@
padding: 0;
list-style-type: square;
}

View File

@ -182,7 +182,7 @@ openerp.mail = function(session) {
var msg_id = event.srcElement.dataset.id;
if (! msg_id) return false;
var call_defer = self.ds_msg.unlink([parseInt(msg_id)]);
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).hide();
$(event.srcElement).parents('.oe_mail_thread_msg').eq(0).hide();
if (self.params.thread_level > 0) {
$(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide();
}
@ -196,9 +196,9 @@ openerp.mail = function(session) {
if (! msg_id) return false;
//console.log(msg_id);
var call_defer = self.ds.call('message_remove_pushed_notifications', [[self.params.res_id], [parseInt(msg_id)], true]);
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).hide();
$(event.srcElement).parents('.oe_mail_thread_msg').eq(0).hide();
if (self.params.thread_level > 0) {
$(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide();
$(event.srcElement).parents('.oe_mail_thread').eq(0).hide();
}
return false;
});
@ -300,7 +300,7 @@ openerp.mail = function(session) {
self.display_comment(record);
self.thread = new mail.Thread(self, {'res_model': self.params.res_model, 'res_id': self.params.res_id, 'uid': self.params.uid,
'records': sub_msgs, 'thread_level': (self.params.thread_level-1), 'parent_id': record.id});
self.$element.find('li.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>');
self.$element.find('.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>');
self.thread.appendTo(self.$element.find('div.oe_mail_thread_subthread:last'));
}
else if (self.params.thread_level == 0) {
@ -749,7 +749,7 @@ openerp.mail = function(session) {
this.search['context'] = _.extend(this.params.context, this.search_results.context);
this.display_show_more = true;
this.comments_structure = {'root_ids': [], 'new_root_ids': [], 'msgs': {}, 'tree_struct': {}, 'model_to_root_ids': {}};
this.$element.find('div.oe_mail_wall_threads').empty();
this.$element.find('ul.oe_mail_wall_threads').empty();
return this.fetch_comments(this.params.limit, 0);
},
@ -782,13 +782,13 @@ openerp.mail = function(session) {
var model_name = self.comments_structure.msgs[root_id]['model'];
var res_id = self.comments_structure.msgs[root_id]['res_id'];
var render_res = session.web.qweb.render('WallThreadContainer', {});
$('<div class="oe_mail_wall_thread">').html(render_res).appendTo(self.$element.find('div.oe_mail_wall_threads'));
$('<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': model_name, 'res_id': res_id, 'uid': self.session.uid, 'records': records,
'parent_id': false, 'thread_level': self.params.thread_level, 'show_hide': true}
);
self.thread_list.push(thread);
return thread.appendTo(self.$element.find('div.oe_mail_wall_thread:last'));
return thread.appendTo(self.$element.find('li.oe_mail_wall_thread:last'));
});
// update TODO
this.comments_structure['root_ids'] = _.union(this.comments_structure['root_ids'], this.comments_structure['new_root_ids']);

View File

@ -15,8 +15,8 @@
<button class="oe_right oe_mail_wall_button_comment" type="button">Post comment</button>
</div>
<div class="oe_clear"></div>
<div class="oe_mail_wall_threads">
</div>
<ul class="oe_mail_wall_threads">
</ul>
<div class="oe_mail_wall_more">
<button class="oe_mail_wall_button_more" type="button">See more discussions</button>
</div>
@ -57,7 +57,7 @@
</div>
<!-- default layout -->
<li t-name="mail.Thread.default" t-attf-class="oe_mail oe_mail_thread_msg">
<div t-name="mail.Thread.default" class="oe_mail oe_mail_thread_msg">
<div t-attf-class="oe_mail_msg_#{record.type}">
<img t-if="record.type == 'email'" class="oe_email_icon oe_left" src="/mail/static/src/img/email_icon.png"/>
<img t-if="record.type == 'notification' || record.type == 'comment'" class="oe_mail_msg_image oe_left" t-att-src="record.mini_url"/>
@ -66,22 +66,23 @@
</div>
<t t-if="record.type == 'tmp'"><t t-call="mail.Thread.default.ThreadDisplay"/></t>
</div>
</li>
</div>
<t t-name="mail.Thread.default.NoteDisplay">
<a class="oe_gear_menuaction oe_i">B</a>
<ul class="oe_gear_menu">
<t t-if="display['show_delete']">
<t t-if="thread._is_author(record.user_id[0])">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete">Delete</a></li>
<span class="oe_dropdown_toggle oe_dropdown_arrow">
<ul class="oe_dropdown_menu">
<t t-if="display['show_delete']">
<t t-if="thread._is_author(record.user_id[0])">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete">Delete</a></li>
</t>
</t>
</t>
<t t-if="display['show_hide']">
<t t-if="!(thread._is_author(record.user_id[0]))">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a></li>
<t t-if="display['show_hide']">
<t t-if="!(thread._is_author(record.user_id[0]))">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a></li>
</t>
</t>
</t>
</ul>
</ul>
</span>
<div class="oe_mail_msg">
<t t-if="record.subject">