diff options
| author | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 17:12:00 +0100 |
|---|---|---|
| committer | Roberto López López (OpenERP) <rlo@openerp.com> | 2012-02-27 17:12:00 +0100 |
| commit | f0a9682a6aa6814817cca4e31fe9561bed60d126 (patch) | |
| tree | d4e0ba1bcf5e65c8addedbc4d16a7d47c65ec8ef /addons/google_docs/static/src | |
| parent | 3568bed68046537878e7386597abfb7978de3cdb (diff) | |
[imp] js things
bzr revid: rlo@openerp.com-20120227161200-toovqcewybgxsitg
Diffstat (limited to 'addons/google_docs/static/src')
| -rw-r--r-- | addons/google_docs/static/src/js/gdocs.js | 28 | ||||
| -rw-r--r-- | addons/google_docs/static/src/xml/gdocs.xml | 2 |
2 files changed, 9 insertions, 21 deletions
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 @@ <br/> <br/> <br/> - <button class="oe-button" type="button" id='gd-button'> + <button class="oe_google_docs_button" type="button"> <img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/> <span>Add GDoc</span> </button> |
