diff --git a/mail_recovery/__init__.py b/mail_recovery/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/mail_recovery/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/mail_recovery/__openerp__.py b/mail_recovery/__openerp__.py new file mode 100644 index 0000000..01cbb40 --- /dev/null +++ b/mail_recovery/__openerp__.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +{ + 'name': "Mail recovery", + 'author': "IT-Projects LLC, Ildar Nasyrov", + 'license': 'LGPL-3', + 'website': "https://twitter.com/nasyrov_ildar", + 'category': 'Uncategorized', + 'version': '1.0.0', + 'depends': ['mail'], + 'data': [ + 'data.xml', + ], +} diff --git a/mail_recovery/data.xml b/mail_recovery/data.xml new file mode 100644 index 0000000..d035853 --- /dev/null +++ b/mail_recovery/data.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/mail_recovery/static/src/js/mail_recovery.js b/mail_recovery/static/src/js/mail_recovery.js new file mode 100644 index 0000000..3d52a4a --- /dev/null +++ b/mail_recovery/static/src/js/mail_recovery.js @@ -0,0 +1,25 @@ +openerp.mail_recovery = function (session) { + var mail = session.mail; + + mail.ThreadComposeMessage = mail.ThreadComposeMessage.extend({ + bind_events: function () { + var self = this; + this.$('textarea').on('focus', self.on_focus_textarea); + this.$('textarea').on('keyup', self.on_keyup_textarea); + this._super(); + }, + on_focus_textarea: function(event) { + var $input = $(event.target); + if (!$input.val()) { + $input.val(window.localStorage['message_storage']); + } + }, + on_keyup_textarea: function(event) { + window.localStorage['message_storage'] = $(event.target).val(); + }, + on_message_post: function (event) { + window.localStorage['message_storage'] = ''; + return this._super(event); + }, + }); +}; \ No newline at end of file