Browse Source

[email] [website] footer cleanup

develop
Rushabh Mehta 9 years ago
committed by Nabin Hait
parent
commit
f29a618b69
  1. 47
      erpnext/crm/doctype/newsletter/newsletter.py
  2. 4
      erpnext/crm/doctype/newsletter_list/newsletter_list.py
  3. 7
      erpnext/hooks.py
  4. 1
      erpnext/patches.txt
  5. BIN
      erpnext/public/images/erpnext-fade.png
  6. 112
      erpnext/public/images/erpnext-logo-white.svg
  7. BIN
      erpnext/public/images/erpnext1.png
  8. BIN
      erpnext/public/images/feed.png
  9. 10
      erpnext/public/js/website_utils.js
  10. 1
      erpnext/setup/page/setup_wizard/setup_wizard.py
  11. 3
      erpnext/stock/doctype/item/item.json
  12. 41
      erpnext/templates/includes/footer_extension.html
  13. 1
      erpnext/templates/includes/footer_powered.html

47
erpnext/crm/doctype/newsletter/newsletter.py

@ -8,7 +8,9 @@ import frappe.utils
from frappe import throw, _
from frappe.model.document import Document
from frappe.email.bulk import check_bulk_limit
from frappe.utils.verified_command import get_signed_params, verify_request
import erpnext.tasks
from erpnext.crm.doctype.newsletter_list.newsletter_list import add_subscribers
class Newsletter(Document):
def onload(self):
@ -87,7 +89,6 @@ def get_lead_options():
@frappe.whitelist(allow_guest=True)
def unsubscribe(email, name):
from frappe.utils.verified_command import verify_request
if not verify_request():
return
@ -123,3 +124,47 @@ def create_lead(email_id):
"source": "Email"
})
lead.insert()
@frappe.whitelist(allow_guest=True)
def subscribe(email):
url = frappe.utils.get_url("/api/method/erpnext.crm.doctype.newsletter.newsletter.confirm_subscription") +\
"?" + get_signed_params({"email": email})
messages = (
_("Thank you for your interest in subscribing to our updates"),
_("Please verify your email id"),
url,
_("Click here to verify")
)
print url
content = """
<p>{0}. {1}.</p>
<p><a href="{2}">{3}</a></p>
"""
frappe.sendmail(email, subject=_("Confirm Your Email"), content=content.format(*messages), bulk=True)
@frappe.whitelist(allow_guest=True)
def confirm_subscription(email):
if not verify_request():
return
if not frappe.db.exists("Newsletter List", _("Website")):
frappe.get_doc({
"doctype": "Newsletter List",
"title": _("Website")
}).insert(ignore_permissions=True)
frappe.flags.ignore_permissions = True
add_subscribers(_("Website"), email)
frappe.db.commit()
frappe.respond_as_web_page(_("Confirmed"), _("{0} has been successfully added to our Newsletter list.").format(email))

4
erpnext/crm/doctype/newsletter_list/newsletter_list.py

@ -5,7 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import validate_email_add, strip
from frappe.utils import validate_email_add
from frappe import _
from email.utils import parseaddr
@ -75,7 +75,7 @@ def add_subscribers(name, email_list):
"doctype": "Newsletter List Subscriber",
"newsletter_list": name,
"email": email
}).insert()
}).insert(ignore_permissions = frappe.flags.ignore_permissions)
count += 1
else:

7
erpnext/hooks.py

