diff --git a/utilities/doctype/address/address.py b/utilities/doctype/address/address.py index ae0f2177b6..243bbdd7e3 100644 --- a/utilities/doctype/address/address.py +++ b/utilities/doctype/address/address.py @@ -25,23 +25,19 @@ class DocType: self.doclist = doclist def autoname(self): - if self.doc.customer: - self.doc.name = self.doc.customer + '-' + self.doc.address_type - elif self.doc.supplier: - self.doc.name = self.doc.supplier + '-' + self.doc.address_type - elif self.doc.sales_partner: - self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type - elif self.doc.address_title: - self.doc.address_title = self.doc.address_title + "-" + self.doc.address_type + if not self.doc.address_title: + self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner + + if self.doc.address_title: + self.doc.name = self.doc.address_title + "-" + self.doc.address_type + + else: + webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True) + def validate(self): - self.validate_for_whom() self.validate_primary_address() self.validate_shipping_address() - - def validate_for_whom(self): - if not (self.doc.customer or self.doc.supplier or self.doc.sales_partner): - msgprint("Please enter value in atleast one of customer, supplier and sales partner field", raise_exception=1) def validate_primary_address(self): """Validate that there can only be one primary address for particular customer, supplier""" diff --git a/utilities/doctype/address/address.txt b/utilities/doctype/address/address.txt index f77f3975b9..8ab6431948 100644 --- a/utilities/doctype/address/address.txt +++ b/utilities/doctype/address/address.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-07-03 13:30:41", "modified_by": "Administrator", - "modified": "2012-12-27 11:31:37" + "modified": "2012-12-27 18:08:55" }, { "name": "__common__", @@ -55,6 +55,7 @@ "label": "Address Title", "fieldname": "address_title", "fieldtype": "Data", + "reqd": 1, "permlevel": 0 }, { @@ -214,60 +215,6 @@ "fieldtype": "Link", "permlevel": 0 }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "System Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Sales Master Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Purchase Master Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Maintenance Manager", - "cancel": 0, - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Accounts Manager", - "cancel": 0, - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Sales Manager", - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "Purchase Manager", - "permlevel": 0 - }, { "create": 1, "doctype": "DocPerm", diff --git a/website/doctype/about_us_settings/about_us_settings.txt b/website/doctype/about_us_settings/about_us_settings.txt index 9facfbb4a1..e0c1d4c2cc 100644 --- a/website/doctype/about_us_settings/about_us_settings.txt +++ b/website/doctype/about_us_settings/about_us_settings.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-12-27 14:24:35", "modified_by": "Administrator", - "modified": "2012-12-27 15:51:11" + "modified": "2012-12-27 17:44:55" }, { "issingle": 1, @@ -38,6 +38,13 @@ "name": "About Us Settings", "doctype": "DocType" }, + { + "doctype": "DocField", + "label": "Help", + "fieldname": "help", + "fieldtype": "HTML", + "options": "
Link for About Us Page is \"about.html\"
" + }, { "description": "Introduce your company to the website visitor.", "doctype": "DocField", diff --git a/website/doctype/contact_us_settings/__init__.py b/website/doctype/contact_us_settings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/contact_us_settings/contact_us_settings.py b/website/doctype/contact_us_settings/contact_us_settings.py new file mode 100644 index 0000000000..0d2625a909 --- /dev/null +++ b/website/doctype/contact_us_settings/contact_us_settings.py @@ -0,0 +1,17 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl + + def onload(self): + """load address""" + if self.doc.query_options: + self.doc.query_options = filter(None, self.doc.query_options.replace(",", "\n").split()) + else: + self.doc.query_options = ["Sales", "Support", "General"] + if self.doc.address: + self.address = webnotes.model_wrapper("Address", self.doc.address).doc \ No newline at end of file diff --git a/website/doctype/contact_us_settings/contact_us_settings.txt b/website/doctype/contact_us_settings/contact_us_settings.txt new file mode 100644 index 0000000000..cdad57af05 --- /dev/null +++ b/website/doctype/contact_us_settings/contact_us_settings.txt @@ -0,0 +1,72 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 17:43:10", + "modified_by": "Administrator", + "modified": "2012-12-27 17:57:55" + }, + { + "issingle": 1, + "description": "Settings for Contact Us Page", + "doctype": "DocType", + "module": "Website", + "name": "__common__" + }, + { + "name": "__common__", + "parent": "Contact Us Settings", + "doctype": "DocField", + "parenttype": "DocType", + "permlevel": 0, + "parentfield": "fields" + }, + { + "parent": "Contact Us Settings", + "read": 1, + "name": "__common__", + "create": 1, + "doctype": "DocPerm", + "write": 1, + "parenttype": "DocType", + "role": "Website Manager", + "permlevel": 0, + "parentfield": "permissions" + }, + { + "name": "Contact Us Settings", + "doctype": "DocType" + }, + { + "doctype": "DocField", + "label": "Help", + "fieldname": "help", + "fieldtype": "HTML", + "options": "
Link for Contact Page is \"contact.html\"
" + }, + { + "description": "Address to be displayed on the Contact Page", + "doctype": "DocField", + "label": "Address", + "fieldname": "address", + "fieldtype": "Link", + "options": "Address" + }, + { + "description": "Contact options, like \"Sales Query, Support Query\" etc each on a new line or separated by commas.", + "doctype": "DocField", + "label": "Query Options", + "fieldname": "query_options", + "fieldtype": "Small Text" + }, + { + "description": "Introductory information for the Contact Us Page", + "doctype": "DocField", + "label": "Introduction", + "fieldname": "introduction", + "fieldtype": "Text Editor" + }, + { + "doctype": "DocPerm" + } +] \ No newline at end of file diff --git a/website/page/website_home/website_home.html b/website/page/website_home/website_home.html index e4c86b00c6..0fde113765 100644 --- a/website/page/website_home/website_home.html +++ b/website/page/website_home/website_home.html @@ -6,7 +6,7 @@

Static (content) web page.


Blog
-

Weblog (blog) entr.y

+

Weblog (blog) entry.


Website Slideshow

Slideshows for adding in website pages.

@@ -23,6 +23,9 @@
About Us Settings

Settings for About Us Page.

+
+
Contact Us Settings
+

Settings for the Contact Us Page.

diff --git a/website/templates/js/contact.js b/website/templates/js/contact.js new file mode 100644 index 0000000000..f7310ad7e4 --- /dev/null +++ b/website/templates/js/contact.js @@ -0,0 +1,37 @@ +$(document).ready(function() { + + $('.btn-send').click(function() { + var email = $('[name="email"]').val(); + var message = $('[name="message"]').val(); + + if(!(email && message)) { + msgprint("Please enter both your email and message so that we \ + can get back to you. Thanks!"); + return false; + } + + if(!valid_email(email)) { + msgprint("You seem to have written your name instead of your email. \ + Please enter a valid email address so that we can get back."); + $('[name="email"]').focus(); + return false; + } + + $("#contact-alert").toggle(false); + erpnext.send_message({ + subject: $('[name="subject"]').val(), + sender: email, + message: message, + callback: function(r) { + msgprint(r.message); + $(':input').val(''); + } + }); + return false; + }); + +}); + +var msgprint = function(txt) { + if(txt) $("#contact-alert").html(txt).toggle(true); +} diff --git a/website/templates/pages/about.html b/website/templates/pages/about.html index f4b6e307f7..669aed944c 100644 --- a/website/templates/pages/about.html +++ b/website/templates/pages/about.html @@ -1,11 +1,13 @@ {% extends "html/page.html" %} +{% block title %} +About Us +{% endblock %} + {% block content %}
- {% if obj.doc.company_introduction %} - {{ obj.doc.company_introduction }} - {% endif %} + {{ obj.doc.company_introduction or "Some Introduction about your company that you would like your website visitor to know. More people than you think will read your About page. People always like to know who the are doing business with. Be authentic and avoid using jargon like 'value added services' etc. Be sure to update your company history and list of key team members in Website > About Us Settings" }} {% if obj.doclist.get({"doctype":"Company History"}) %}

{{ obj.doc.company_history_heading or "Company History" }}

@@ -24,11 +26,11 @@
{% for d in obj.doclist.get({"doctype":"Employee"}) %} - + - + + {% endfor %} diff --git a/website/templates/pages/contact.html b/website/templates/pages/contact.html new file mode 100644 index 0000000000..e5ba27c5fb --- /dev/null +++ b/website/templates/pages/contact.html @@ -0,0 +1,56 @@ +{% extends "html/page.html" %} + +{% block javascript %} + {% include "js/contact.js" %} +{% endblock %} + +{% block title %} +Contact Us +{% endblock %} + +{% block content %} +
+
+
+ {{ obj.doc.introduction or "

Contact Us

"}} +
+ +
+
+

+

+

+

+
+ {% if obj.doc.address %} +
+

{{ obj.address.address_title }}

+ {% if obj.address.address_line1 %} +

{{ obj.address.address_line1 }}

+ {% endif %} + {% if obj.address.address_line2 %} +

{{ obj.address.address_line2 }}

+ {% endif %} + {% if obj.address.city %} +

{{ obj.address.city }}

+ {% endif %} + {% if obj.address.state %} +

{{ obj.address.state }}

+ {% endif %} + {% if obj.address.pincode %} +

{{ obj.address.pincode }}

+ {% endif %} + {% if obj.address.country %} +

{{ obj.address.country }}

+ {% endif %} +
+ {% endif %} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/website/utils.py b/website/utils.py index 52a0898a75..ec33103e29 100644 --- a/website/utils.py +++ b/website/utils.py @@ -41,7 +41,8 @@ page_map = { } page_settings_map = { - "about": "About Us Settings" + "about": "About Us Settings", + "contact": "Contact Us Settings" } def render(page_name):
-

{{ d.employee_name }}

- {{ d.bio }}

{{ d.employee_name }}

+
{{ d.bio }}