-
-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.0][ADD][website_snippet_mass_mailing_partner] Snippet + name #201
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
server-tools | ||
crm | ||
server-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=========================================== | ||
Mass Mailing Subscription Snippet With Name | ||
=========================================== | ||
|
||
This module extends the functionality of ``mass_mailing_partner`` to support | ||
asking for the contact name directly in the subscription snippet and allow you | ||
to get partners created automatically and linked to the contacts. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to any website page. | ||
#. Insert any structure block. | ||
#. Insert the *Newsletter* block as you would usually, inside a structure one. | ||
#. Choose the newsletter of your liking. | ||
#. Press *Save*. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/186/8.0 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* If you use Firefox, you could hit https://github.com/odoo/odoo/issues/7722. | ||
Just use Chromium to work with this snippet until you update to Odoo 9.0. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/website/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Jairo Llopis <jairo.llopis@tecnativa.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Mass Mailing Subscription Snippet With Name", | ||
"summary": "Ask for name when subscribing, and create and/or link partner", | ||
"version": "8.0.1.0.0", | ||
"category": "Website", | ||
"website": "https://tecnativa.com/", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"mass_mailing_partner", | ||
], | ||
"data": [ | ||
"views/assets.xml", | ||
"views/snippets.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp.addons.mass_mailing.controllers.main import MassMailController | ||
from openerp.http import request, route | ||
|
||
|
||
class MassMailingPartner(MassMailController): | ||
@route() | ||
def subscribe(self, list_id, email, **post): | ||
"""Handle name if provided.""" | ||
Partner = request.env["res.partner"].sudo() | ||
name = post.get("name") | ||
|
||
# Update partner's name, to make it get updated in contact list later | ||
Partner.search([("email", "=", email)], limit=1).write({"name": name}) | ||
|
||
return super(MassMailingPartner, self).subscribe( | ||
list_id, email, **post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_snippet_mass_mailing_partner | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-05-24 15:03+0000\n" | ||
"PO-Revision-Date: 2016-05-24 17:04+0200\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"Language: es\n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
|
||
#. module: website_snippet_mass_mailing_partner | ||
#: view:website:website.snippets | ||
msgid "your name..." | ||
msgstr "su nombre..." |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
website_snippet_mass_mailing_partner/static/src/css/website_snippet_mass_mailing_partner.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
..._snippet_mass_mailing_partner/static/src/css/website_snippet_mass_mailing_partner.css.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ite_snippet_mass_mailing_partner/static/src/css/website_snippet_mass_mailing_partner.sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@charset "UTF-8" | ||
/* © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
.js_subscribe | ||
.form-control | ||
width: 50% |
34 changes: 34 additions & 0 deletions
34
website_snippet_mass_mailing_partner/static/src/js/website_snippet_mass_mailing_partner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ | ||
|
||
"use strict"; | ||
(function ($) { | ||
openerp.website.snippet.animationRegistry.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(/.+@.+/)) || | ||
($name.length && !$name.val()) | ||
) { | ||
this.$target.addClass('has-error'); | ||
return false; | ||
} | ||
this.$target.removeClass('has-error'); | ||
|
||
openerp.jsonRpc('/website_mass_mailing/subscribe', 'call', { | ||
'list_id': this.$target.data('list-id'), | ||
'email': $email.length ? $email.val() : false, | ||
'name': $name.length && $name.val(), | ||
}).then(function (subscribe) { | ||
self.$target.children("input, span").addClass("hidden"); | ||
self.$target.find(".alert").removeClass("hidden"); | ||
self.$target.find('input.js_subscribe_email') | ||
.attr("disabled", subscribe); | ||
self.$target.attr("data-subscribe", subscribe ? 'on' : 'off'); | ||
}); | ||
}, | ||
}); | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<template id="assets_frontend" | ||
inherit_id="mass_mailing.assets_frontend"> | ||
<xpath expr="."> | ||
<link rel="stylesheet" | ||
href="/website_snippet_mass_mailing_partner/static/src/css/website_snippet_mass_mailing_partner.css"/> | ||
<script type="text/javascript" | ||
src="/website_snippet_mass_mailing_partner/static/src/js/website_snippet_mass_mailing_partner.js"/> | ||
</xpath> | ||
</template> | ||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<template id="mailing_list_subscribe" | ||
inherit_id="mass_mailing.mailing_list_subscribe"> | ||
<xpath expr="//input[@class='js_subscribe_email form-control']" | ||
position="before"> | ||
<input | ||
name="name" | ||
class="js_subscribe_name form-control" | ||
placeholder="your name..."/> | ||
</xpath> | ||
</template> | ||
|
||
</data> | ||
</openerp> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gurneyalex Runbot fails because it lacks this repo, could you add it please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added it.