diff --git a/CHANGELOG b/CHANGELOG index fb079ef57c..c6925733b5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Support e-mail template * Always encode CSV export in UTF-8 * Use tempusdominus and Popper for date time picker * Support PYSON comparison of date and datetime diff --git a/images/tryton-send.svg b/images/tryton-send.svg new file mode 100644 index 0000000000..033ab7a11a --- /dev/null +++ b/images/tryton-send.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/action.js b/src/action.js index 143b853b02..407b201903 100644 --- a/src/action.js +++ b/src/action.js @@ -132,8 +132,6 @@ params.name = action.report_name; params.data = data; params.direct_print = action.direct_print; - params.email_print = action.email_print; - params.email = action.email; params.context = context; Sao.Action.exec_report(params); return; @@ -183,15 +181,10 @@ if (!attributes.context) { attributes.context = {}; } - if (!attributes.email) { - attributes.email = {}; - } var data = jQuery.extend({}, attributes.data); var context = jQuery.extend({}, Sao.Session.current_session.context); jQuery.extend(context, attributes.context); context.direct_print = attributes.direct_print; - context.email_print = attributes.email_print; - context.email = attributes.email; var prm = Sao.rpc({ 'method': 'report.' + attributes.name + '.execute', diff --git a/src/common.js b/src/common.js index 430107554d..0459011e1c 100644 --- a/src/common.js +++ b/src/common.js @@ -133,7 +133,7 @@ keys.forEach(function(k, i) { jQuery('
', { - 'class': 'checkbox' + 'class': 'radio' }).append(jQuery('') .text(' ' + k) .prepend(jQuery('', { @@ -150,7 +150,7 @@ 'type': 'button' }).text(Sao.i18n.gettext('Cancel')).click(function() { dialog.modal.modal('hide'); - prm.fail(); + prm.reject(); }).appendTo(dialog.footer); jQuery('', { 'class': 'btn btn-primary', @@ -2723,6 +2723,7 @@ 'tryton-remove', 'tryton-save', 'tryton-search', + 'tryton-send', 'tryton-star-border', 'tryton-star', 'tryton-switch', @@ -3435,7 +3436,9 @@ this.input.focus(); }.bind(this)).prependTo(this.menu); }, this); - if (!this.input.val()) { + if (!this.input.val() || ( + !this.menu.find('li.completion').length && + !this.menu.find('li.action').length)) { if (this.dropdown.hasClass('open')) { this.menu.dropdown('toggle'); } @@ -3770,4 +3773,142 @@ return colors; }; + Sao.common.richtext_toolbar = function() { + var toolbar = jQuery('', { + 'class': 'btn-toolbar', + 'role': 'toolbar', + }); + + var button_apply_command = function(evt) { + document.execCommand(evt.data); + }; + + var add_buttons = function(buttons) { + var group = jQuery('', { + 'class': 'btn-group', + 'role': 'group' + }).appendTo(toolbar); + for (var i in buttons) { + var properties = buttons[i]; + var button = jQuery('', { + 'class': 'btn btn-default', + 'type': 'button' + }).append(Sao.common.ICONFACTORY.get_icon_img( + 'tryton-format-' + properties.icon) + ).appendTo(group); + button.click(properties.command, button_apply_command); + } + }; + + add_buttons([ + { + 'icon': 'bold', + 'command': 'bold' + }, { + 'icon': 'italic', + 'command': 'italic' + }, { + 'icon': 'underline', + 'command': 'underline' + }]); + + var selections = [ + { + 'heading': Sao.i18n.gettext('Font'), + 'options': ['Normal', 'Serif', 'Sans', 'Monospace'], // XXX + 'command': 'fontname' + }, { + 'heading': Sao.i18n.gettext('Size'), + 'options': [1, 2, 3, 4, 5, 6, 7], + 'command': 'fontsize' + }]; + var add_option = function(dropdown, properties) { + return function(option) { + dropdown.append(jQuery('').append(jQuery('', { + 'href': '#' + }).text(option).click(function(evt) { + evt.preventDefault(); + document.execCommand(properties.command, false, option); + }))); + }; + }; + for (var i in selections) { + var properties = selections[i]; + var group = jQuery('', { + 'class': 'btn-group', + 'role': 'group' + }).appendTo(toolbar); + var button = jQuery('', { + 'class': 'btn btn-default dropdown-toggle', + 'type': 'button', + 'data-toggle': 'dropdown', + 'aria-expanded': false, + 'aria-haspopup': true + }).append(properties.heading) + .append(jQuery('', { + 'class': 'caret' + })).appendTo(group); + var dropdown = jQuery('