@ -96,9 +96,10 @@ scheduler_events = {
]
}
default_mail_footer = """<div style="padding: 7px; margin-top: 7px;">
<a style="color: #8D99A6; font-size: 85%; text-decoration: none;" href="https://erpnext.com" target="_blank">
Sent via ERPNext
default_mail_footer = """<div style="padding: 15px; text-align: center;">
<a href="https://erpnext.com?source=via_email_footer" target="_blank">
<img src="https://erpnext.com/assets/erpnext_com/img/erpnext-footer.png" title="Sent via ERPNext"
alt="Sent via ERPNext">
</a>
</div>"""

1
erpnext/patches.txt

@ -157,3 +157,4 @@ erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency
erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle
erpnext.patches.v5_0.rename_pos_setting
erpnext.patches.v5_0.update_operation_description
erpnext.patches.v5_0.set_footer_address

BIN
erpnext/public/images/erpnext-fade.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

112
erpnext/public/images/erpnext-logo-white.svg

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg2"
version="1.1"
viewBox="0 0 680 820"
preserveAspectRatio="xMidyMid meet"
width="100%"
height="100%">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
style="display:inline">
<rect
style="fill:#fff"
id="rect3800"
width="150"
height="150"
x="60.000008"
y="-472.36218"
rx="20"
ry="20"
transform="scale(1,-1)" />
</g>
<g
id="layer2">
<path
transform="scale(1,-1)"
style="display:inline;fill:#fff"
d="m 180,-372.36218 110,0 20,0 0,20 0,110 c 0,11.08 -8.92,20 -20,20 l -110,0 c -11.08,0 -20,-8.92 -20,-20 l 0,-110 c 0,-11.08 8.92,-20 20,-20 z"
id="rect3051"/>
</g>
<g
id="layer3">
<rect
style="display:inline;fill:#fff"
id="rect3840"
width="150"
height="150"
x="260"
y="-272.36218"
rx="20"
ry="20"
transform="scale(1,-1)" />
</g>
<g
id="layer4">
<path
id="path3054"
d="m 490,372.36218 -110,0 -20,0 0,-20 0,-110 c 0,-11.08 8.92,-20 20,-20 l 110,0 c 11.08,0 20,8.92 20,20 l 0,110 c 0,11.08 -8.92,20 -20,20 z"
style="display:inline;fill:#fff" />
</g>
<g
id="layer5">
<rect
style="display:inline;fill:#fff"
id="rect3844"
width="150"
height="150"
x="460"
y="-472.36218"
rx="20"
ry="20"
transform="scale(1,-1)" />
</g>
<g
id="layer6">
<path
style="display:inline;fill:#fff"
d="m 490,422.36218 -110,0 -20,0 0,20 0,110 c 0,11.08 8.92,20 20,20 l 110,0 c 11.08,0 20,-8.92 20,-20 l 0,-110 c 0,-11.08 -8.92,-20 -20,-20 z"
id="path3058" />
</g>
<g
id="layer7">
<rect
style="display:inline;fill:#fff"
id="rect3848"
width="150"
height="150"
x="260"
y="-672.36218"
rx="20"
ry="20"
transform="scale(1,-1)" />
</g>
<g
id="layer8">
<path
id="path3056"
d="m 180,422.36218 110,0 20,0 0,20 0,110 c 0,11.08 -8.92,20 -20,20 l -110,0 c -11.08,0 -20,-8.92 -20,-20 l 0,-110 c 0,-11.08 8.92,-20 20,-20 z"
style="display:inline;fill:#fff" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

BIN
erpnext/public/images/erpnext1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

BIN
erpnext/public/images/feed.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

10
erpnext/public/js/website_utils.js

@ -15,5 +15,15 @@ frappe.send_message = function(opts, btn) {
});
};
erpnext.subscribe_to_newsletter = function(opts, btn) {
return frappe.call({
type: "POST",
method: "erpnext.crm.doctype.newsletter.newsletter.subscribe",
btn: btn,
args: {"email": opts.email},
callback: opts.callback
});
}
// for backward compatibility
erpnext.send_message = frappe.send_message;

1
erpnext/setup/page/setup_wizard/setup_wizard.py

@ -197,6 +197,7 @@ def set_defaults(args):
"language": args.get("language"),
"time_zone": args.get("timezone"),
"float_precision": 3,
"email_footer_address": args.get("company"),
'date_format': frappe.db.get_value("Country", args.get("country"), "date_format"),
'number_format': number_format,
'enable_scheduler': 1 if not frappe.flags.in_test else 0

3
erpnext/stock/doctype/item/item.json

@ -575,6 +575,7 @@
"description": "Publish Item to hub.erpnext.com",
"fieldname": "publish_in_hub",
"fieldtype": "Check",
"hidden": 1,
"label": "Publish in Hub",
"permlevel": 0,
"precision": ""
@ -878,7 +879,7 @@
"icon": "icon-tag",
"idx": 1,
"max_attachments": 1,
"modified": "2015-05-04 18:44:46.090445",
"modified": "2015-05-22 02:16:57.435105",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

41
erpnext/templates/includes/footer_extension.html

@ -1,41 +0,0 @@
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-offset-3" style="margin-top: 7px;">
<div class="input-group">
<input class="form-control" type="text" id="footer-subscribe-email"
placeholder="{{ _('Your email address') }}...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"
id="footer-subscribe-button">{{ _("Stay Updated") }}</button>
</span>
</div>
</div>
</div>
</div>
<script>
$("#footer-subscribe-button").click(function() {
if($("#footer-subscribe-email").val()) {
$("#footer-subscribe-email").attr('disabled', true);
$("#footer-subscribe-button").html("Sending...")
.attr("disabled", true);
erpnext.send_message({
subject:"Subscribe me",
sender: $("#footer-subscribe-email").val(),
message: "Subscribe to newsletter (via website footer).",
callback: function(r) {
if(!r.exc) {
$("#footer-subscribe-button").html("Thank You :)")
.addClass("btn-success").attr("disabled", true);
} else {
$("#footer-subscribe-button").html("Error :( Not a valid id?")
.addClass("btn-danger").attr("disabled", false);
$("#footer-subscribe-email").val("").attr('disabled', false);
}
}
});
}
else
frappe.msgprint(frappe._("Please enter email address"))
});
</script>

1
erpnext/templates/includes/footer_powered.html

@ -1 +0,0 @@
<a href="http://erpnext.com" style="color: #aaa; font-size: 11px;">ERPNext Powered</a>
Loading…
Cancel
Save