Nimesh Contractor(Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-checklist_improvement-nco
into lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp.
Requested reviews:
Atul Patel(OpenERP) (atp-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-checklist_improvement-nco/+merge/109794
Hello sir,
I have done following changes.
1) Instead of open a dialogue box, add a text field in the comment.
2) Instead of check-list image put the link "Add Checklist".
3) change the relative css.
4) Add the tool tip.
Thanks,
NCO.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp-checklist_improvement-nco/+merge/109794
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-open-chatter-part-4-atp.
=== 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:17:40 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
img.oe_mail_vote_image
{
width: 20px;
@@ -47,4 +48,53 @@
width:220px;
height:4px;
-}
\ No newline at end of file
+}=======
+img.oe_mail_vote_image
+{
+ width: 20px;
+ height: 18px;
+ margin: -5px;
+ position: relative;
+}
+
+span.oe_mail_vote_span
+{
+ position: relative;
+ margin: 2%;
+}
+
+.openerp div.oe_mail_thread_subthread img
+{
+ width: 20px;
+ height: 18px;
+ margin: -5px;
+ position: relative;
+}
+
+.openerp .oe_checklist{
+ padding : 9px;
+ width: 18px;
+ height: 18px;
+ margin-bottom: -15px;
+ cursor:pointer;
+}
+.openerp div.oe_mail_thread_subthread a.oe_checklist
+{
+ padding : 9px;
+ width: 18px;
+ height: 18px;
+ margin-bottom: -15px;
+ cursor:pointer;
+}
+
+.openerp .oe_strike_checkbox {
+ color:#666362;
+ text-decoration:line-through;
+}
+
+.openerp .oe_progressbar {
+
+ background-color:white;
+ width:220px;
+ height:4px;
+}>>>>>>> MERGE-SOURCE
=== 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:17:40 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
openerp.mail_extra = function(session){
var QWeb = session.web.qweb;
var _t = session.web._t;
@@ -132,3 +133,140 @@
});
}
+=======
+openerp.mail_extra = function(session){
+ var QWeb = session.web.qweb;
+ var _t = session.web._t;
+ session.mail.Thread.include({
+ add_checklist_event: function(){
+ var self = this;
+ this.$element.find('a.oe_checklist').click(function(){
+ self.do_display_checklist($(this).attr('data-id'));
+ });
+ },
+ add_vote_event: function(element){
+ vote_img = element.find('.oe_mail_msg_vote_like');
+ self = this;
+ if (vote_img)
+ vote_img.click(function(){
+ self.subscribe_vote($(this).attr('data-id'));
+ });
+ return
+
+ },
+
+ render_vote: function(message_id){
+ var self = this;
+ this.mail_message = new session.web.DataSet(this, 'mail.message');
+ 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));
+ }
+ });
+ },
+
+ subscribe_vote: function(message_id){
+ 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);
+ });
+ },
+ display_comments: function(records){
+ res = this._super(records);
+ var self = this;
+ _.each(records, function(record){
+ self.render_vote(record.id);
+ self.render_checklist_items(record.id);
+ });
+ self.add_checklist_event();
+ },
+ do_display_checklist: function (message_id) {
+ var self=this;
+ parent_element = self.find_parent_element(".oe_mail_msg_checklist", message_id);
+ var new_item = $(QWeb.render("AddChecklist", {}));
+ $(parent_element).after(new_item);
+ new_item.find('input[type=text]').keyup(function (event) {
+ var charCode = (event.which) ? event.which : window.event.keyCode;
+ if (charCode == 13) {
+ value = $(this).val();
+ (value != "") ? self.add_checkitem(value, message_id, new_item) : new_item.remove();
+ }
+ });
+ },
+
+ add_checkitem: function(value, message_id, item_element){
+ this.mail_message = new session.web.DataSet(this, 'mail.message');
+ if(!_.isEmpty(value)){
+ this.mail_message.call('add_checklist_item', [message_id,value]).done(function(result){
+ self.render_checklist_items(message_id);
+ item_element.remove();
+ });
+ }
+ },
+
+ find_parent_element: function(name, message_id){
+ parent_element = false;
+ _.each($(name), function(element){
+ if ($(element).attr("data-id") == message_id){
+ parent_element = element;
+ }
+ });
+ return parent_element;
+ },
+ calculate_checklist_progress: function(items){
+ if (items.length == 0) return 0;
+ total_checklist_items = items.length;
+ done_checklist_items = 0;
+ checklist_progress = 0;
+ _.each(items, function(record){
+ if (record.done == true)
+ done_checklist_items+=1;
+ });
+ checklist_progress = Math.round((done_checklist_items *100)/total_checklist_items);
+ return checklist_progress;
+ },
+ render_checklist_items: function(message_id){
+ var self = this;
+ this.mail_message = new session.web.DataSet(this, 'mail.message');
+ this.mail_message.call('get_checklist_items',[parseInt(message_id)]).then(function(result){
+ if (result.length){
+ checklist_progress = self.calculate_checklist_progress(result);
+ parent_element = self.find_parent_element(".oe_mail_msg_checklist", message_id);
+ checklist_element = QWeb.render('ChecklistItem', {'msg_id': message_id, 'checklist_progress':checklist_progress, 'checklist_items': result});
+ $(parent_element).html(checklist_element);
+ $(parent_element).find(".oe_mail_msg_checklist_item").click(function(){
+ self.do_strike_checkbox_item(message_id, $(this));
+ });
+ }
+ });
+ },
+
+ // Strike and unstrike the checklist item.
+ do_strike_checkbox_item: function(message_id, item){
+ check_item_id = item.attr("data-id");
+ parent = item.parent();
+ checked = item.attr("checked");
+ self = this;
+ mail_checklist_item = new session.web.DataSet(this, 'mail.checklist.item');
+ mail_checklist_item.call('action_done', [parseInt(check_item_id), checked]).then(function (result) {
+ checklist_progress = self.calculate_checklist_progress(result);
+ progresselement = $(self.find_parent_element(".oe_mail_msg_checklist_progress", message_id));
+ progresselement.find('.oe_mail_msg_checklist_progress_value').html(checklist_progress + "%");
+ progresselement.find('.oe_progressbar').attr("value", checklist_progress);
+ if (checked == "checked"){
+ parent.addClass('oe_strike_checkbox');
+ }else
+ parent.removeClass('oe_strike_checkbox');
+ });
+
+ },
+
+ });
+}
+>>>>>>> MERGE-SOURCE
=== 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:17:40 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
@@ -58,3 +59,66 @@
</t>
</t>
</templates>
+=======
+<?xml version="1.0" encoding="UTF-8"?>
+
+<templates id="template" xml:space="preserve">
+
+ <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>
+ <a class="oe_checklist" t-att-data-id="record.id" title="Add items in the checklist and track work progress.">Add Checklist</a>
+ </t>
+ </t>
+ </t>
+
+ <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_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>
+
+ </t>
+
+ <t t-extend="NoteDisplay">
+ <t t-jquery=".oe_mail_msg_body" t-operation="append">
+ <div t-att-data-id="record.id" class="oe_mail_msg_checklist">
+ </div>
+ </t>
+ </t>
+
+ <div t-name = "AddChecklist" class="oe_mail_msg_checklist_new">
+ <input type="checkbox" class="oe_mail_msg_checklist_item"/>
+ <input type="text" id = "txt_name" size = "10"></input>
+ </div>
+
+ <t t-name="ChecklistItem">
+ <t t-if="checklist_items.length != 0">
+ <span class="oe_mail_msg_checklist_progress" t-att-data-id="msg_id">
+ <progress t-att-value='checklist_progress' class="oe_progressbar" max="100"/>
+ <span class="oe_mail_msg_checklist_progress_value"><t t-esc = "checklist_progress"/>%</span> <br/>
+ </span>
+
+ <t t-foreach="checklist_items" t-as="checklist_item">
+ <t t-if="checklist_item.done == true">
+ <span class="oe_strike_checkbox">
+ <input t-att-data-id='checklist_item.id' class="oe_mail_msg_checklist_item" type="checkbox" checked="checked" t-att-value="checklist_item.done" /><t t-esc="checklist_item.name" />
+ </span>
+ </t>
+
+ <t t-if="checklist_item.done == false">
+ <span>
+ <input t-att-data-id='checklist_item.id' type="checkbox" class="oe_mail_msg_checklist_item" t-att-value="checklist_item.done"/><t t-esc="checklist_item.name" />
+ </span>
+ </t>
+ <br/>
+ </t>
+ </t>
+ </t>
+</templates>
+>>>>>>> MERGE-SOURCE
_______________________________________________
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