Browse Source

Merge branch '9.0' of /home/iii/addons-yelizariev/../mail_recovery into 9.0

pull/2/head
Ildar Nasyrov 9 years ago
parent
commit
754b28594f
  1. 1
      mail_recovery/__init__.py
  2. 13
      mail_recovery/__openerp__.py
  3. 10
      mail_recovery/data.xml
  4. 25
      mail_recovery/static/src/js/mail_recovery.js

1
mail_recovery/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

13
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',
],
}

10
mail_recovery/data.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="message storage" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/mail_recovery/static/src/js/mail_recovery.js"></script>
</xpath>
</template>
</data>
</openerp>

25
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);
},
});
};
Loading…
Cancel
Save