diff options
| author | Paramjit Singh Sahota <psa@tinyerp.com> | 2013-03-14 15:59:49 +0530 |
|---|---|---|
| committer | Paramjit Singh Sahota <psa@tinyerp.com> | 2013-03-14 15:59:49 +0530 |
| commit | 0b62a6858f52a6d2e3edfaabdb64a71d2e0686fa (patch) | |
| tree | 9f59a04bebbd1bf30aa10ad92ebd8c8ac123c0d4 /addons/mail/static/src | |
| parent | b1ae53e40e84fcc74bb5d60eb10a7ac2d03482da (diff) | |
[IMP] 1) Added code for opening the dialog box of edit followers,
2) Added an image in the mail.message.subtype template which is visible when the Technical Features menu is selected true .
3) On clicking on the edit pencil which is with the followers name gives the subtypes of the specific followers on which the user had clicked rather than the current form.
bzr revid: psa@tinyerp.com-20130314102949-4v9l6xpz5u1jeq10
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/mail_followers.js | 59 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail_followers.xml | 3 |
2 files changed, 57 insertions, 5 deletions
diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 5c6d3bc3347..031aeddb7d7 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -80,22 +80,72 @@ openerp_mail_followers = function(session, mail) { this.$el.on('click', '.oe_show_more', self.on_show_more_followers) }, - on_edit_subtype: function() { + on_edit_subtype: function(event) { var self = this; + var records = []; + var partner_id = $(event.target).data('id'); + var id = this.view.datarecord.id; + var res_model = this.view.dataset.model; + console.log('thissssssssssssssss>>', this, id, partner_id); + var $dialog = session.web.dialog($('<div>'), { + modal: true, + title: partner_id, + buttons: [ + {text: _t("Apply"), click: function() { + // self.apply_subtype(id, partner_id); + $(this).dialog("close"); + } + }, + {text: _t("Cancel"), click: function() { $(this).dialog("close"); }} + ], + }); + this.ds_model.call('edit_followers_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) + .then(function (data) { + // console.log('then>>>>>', data, id, partner_id); + if (data[id]) { + records = data[id].message_subtype_data; + // console.log('records........', records); + } + _(records).each(function (record, record_name) { + record.name = record_name; + record.followed = record.followed || undefined; + console.log('record??????????????', record); + $(session.web.qweb.render("mail.followers.subtype", {'record': record})).appendTo($dialog); + }); + }); + + /* var partner_id = $(event.target).data('id'); + var context = new session.web.CompoundContext(this.build_context(), {}); + var action = { type: 'ir.actions.act_window', - res_model: 'mail.message.subtype', + res_model: 'mail.message.subtype', //'subtype.edit.wizard', domain: [['res_model','=', self.view.model]], view_mode: 'list', view_type: 'list', views: [[false, 'list']], target: 'new', + context: { + 'res_model': this.view.dataset.model, + 'res_id': this.view.datarecord.id, + 'partner_id': partner_id, + }, } + this.do_action(action, { on_close: function() { self.read_value(); }, - }); + });*/ + + }, + + apply_subtype: function(id, partner_id) { + console.log('id>>>partner_id>>> ', id, partner_id); + this.ds_model.call('apply_subtype', [[id], [partner_id], new session.web.CompoundContext(this.build_context(), {})]) + .then(function (data) { + console.log('dataaaaaaaaaaaaa', data); + }); }, on_invite_follower: function (event) { @@ -154,7 +204,7 @@ openerp_mail_followers = function(session, mail) { .then(this.proxy('check_group_tech_feature')); }, - check_group_tech_feature: function(){ + check_group_tech_feature: function() { var self = this; var edit_subtypes = new session.web.Model("res.groups"); edit_subtypes.query(["name","users"]) @@ -276,6 +326,7 @@ openerp_mail_followers = function(session, mail) { .then(this.proxy('read_value')); _.each(this.$('.oe_subtype_list input'), function (record) { + console.log('do follow>', record); $(record).attr('checked', 'checked'); }); }, diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index 18404c4ec05..7721b1beb22 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -32,7 +32,8 @@ <div t-name="mail.followers.partner" class='oe_partner'> <img class="oe_mail_thumbnail oe_mail_frame" t-attf-src="{record.avatar_url}"/> <a t-attf-href="#model=res.partner&id=#{record.id}"><t t-raw="record.name"/></a> - <img t-if="widget.check_access" class="oe_edit_subtype" t-att-src='_s + "/mail/static/src/img/icon-edit.gif"' title="Edit Subtype" t-att-data-id="record.id"/> + <!--t t-js="ab">console.log(':::::::::::;', ab);</t--> + <img class="oe_edit_subtype" t-att-src='_s + "/mail/static/src/img/icon-edit.gif"' title="Edit Subtype" t-att-data-id="record.id"/> <span t-if="widget.view_is_editable" class="oe_remove_follower oe_e" title="Remove this follower" t-att-data-id="record.id">X</span> </div> |
