From c8e5450ba3a0976b84777a89b4e1142abbf7af13 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 21 Jun 2012 14:48:43 +0200 Subject: [PATCH] [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 --- addons/mail/static/src/css/mail.css | 78 ++++------------------------- addons/mail/static/src/js/mail.js | 14 +++--- addons/mail/static/src/xml/mail.xml | 31 ++++++------ 3 files changed, 34 insertions(+), 89 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 2a253154fde..41f1331ef6f 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -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; } - - - diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index cbc3ef518bc..9b209c137a2 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -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('
'); + self.$element.find('.oe_mail_thread_msg:last').append('
'); 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', {}); - $('
').html(render_res).appendTo(self.$element.find('div.oe_mail_wall_threads')); + $('
  • ').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']); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index fe371de5728..a5d669a4f00 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -15,8 +15,8 @@
  • -
    -
    +
      +
    @@ -57,7 +57,7 @@
    -
  • +
    @@ -66,22 +66,23 @@
    -
  • +
    - B - +