Bharat Devnani (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-vote-improvement-bde
into lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-vote-improvement-bde/+merge/109798
Hello Sir,
I have added unvote functionality and also improved
the design of the same feature.
Thanks & Regards,
Devnani Bharat R.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-vote-improvement-bde/+merge/109798
Your team OpenERP R&D Team is requested to review the proposed merge of
lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-vote-improvement-bde
into lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp.
=== modified file 'mail_extra/mail_vote.py'
--- mail_extra/mail_vote.py 2012-06-07 13:53:30 +0000
+++ mail_extra/mail_vote.py 2012-06-12 10:25:31 +0000
@@ -58,6 +58,8 @@
voters_id = vote_pool.search(cr, uid, [('msg_id', '=', message_id), ('user_id', '=', uid)], context=context)
if not voters_id:
new_vote_id = vote_pool.create(cr, uid, {'msg_id': message_id, 'user_id': uid}, context=context)
+ else:
+ vote_pool.unlink(cr, uid, voters_id, context=context)
if message.vote_ids:
vote_count = len(message.vote_ids)
return vote_count
=== modified file 'mail_extra/security/ir.model.access.csv'
--- mail_extra/security/ir.model.access.csv 2012-06-07 18:39:44 +0000
+++ mail_extra/security/ir.model.access.csv 2012-06-12 10:25:31 +0000
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_mail_vote,mail.vote,model_mail_vote,base.group_user,1,1,1,0
-access_mail_checklist_item,mail.checklist.item,model_mail_checklist_item,base.group_user,1,1,1,0
\ No newline at end of file
+access_mail_vote,mail.vote,model_mail_vote,base.group_user,1,1,1,1
+access_mail_checklist_item,mail.checklist.item,model_mail_checklist_item,base.group_user,1,1,1,0
=== modified file 'mail_extra/static/src/css/mail_extra.css'
--- mail_extra/static/src/css/mail_extra.css 2012-05-30 07:00:27 +0000
+++ mail_extra/static/src/css/mail_extra.css 2012-06-12 10:25:31 +0000
@@ -1,15 +1,8 @@
-img.oe_mail_vote_image
-{
- width: 20px;
- height: 18px;
- margin: -5px;
- position: relative;
-}
-
span.oe_mail_vote_span
{
position: relative;
- margin: 2%;
+ left: 2px;
+ bottom: -5px;
}
.openerp div.oe_mail_thread_subthread img
@@ -47,4 +40,30 @@
width:220px;
height:4px;
+}
+
+button.oe_mail_msg_vote_like{
+ height:25px;
+ width: 30px;
+ background: #2E2EFE;
+ position: relative;
+ bottom: -5px;
+ left: 10px;
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+}
+
+button.oe_mail_msg_vote_like:hover{
+ background: #2E2EFE;
+}
+
+button.oe_mail_msg_vote_like span {
+ color: white;
+ position: relative;
+ right: 2px;
+}
+
+span.oe_mail_vote_string{
+ position: relative;
+ bottom: -5px;
}
\ No newline at end of file
=== modified file 'mail_extra/static/src/js/mail_extra.js'
--- mail_extra/static/src/js/mail_extra.js 2012-06-07 18:39:44 +0000
+++ mail_extra/static/src/js/mail_extra.js 2012-06-12 10:25:31 +0000
@@ -17,7 +17,6 @@
self.subscribe_vote($(this).attr('data-id'));
});
return
-
},
render_vote: function(message_id){
@@ -26,7 +25,6 @@
this.mail_message.call('get_votes',[parseInt(message_id)]).then(function(result){
if (result){
parent_element = self.find_parent_element(".oe_mail_msg_vote", message_id);
- result.like = _t("Like");
vote_element = QWeb.render('VoteDisplay', result);
$(parent_element).html(vote_element);
self.add_vote_event($(parent_element));
@@ -38,8 +36,7 @@
var self = this;
this.mail_message = new session.web.DataSet(this, 'mail.message');
return this.mail_message.call('vote_subscribe', [parseInt(message_id)]).then(function(result){
- if(result)
- self.render_vote(message_id);
+ self.render_vote(message_id);
});
},
display_comments: function(records){
=== modified file 'mail_extra/static/src/xml/mail_extra.xml'
--- mail_extra/static/src/xml/mail_extra.xml 2012-06-08 04:48:11 +0000
+++ mail_extra/static/src/xml/mail_extra.xml 2012-06-12 10:25:31 +0000
@@ -5,6 +5,7 @@
<t t-extend="ThreadMsg">
<t t-jquery=".oe_mail_msg_content" t-operation="append">
<t t-if="record.type == 'comment'">
+ <br/>
<span t-att-data-id="record.id" class="oe_mail_msg_vote"></span>
<img class="oe_checklist_image" t-att-data-id="record.id" src="/web/static/src/img/icons/gtk-index.png" title="Add checklist items with progressbar on particular message"></img>
</t>
@@ -13,13 +14,19 @@
<t t-name="VoteDisplay">
<t t-if='vote_count'>
- <img src="/mail_extra/static/src/img/vote.gif" class="oe_mail_vote_image"></img>
+ <span class="oe_mail_vote_string">Votes :</span>
<span class="oe_mail_vote_span"><t t-esc="vote_count"/></span>
</t>
<t t-if="!is_vote_liked">
- <button class="oe_mail_msg_vote_like" t-att-data-id="msg_id"><t t-esc="like"/></button>
- </t>
-
+ <button class="oe_mail_msg_vote_like" t-att-data-id="msg_id">
+ <span>+1</span>
+ </button>
+ </t>
+ <t t-if="is_vote_liked">
+ <button class="oe_mail_msg_vote_like" t-att-data-id="msg_id" style="background:red;">
+ <span>-1</span>
+ </button>
+ </t>
</t>
<t t-extend="NoteDisplay">
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp