From cd4c3b6c913a42b32bd807ed5d411a7526a3430c Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 27 Jun 2012 16:13:52 +0200 Subject: [CHG] Ashes to ashes, dashes to underscores. bzr revid: fme@openerp.com-20120627141352-7a6d23iebv03rcv3 --- addons/share/static/src/js/share.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'addons/share/static/src/js/share.js') diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index 3563a4bb859..e88616546a3 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -58,7 +58,7 @@ openerp.share = function(session) { self.add_items('other', [{ label: 'Share', callback: self.on_sidebar_click_share, - classname: 'oe-share', + classname: 'oe_share', }]); }); }, @@ -72,7 +72,7 @@ openerp.share = function(session) { start: function() { start_res = this._super.apply(this, arguments); if (has_action_id) { - this.$element.find('button.oe-share-mail').show(); + this.$element.find('button.oe_share_mail').show(); } return start_res; } @@ -83,12 +83,12 @@ openerp.share = function(session) { var self = this; this.check_if_action_is_defined(); has_share(function() { - self.$element.find('a.oe-share_link').click(self.on_click_share_link); - self.$element.find('a.oe-share').click(self.on_click_share); - self.$element.delegate('button.oe-share-mail', 'click', self.on_click_share_mail); + self.$element.find('a.oe_share_link').click(self.on_click_share_link); + self.$element.find('a.oe_share').click(self.on_click_share); + self.$element.delegate('button.oe_share_mail', 'click', self.on_click_share_mail); }, function() { - self.$element.find('a.oe-share_link').remove(); - self.$element.find('a.oe-share').remove(); + self.$element.find('a.oe_share_link').remove(); + self.$element.find('a.oe_share').remove(); }); return this._super.apply(this, arguments); }, @@ -96,8 +96,8 @@ openerp.share = function(session) { check_if_action_is_defined: function() { if (this.action && this.action.id) { has_action_id = true; - this.$element.find('a.oe-share_link').show(); - this.$element.find('a.oe-share').show(); + this.$element.find('a.oe_share_link').show(); + this.$element.find('a.oe_share').show(); } else { has_action_id = false; -- cgit v1.2.3 From 2cf2b9e92bf634f59eea1181f766f6d84987a044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 29 Jun 2012 10:06:07 +0200 Subject: [DOC] Share: added some comments. bzr revid: tde@openerp.com-20120629080607-5gyr8jsy1hb4jv15 --- addons/share/static/src/js/share.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'addons/share/static/src/js/share.js') diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index e88616546a3..380d2f3a8cf 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -68,6 +68,12 @@ openerp.share = function(session) { }, }); + /** + * Extends mail (Chatter widget) + * - show the 'invite' button' only we came on the form view through + * an action. We do this because 'invite' is based on the share + * mechanism, and it tries to share an action. + */ session.mail.RecordThread.include( { start: function() { start_res = this._super.apply(this, arguments); -- cgit v1.2.3 From 3060903c8c886eef78b023c95b37d47f9e04f34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 29 Jun 2012 14:25:30 +0200 Subject: [IMP] share: share and embed added to 'more' sidebar menu. bzr revid: tde@openerp.com-20120629122530-yyux1swdn4puem1l --- addons/share/static/src/js/share.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'addons/share/static/src/js/share.js') diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index 380d2f3a8cf..4d7c21a0957 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -50,18 +50,24 @@ openerp.share = function(session) { session.connection.share_flag.done(yes).fail(no); } + /* Extend the Sidebar to add Share and Embed links in the 'More' menu */ session.web.Sidebar = session.web.Sidebar.extend({ - add_default_sections: function() { - this._super(); + + start: function() { var self = this; + this._super(this); has_share(function() { - self.add_items('other', [{ - label: 'Share', - callback: self.on_sidebar_click_share, - classname: 'oe_share', - }]); + self.add_items('other', [ + { label: 'Share', + callback: self.on_sidebar_click_share, + classname: 'oe_chare' }, + { label: 'Embed', + callback: self.on_sidebar_click_share, + classname: 'oe_chare' }, + ]); }); }, + on_sidebar_click_share: function(item) { var view = this.getParent() launch_wizard(this, view); -- cgit v1.2.3 From 5b7ce38f984c602d8c105126259c2d2494194531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 29 Jun 2012 14:33:26 +0200 Subject: [REM] share: removed not unnecessary links before the page title, as the links are in 'more'. bzr revid: tde@openerp.com-20120629123326-ifzufvr2slmptebm --- addons/share/static/src/js/share.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/share/static/src/js/share.js') diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index 4d7c21a0957..3e910c0a1dd 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -60,10 +60,10 @@ openerp.share = function(session) { self.add_items('other', [ { label: 'Share', callback: self.on_sidebar_click_share, - classname: 'oe_chare' }, + classname: 'oe_share' }, { label: 'Embed', callback: self.on_sidebar_click_share, - classname: 'oe_chare' }, + classname: 'oe_share' }, ]); }); }, -- cgit v1.2.3 From ce1ed3f928a64652e9a306b4f5c1663e6c8a0a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 29 Jun 2012 15:56:57 +0200 Subject: [IMP] Share wizard: removed icons and their related code; share is now in the 'more' menu. Cleaned a bit the code. bzr revid: tde@openerp.com-20120629135657-fwp4q225zzr60dz8 --- addons/share/static/src/js/share.js | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'addons/share/static/src/js/share.js') diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index 3e910c0a1dd..33aa3d1aab9 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -59,18 +59,23 @@ openerp.share = function(session) { has_share(function() { self.add_items('other', [ { label: 'Share', - callback: self.on_sidebar_click_share, + callback: self.on_click_share, classname: 'oe_share' }, { label: 'Embed', - callback: self.on_sidebar_click_share, + callback: self.on_click_share_link, classname: 'oe_share' }, ]); }); }, - on_sidebar_click_share: function(item) { + on_click_share: function(item) { var view = this.getParent() - launch_wizard(this, view); + launch_wizard(this, view, 'emails', false); + }, + + on_click_share_link: function(item) { + var view = this.getParent() + launch_wizard(this, view, 'embedded', false); }, }); @@ -84,7 +89,7 @@ openerp.share = function(session) { start: function() { start_res = this._super.apply(this, arguments); if (has_action_id) { - this.$element.find('button.oe_share_mail').show(); + this.$element.find('button.oe_share_invite').show(); } return start_res; } @@ -95,12 +100,7 @@ openerp.share = function(session) { var self = this; this.check_if_action_is_defined(); has_share(function() { - self.$element.find('a.oe_share_link').click(self.on_click_share_link); - self.$element.find('a.oe_share').click(self.on_click_share); - self.$element.delegate('button.oe_share_mail', 'click', self.on_click_share_mail); - }, function() { - self.$element.find('a.oe_share_link').remove(); - self.$element.find('a.oe_share').remove(); + self.$element.delegate('button.oe_share_invite', 'click', self.on_click_share_invite); }); return this._super.apply(this, arguments); }, @@ -108,23 +108,13 @@ openerp.share = function(session) { check_if_action_is_defined: function() { if (this.action && this.action.id) { has_action_id = true; - this.$element.find('a.oe_share_link').show(); - this.$element.find('a.oe_share').show(); } else { has_action_id = false; } }, - - on_click_share_link: function(e) { - e.preventDefault(); - launch_wizard(this, this.views[this.active_view].controller, 'embedded', false); - }, - on_click_share: function(e) { - e.preventDefault(); - launch_wizard(this, this.views[this.active_view].controller, 'emails', false); - }, - on_click_share_mail: function(e) { + + on_click_share_invite: function(e) { e.preventDefault(); launch_wizard(this, this.views[this.active_view].controller, 'emails', true); }, -- cgit v1.2.3