diff --git a/CHANGELOG b/CHANGELOG index 9c0f1b33d2..5968613414 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Remove dialog for input file +* Use dropdown for attachment * Manage icons in input * Support RTL language direction * Apply factor on domain parser diff --git a/src/common.js b/src/common.js index f1954e4568..b9e7f5a697 100644 --- a/src/common.js +++ b/src/common.js @@ -3412,6 +3412,19 @@ }; + Sao.common.get_input_data = function(input, callback, char_) { + var reader = new FileReader(), + file = input[0].files[0]; + reader.onload = function() { + var value = new Uint8Array(reader.result); + if (char_) { + value = String.fromCharCode.apply(null, value); + } + callback(value, file.name); + }; + reader.readAsArrayBuffer(file); + }; + Sao.common.ellipsize = function(string, length) { if (string.length <= length) { return string; diff --git a/src/sao.less b/src/sao.less index a9201e85f4..bd0e8d7f87 100644 --- a/src/sao.less +++ b/src/sao.less @@ -124,6 +124,14 @@ input[type='color'] { } } +.input-file { + & input[type='file'] { + position: absolute; + opacity: 0; + cursor: pointer; + } +} + /* Hide empty image displayed as broken image */ [src=''] { visibility: hidden; diff --git a/src/tab.js b/src/tab.js index 37c6c270cd..ee6e4007fc 100644 --- a/src/tab.js +++ b/src/tab.js @@ -72,6 +72,7 @@ icon: 'tryton-attach', label: Sao.i18n.gettext('Attachment'), tooltip: Sao.i18n.gettext('Add an attachment to the record'), + dropdown: true, }, { id: 'note', icon: 'tryton-note', @@ -208,16 +209,37 @@ 'role': 'group' }).appendTo(toolbar.find('.btn-toolbar')); } - this.buttons[item.id] = jQuery('