From 82937d5cc8a812bee3ed4199757417e78f534dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:09:14 +0100 Subject: [PATCH] [imp] add frontend support for spreadsheets and presentations bzr revid: rlo@openerp.com-20120301150914-0733ak0tdhdpaw8h --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++++++++++++++--- addons/google_docs/static/src/xml/gdocs.xml | 12 +++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a126bfed5c3..9723aac2723 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -3,14 +3,34 @@ openerp.google_docs = function(instance, session) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); + this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); + this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); + this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); }, - on_add_gdoc: function() { + on_add_text_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_button'); + var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id]], function(r) { + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + self.do_update(); + }); + }, + on_add_spreadsheet_gdoc: function() { + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord, id], 'spreadsheet'], function(r) { + self.do_update(); + }); + }, + on_add_slide_gdoc: function() { + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord,id], 'slide'], function(r) { self.do_update(); }); } diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 7ee2297c545..f401512e96b 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -11,9 +11,17 @@


- + +