Browse Source

Move base.js file in mail_base folder and activate mail_base module.

pull/6/head
x620 9 years ago
parent
commit
4f6b18ec2d
  1. 3
      mail_archives/__openerp__.py
  2. 10
      mail_archives/static/src/js/archives.js
  3. 1
      mail_archives/views/templates.xml
  4. 1
      mail_base/__init__.py
  5. 22
      mail_base/__openerp__.py
  6. 0
      mail_base/static/src/js/base.js
  7. 12
      mail_base/views/templates.xml

3
mail_archives/__openerp__.py

@ -12,7 +12,8 @@
"depends": [ "depends": [
"base", "base",
"mail"
"mail",
"mail_base"
], ],
"data": [ "data": [

10
mail_archives/static/src/js/archives.js

@ -56,13 +56,13 @@ base_obj.MailTools.include({
msg.body = msg.body.replace(regexp, ' <span class="o_mail_emoji">'+emoji_substitutions[key]+'</span> '); msg.body = msg.body.replace(regexp, ' <span class="o_mail_emoji">'+emoji_substitutions[key]+'</span> ');
}); });
// Add property to Object
var properties = this.get_properties(msg); var properties = this.get_properties(msg);
// Add property to Object
properties.is_archive = this.property_descr("channel_archive", msg, this); properties.is_archive = this.property_descr("channel_archive", msg, this);
Object.defineProperties(msg, properties); Object.defineProperties(msg, properties);
// Set archive flag
msg = this.set_channel_flags(data, msg); msg = this.set_channel_flags(data, msg);
// Set archive flag
msg.is_archive = true; msg.is_archive = true;
if (msg.model === 'mail.channel') { if (msg.model === 'mail.channel') {
// Add 'channel_archive' to channel_array // Add 'channel_archive' to channel_array
@ -76,7 +76,6 @@ base_obj.MailTools.include({
} }
} }
// Compute displayed author name or email
if ((!msg.author_id || !msg.author_id[0]) && msg.email_from) { if ((!msg.author_id || !msg.author_id[0]) && msg.email_from) {
msg.mailto = msg.email_from; msg.mailto = msg.email_from;
} else { } else {
@ -84,10 +83,8 @@ base_obj.MailTools.include({
msg.email_from || _t('Anonymous'); msg.email_from || _t('Anonymous');
} }
// Don't redirect on author clicked of self-posted messages
msg.author_redirect = !msg.is_author; msg.author_redirect = !msg.is_author;
// Compute the avatar_url
if (msg.author_id && msg.author_id[0]) { if (msg.author_id && msg.author_id[0]) {
msg.avatar_src = "/web/image/res.partner/" + msg.author_id[0] + "/image_small"; msg.avatar_src = "/web/image/res.partner/" + msg.author_id[0] + "/image_small";
} else if (msg.message_type === 'email') { } else if (msg.message_type === 'email') {
@ -96,10 +93,8 @@ base_obj.MailTools.include({
msg.avatar_src = "/mail/static/src/img/smiley/avatar.jpg"; msg.avatar_src = "/mail/static/src/img/smiley/avatar.jpg";
} }
// add anchor tags to urls
msg.body = this.parse_and_transform(msg.body, this.add_link); msg.body = this.parse_and_transform(msg.body, this.add_link);
// Compute url of attachments
_.each(msg.attachment_ids, function(a) { _.each(msg.attachment_ids, function(a) {
a.url = '/web/content/' + a.id + '?download=true'; a.url = '/web/content/' + a.id + '?download=true';
}); });
@ -177,7 +172,6 @@ base_obj.MailTools.include({
// Change chat_manager with override methods // Change chat_manager with override methods
var cls = new base_obj.MailTools(base_obj.chat_manager); var cls = new base_obj.MailTools(base_obj.chat_manager);
base_obj.chat_manager.is_ready = cls.start(); base_obj.chat_manager.is_ready = cls.start();
console.log('MailTools:', cls);
return base_obj.chat_manager; return base_obj.chat_manager;

1
mail_archives/views/templates.xml

@ -6,7 +6,6 @@
inherit_id="web.assets_backend"> inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script> <script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script>
<script src="/mail_archives/static/src/js/base.js" type="text/javascript"></script>
</xpath> </xpath>
</template> </template>
</data> </data>

1
mail_base/__init__.py

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

22
mail_base/__openerp__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
{
"name": "mail_base",
"summary": """Contain common code for other mail modules""",
"category": "Uncategorized",
"images": [],
"version": "1.0.0",
"author": "IT-Projects LLC, Pavel Romanchenko",
"website": "http://www.it-projects.info",
"license": "LGPL-3",
"depends": [
"base",
"mail"
],
"data": [
"views/templates.xml",
],
'installable': True,
}

0
mail_archives/static/src/js/base.js → mail_base/static/src/js/base.js

12
mail_base/views/templates.xml

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data>
<template id="mail_base_assets_backend"
name="mail_base_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script src="/mail_base/static/src/js/base.js" type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save