Browse Source

update

pull/64/head
Mathias Markl 6 years ago
parent
commit
37737cd90b
  1. 2
      muk_web_preview/__manifest__.py
  2. 6
      muk_web_preview/static/src/js/preview_widgets.js

2
muk_web_preview/__manifest__.py

@ -20,7 +20,7 @@
{ {
"name": "MuK Preview", "name": "MuK Preview",
"summary": """File Preview Dialog""", "summary": """File Preview Dialog""",
"version": "11.0.2.1.2",
"version": "11.0.2.1.3",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",

6
muk_web_preview/static/src/js/preview_widgets.js

@ -45,7 +45,6 @@ fields.FieldBinaryFile.include({
$button.click(function(e) { $button.click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var value = self.get('value');
var filename_fieldname = self.attrs.filename; var filename_fieldname = self.attrs.filename;
var filename = self.recordData[filename_fieldname] || null; var filename = self.recordData[filename_fieldname] || null;
PreviewDialog.createPreviewDialog(self, '/web/content?' + $.param({ PreviewDialog.createPreviewDialog(self, '/web/content?' + $.param({
@ -55,7 +54,7 @@ fields.FieldBinaryFile.include({
'filename_field': filename_fieldname, 'filename_field': filename_fieldname,
'filename': filename, 'filename': filename,
'download': true, 'download': true,
'data': utils.is_bin_size(value) ? null : value,
'data': utils.is_bin_size(self.value) ? null : self.value,
}), false, filename ? filename.split('.').pop() : false, filename); }), false, filename ? filename.split('.').pop() : false, filename);
}); });
$wrapper.addClass($el.attr('class')); $wrapper.addClass($el.attr('class'));
@ -80,7 +79,7 @@ var FieldPreviewBinary = fields.FieldBinaryFile.extend({
template: 'FieldPreviewBinary', template: 'FieldPreviewBinary',
_renderReadonly: function () { _renderReadonly: function () {
var self = this; var self = this;
if(utils.is_bin_size(this.value)) {
if(this.value) {
var filename_fieldname = this.attrs.filename; var filename_fieldname = this.attrs.filename;
var filename = this.recordData[filename_fieldname] || null; var filename = this.recordData[filename_fieldname] || null;
var download_url = '/web/content?' + $.param({ var download_url = '/web/content?' + $.param({
@ -90,6 +89,7 @@ var FieldPreviewBinary = fields.FieldBinaryFile.extend({
'filename_field': filename_fieldname, 'filename_field': filename_fieldname,
'filename': filename, 'filename': filename,
'download': true, 'download': true,
'data': utils.is_bin_size(this.value) ? null : this.value,
}); });
PreviewGenerator.createPreview(this, download_url, false, PreviewGenerator.createPreview(this, download_url, false,
filename ? filename.split('.').pop() : false, filename).then(function($content) { filename ? filename.split('.').pop() : false, filename).then(function($content) {

Loading…
Cancel
Save