diff --git a/news_letter_name/__init__.py b/news_letter_name/__init__.py new file mode 100644 index 000000000..b0f26a9a6 --- /dev/null +++ b/news_letter_name/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers diff --git a/news_letter_name/__manifest__.py b/news_letter_name/__manifest__.py new file mode 100644 index 000000000..dfa17e31d --- /dev/null +++ b/news_letter_name/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Hilar AK() +# 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 . +# +############################################################################## + +{ + '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 +} \ No newline at end of file diff --git a/news_letter_name/controllers/__init__.py b/news_letter_name/controllers/__init__.py new file mode 100644 index 000000000..b0f26a9a6 --- /dev/null +++ b/news_letter_name/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers diff --git a/news_letter_name/controllers/controllers.py b/news_letter_name/controllers/controllers.py new file mode 100644 index 000000000..a348b67b8 --- /dev/null +++ b/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 diff --git a/news_letter_name/security/ir.model.access.csv b/news_letter_name/security/ir.model.access.csv new file mode 100644 index 000000000..db8d0c6af --- /dev/null +++ b/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 \ No newline at end of file diff --git a/news_letter_name/static/description/banner.jpg b/news_letter_name/static/description/banner.jpg new file mode 100644 index 000000000..c63285f6d Binary files /dev/null and b/news_letter_name/static/description/banner.jpg differ diff --git a/news_letter_name/static/description/cybro_logo.png b/news_letter_name/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/news_letter_name/static/description/cybro_logo.png differ diff --git a/news_letter_name/static/description/droppped.png b/news_letter_name/static/description/droppped.png new file mode 100644 index 000000000..ec235075c Binary files /dev/null and b/news_letter_name/static/description/droppped.png differ diff --git a/news_letter_name/static/description/icon.png b/news_letter_name/static/description/icon.png new file mode 100644 index 000000000..e3768ea17 Binary files /dev/null and b/news_letter_name/static/description/icon.png differ diff --git a/news_letter_name/static/description/index.html b/news_letter_name/static/description/index.html new file mode 100644 index 000000000..83025e83e --- /dev/null +++ b/news_letter_name/static/description/index.html @@ -0,0 +1,124 @@ +
+
+

News Letter Subscription With Name

+

Cybrosys Technologies

+
+
+ +
+
+

Subscribe News letters by mentioning subscribers name

+

+ Easily subscribers can add their name while doing news letters subscription on Odoo. +

+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+

Need Any Help?

+ +
+ diff --git a/news_letter_name/static/description/nameonbackend.png b/news_letter_name/static/description/nameonbackend.png new file mode 100644 index 000000000..3d2bc012d Binary files /dev/null and b/news_letter_name/static/description/nameonbackend.png differ diff --git a/news_letter_name/static/description/snippet_subscribe.png b/news_letter_name/static/description/snippet_subscribe.png new file mode 100644 index 000000000..5c9997b61 Binary files /dev/null and b/news_letter_name/static/description/snippet_subscribe.png differ diff --git a/news_letter_name/static/description/subscribe.png b/news_letter_name/static/description/subscribe.png new file mode 100644 index 000000000..d317825e5 Binary files /dev/null and b/news_letter_name/static/description/subscribe.png differ diff --git a/news_letter_name/static/description/thanks.png b/news_letter_name/static/description/thanks.png new file mode 100644 index 000000000..1e0cca811 Binary files /dev/null and b/news_letter_name/static/description/thanks.png differ diff --git a/news_letter_name/static/src/js/news_letter_name.js b/news_letter_name/static/src/js/news_letter_name.js new file mode 100644 index 000000000..6873f623b --- /dev/null +++ b/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'); + }); + }, + +}); + +}); \ No newline at end of file diff --git a/news_letter_name/views/templates.xml b/news_letter_name/views/templates.xml new file mode 100644 index 000000000..f55953cfd --- /dev/null +++ b/news_letter_name/views/templates.xml @@ -0,0 +1,17 @@ + + +