Browse Source

[ADD] Initial Commit

pull/36/head
SHEREEF PT 8 years ago
parent
commit
d63f888244
  1. 3
      news_letter_name/__init__.py
  2. 45
      news_letter_name/__manifest__.py
  3. 3
      news_letter_name/controllers/__init__.py
  4. 31
      news_letter_name/controllers/controllers.py
  5. 2
      news_letter_name/security/ir.model.access.csv
  6. BIN
      news_letter_name/static/description/banner.jpg
  7. BIN
      news_letter_name/static/description/cybro_logo.png
  8. BIN
      news_letter_name/static/description/droppped.png
  9. BIN
      news_letter_name/static/description/icon.png
  10. 124
      news_letter_name/static/description/index.html
  11. BIN
      news_letter_name/static/description/nameonbackend.png
  12. BIN
      news_letter_name/static/description/snippet_subscribe.png
  13. BIN
      news_letter_name/static/description/subscribe.png
  14. BIN
      news_letter_name/static/description/thanks.png
  15. 36
      news_letter_name/static/src/js/news_letter_name.js
  16. 17
      news_letter_name/views/templates.xml

3
news_letter_name/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

45
news_letter_name/__manifest__.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Hilar AK(<hilar@cybrosys.in>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "News Letter Subscription With Name",
'version': '10.0.1.0',
'summary': """Odoo mailing list subscription With Subscriber Name""",
'description': """Odoo mailing list subscription With Subscriber Name""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': "https://cybrosys.com",
'category': 'Marketing',
'depends': ['base',
'website_mass_mailing',
'mass_mailing',
],
'data': [
'views/templates.xml',
],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'application': False
}

3
news_letter_name/controllers/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

31
news_letter_name/controllers/controllers.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from odoo.addons.website_mass_mailing.controllers.main import MassMailController
from odoo.http import route, request
class MassMailController(MassMailController):
@route('/website_mass_mailing/subscribe', type='json', website=True, auth="public")
def subscribe(self, list_id, email, **post):
"""
Overrided function which treats the inputs when clicks on subscribe button.
:param list_id:
:param email:
:param post: Will contain the Name entered on Input box.
:return:
"""
Contacts = request.env['mail.mass_mailing.contact'].sudo()
name, email = Contacts.get_name_email(email)
contact_ids = Contacts.search([
('list_id', '=', int(list_id)),
('email', '=', email),
], limit=1)
if not contact_ids:
# inline add_to_list as we've already called half of it
Contacts.create({'name': post.get('name') or name, 'email': email, 'list_id': int(list_id)})
elif contact_ids.opt_out:
contact_ids.opt_out = False
# add email to session
request.session['mass_mailing_email'] = email
return True

2
news_letter_name/security/ir.model.access.csv

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_news_letter_name_news_letter_name,news_letter_name.news_letter_name,model_news_letter_name_news_letter_name,,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_news_letter_name_news_letter_name news_letter_name.news_letter_name model_news_letter_name_news_letter_name 1 0 0 0

BIN
news_letter_name/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
news_letter_name/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
news_letter_name/static/description/droppped.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
news_letter_name/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

124
news_letter_name/static/description/index.html

@ -0,0 +1,124 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">News Letter Subscription With Name</h2>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="color:#875A7B;">Subscribe News letters by mentioning subscribers name </h2>
<h3 class="oe_slogan">
Easily subscribers can add their name while doing news letters subscription on Odoo.
</h3>
</div>
<div class="oe_container oe_dark">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Drag and Drop Subscription snippet</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="dropped.png">
</div>
</div>
</div>
</div>
<div class="oe_container">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Snippet on web page</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="snippet_subscribe.png">
</div>
</div>
</div>
</div>
<div class="oe_container oe_dark">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Subscibe</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="subscribe.png">
</div>
</div>
</div>
</div>
<div class="oe_container">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Subscribe responce</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="thanks.png">
</div>
</div>
</div>
</div>
<div class="oe_container oe_dark">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Subscription on backend</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="nameonbackend.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
news_letter_name/static/description/nameonbackend.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
news_letter_name/static/description/snippet_subscribe.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
news_letter_name/static/description/subscribe.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
news_letter_name/static/description/thanks.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

36
news_letter_name/static/src/js/news_letter_name.js

@ -0,0 +1,36 @@
odoo.define('news_letter_name.massmailextend', function (require) {
"use strict";
var ajax = require('web.ajax');
var utils = require('web.utils');
var animation = require('web_editor.snippets.animation');
require('web_editor.base');
require('mass_mailing.website_integration');
//updated onclick function to feed the name from news letter subscribe
animation.registry.subscribe.include({
on_click: function () {
var self = this;
var $email = this.$target.find(".js_subscribe_email:visible");
var $name = this.$target.find(".js_subscribe_name:visible");
if ($email.length && !$email.val().match(/.+@.+/)) {
this.$target.addClass('has-error');
return false;
}
this.$target.removeClass('has-error');
ajax.jsonRpc('/website_mass_mailing/subscribe', 'call', {
'list_id': this.$target.data('list-id'),
'email': $email.length ? $email.val() : false,
'name': $name.length ? $name.val() : false,
}).then(function (subscribe) {
self.$target.find(".js_subscribe_email, .input-group-btn").addClass("hidden");
self.$target.find(".js_subscribe_name, .input-group-btn").addClass("hidden");
self.$target.find(".alert").removeClass("hidden");
self.$target.find('input.js_subscribe_email').attr("disabled", subscribe ? "disabled" : false);
self.$target.find('input.js_subscribe_name').attr("disabled", subscribe ? "disabled" : false);
self.$target.attr("data-subscribe", subscribe ? 'on' : 'off');
});
},
});
});

17
news_letter_name/views/templates.xml

@ -0,0 +1,17 @@
<odoo>
<data>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Assets For NewsLetter">
<xpath expr="." position="inside">
<script type="text/javascript" src="/news_letter_name/static/src/js/news_letter_name.js"/>
</xpath>
</template>
<!--Mass mailing, Adding a new field before the email field-->
<template id="s_newsletter_subscribe_form_extend" inherit_id="website_mass_mailing.s_newsletter_subscribe_form">
<xpath expr="//input[@name='email']" position="before">
<input type="text" name="name"
class="js_subscribe_name form-control"
placeholder="your name..."/>
</xpath>
</template>
</data>
</odoo>
Loading…
Cancel
Save