[imp] add frontend support for spreadsheets and presentations

bzr revid: rlo@openerp.com-20120301150914-0733ak0tdhdpaw8h
This commit is contained in:
Roberto López López (OpenERP)
2012-03-01 16:09:14 +01:00
parent 2947f6dbb8
commit 82937d5cc8
2 changed files with 34 additions and 6 deletions
+24 -4
View File
@@ -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();
});
}
+10 -2
View File
@@ -11,9 +11,17 @@
<br/>
<br/>
<br/>
<button class="oe_google_docs_button" type="button">
<button class="oe_google_docs_text_button" type="button">
<img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/>
<span>Add GDoc</span>
<span>Add GDoc - text</span>
</button>
<button class="oe_google_docs_spreadsheet_button" type="button">
<img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/>
<span>Add GDoc - spreadsheet</span>
</button>
<button class="oe_google_docs_slide_button" type="button">
<img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/>
<span>Add GDoc - presentation</span>
</button>
</t>
</t>