Browse Source

[ADD] mail_recovery module

pull/1/head
Ildar Nasyrov 9 years ago
commit
283782e948
  1. 1
      __init__.py
  2. 12
      __openerp__.py
  3. 10
      data.xml
  4. 26
      static/src/js/mail_recovery.js

1
__init__.py

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

12
__openerp__.py

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
{
'name': "Mail recovery",
'author': "IT-Projects LLC, Ildar Nasyrov",
'website': "https://twitter.com/nasyrov_ildar",
'category': 'Uncategorized',
'version': '0.1',
'depends': ['mail'],
'data': [
'data.xml',
],
}

10
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="/message_storage/static/src/js/mail_recovery.js"></script>
</xpath>
</template>
</data>
</openerp>

26
static/src/js/mail_recovery.js

@ -0,0 +1,26 @@
openerp.mail_recovery = function (session) {
var mail = session.mail;
mail.ThreadComposeMessage = mail.ThreadComposeMessage.extend({
init: function (parent, datasets, options) {
console.log("privet");
return this._super(parent, datasets, options);
},
bind_events: function () {
var self = this;
this.$('textarea').on('focus', self.on_focus_textarea);
this.$('textarea').on('change', self.on_change_textarea);
this._super();
},
on_focus_textarea: function(event) {
$(event.target).val(window.localStorage['message_storage']);
},
on_change_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