From f0a9682a6aa6814817cca4e31fe9561bed60d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 17:12:00 +0100 Subject: [imp] js things bzr revid: rlo@openerp.com-20120227161200-toovqcewybgxsitg --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++++-------------------- addons/google_docs/static/src/xml/gdocs.xml | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) (limited to 'addons/google_docs/static/src') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14996da46a5..11690f70e2a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,22 +1,16 @@ -openerp.gdocs = function(instance) { +console.log('fegegegwnw') +openerp.google_docs = function(instance) { +console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - on_attachments_loaded: function(attachments) { - this._super(attachments); - var self = this; - var $gdocbtn = self.$element.find('button.gdocs'); - var is_gdoc = function(a) { - return a.type == 'url' && a.name == 'GDocs'; - }; - if (_.any(attachments, is_gdoc)) { - $gdocbtn.hide(); - } else { - $gdocbtn.show().click(self.on_add_gdoc); - } + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs'); +console.log('--------'); + var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); @@ -28,9 +22,3 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }; -$(function() { - console.log($('#gd-button')); - $('#gd-button').click(function(){alert('click');}); - alert('binded'); -} -); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 61c169fe531..7ee2297c545 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -11,7 +11,7 @@


- -- cgit v1.2.3