added website.page.contact
This commit is contained in:
parent
4b1fe0528a
commit
949496c31b
@ -1,3 +0,0 @@
|
||||
# version info
|
||||
|
||||
version='1.0.0'
|
@ -145,8 +145,10 @@ SidebarItem.prototype.onclick = function() {
|
||||
// page type
|
||||
this.pointer.select();
|
||||
|
||||
$item_set_working(me.pointer.label_area);
|
||||
loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
|
||||
$(me.pointer.label_area).set_working();
|
||||
loadpage(this.det.module_page, function() {
|
||||
$(me.pointer.label_area).done_working();
|
||||
});
|
||||
|
||||
} else {
|
||||
// show sub items
|
||||
@ -190,7 +192,7 @@ SidebarItem.prototype.show_items = function() {
|
||||
this.loading = 1;
|
||||
var me = this;
|
||||
|
||||
$item_set_working(this.pointer.label_area);
|
||||
$(this.pointer.label_area).set_working();
|
||||
var callback = function(r,rt){
|
||||
me.loaded = 1;
|
||||
me.loading = 0;
|
||||
@ -199,7 +201,7 @@ SidebarItem.prototype.show_items = function() {
|
||||
var has_tools = 0;
|
||||
|
||||
// widget code
|
||||
$item_done_working(me.pointer.label_area);
|
||||
$(me.pointer.label_area).done_working();
|
||||
|
||||
if(r.message.il) {
|
||||
me.il = r.message.il;
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2012-01-23 17:05:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-24 15:57:51',
|
||||
'modified': '2012-01-25 16:12:14',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
# These values are common for all Module Def Item
|
||||
{
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item',
|
||||
'name': '__common__',
|
||||
'parent': 'Website',
|
||||
@ -48,7 +49,6 @@
|
||||
{
|
||||
'display_name': 'Top Bar Settings',
|
||||
'doc_name': 'Top Bar Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
@ -56,7 +56,13 @@
|
||||
{
|
||||
'display_name': 'Home Settings',
|
||||
'doc_name': 'Home Settings',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Contact Us Settings',
|
||||
'doc_name': 'Contact Us Settings',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
|
@ -8,6 +8,10 @@ header .topbar .container {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.web-content input[type="text"], .web-content input[type="password"], .web-content select {
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.web-main-section {
|
||||
width: 65%;
|
||||
float: left;
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
generate html
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
"""make home html"""
|
||||
from website.utils import make_template
|
||||
import os
|
||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
||||
|
||||
webnotes.conn.set_value('Page', 'contact', 'content', make_template(self.doc, path))
|
@ -0,0 +1,100 @@
|
||||
# DocType, Contact Us Settings
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-25 16:01:33',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-25 16:01:33',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Other',
|
||||
'issingle': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Contact Us Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Contact Us Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Contact Us Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Contact Us Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'Website Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Contact Us',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'headline',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Headline'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'send_email_notification',
|
||||
'fieldtype': 'Check',
|
||||
'label': 'Send Email Notification'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'main_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Main Section'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'side_section',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Side Section'
|
||||
}
|
||||
]
|
24
erpnext/website/doctype/contact_us_settings/template.html
Normal file
24
erpnext/website/doctype/contact_us_settings/template.html
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="layout_wrapper">
|
||||
<div class="web-content" id="content-contact-us">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
<label>Your Name*</label>
|
||||
<div><input name="contact-name" type="text"/></div>
|
||||
<br>
|
||||
<label>Email*</label>
|
||||
<div><input name="contact-email" type="text"/></div>
|
||||
<br>
|
||||
<label>Message*</label>
|
||||
<div><textarea name="contact-message" style="height: 200px"></textarea></div>
|
||||
<br>
|
||||
<div><button class="btn primary">Send</button></div>
|
||||
{{ doc.main_section_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
@ -1,6 +1,7 @@
|
||||
"""
|
||||
generate home html
|
||||
generate html
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@ -8,19 +9,9 @@ class DocType:
|
||||
|
||||
def on_update(self):
|
||||
"""make home html"""
|
||||
import os, jinja2, markdown2
|
||||
import webnotes
|
||||
from website.utils import make_template
|
||||
import os
|
||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
||||
|
||||
# markdown
|
||||
self.doc.main_section_html = markdown2.markdown(self.doc.main_section or '', \
|
||||
extras=["wiki-tables"])
|
||||
self.doc.side_section_html = markdown2.markdown(self.doc.side_section or '', \
|
||||
extras=["wiki-tables"])
|
||||
|
||||
# write template
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
|
||||
temp = jinja2.Template(f.read())
|
||||
|
||||
html = temp.render(doc = self.doc.fields)
|
||||
webnotes.conn.set_value('Page', 'Home', 'content', html)
|
||||
webnotes.conn.set_value('Page', 'home', 'content', make_template(self.doc, path))
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="content-home">
|
||||
<div class="web-content" id="content-home">
|
||||
{% if doc.headline %}
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
|
0
erpnext/website/page/contact/__init__.py
Normal file
0
erpnext/website/page/contact/__init__.py
Normal file
30
erpnext/website/page/contact/contact.js
Normal file
30
erpnext/website/page/contact/contact.js
Normal file
@ -0,0 +1,30 @@
|
||||
pscript.onload_contact = function(wrapper) {
|
||||
$('#content-contact-us .btn.primary').click(function() {
|
||||
var me = this;
|
||||
var args = {};
|
||||
args.name = $('#content-contact-us [name="contact-name"]').val();
|
||||
args.email = $('#content-contact-us [name="contact-email"]').val();
|
||||
args.message = $('#content-contact-us [name="contact-message"]').val();
|
||||
|
||||
if(!validate_email(args.email)) {
|
||||
msgprint('Please enter a valid email id');
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.name && args.email && args.message) {
|
||||
$(this).set_working();
|
||||
$c_page('website', 'contact', 'send', args, function(r) {
|
||||
$('#content-contact-us [name*="contact"]').val('');
|
||||
$(me).done_working();
|
||||
});
|
||||
} else {
|
||||
msgprint("Please enter info in all the fields.")
|
||||
}
|
||||
});
|
||||
|
||||
$('#content-contact-us :input').keyup(function(ev) {
|
||||
if(ev.which == 13) {
|
||||
$('#content-contact-us .btn.primary').click();
|
||||
}
|
||||
});
|
||||
}
|
15
erpnext/website/page/contact/contact.py
Normal file
15
erpnext/website/page/contact/contact.py
Normal file
@ -0,0 +1,15 @@
|
||||
import json, webnotes
|
||||
|
||||
def send(args):
|
||||
"""create support ticket"""
|
||||
args = json.loads(args)
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
d = Document('Support Ticket')
|
||||
d.raised_by = args['email']
|
||||
d.description = 'From: ' + args['name'] + '\n\n' + args['message']
|
||||
d.subject = 'Website Query'
|
||||
d.status = 'Open'
|
||||
d.owner = 'Guest'
|
||||
d.save(1)
|
||||
webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
|
42
erpnext/website/page/contact/contact.txt
Normal file
42
erpnext/website/page/contact/contact.txt
Normal file
@ -0,0 +1,42 @@
|
||||
# Page, contact
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-25 16:02:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-25 16:02:15',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'page_name': 'contact',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'contact',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page',
|
||||
'role': 'Guest'
|
||||
},
|
||||
|
||||
# Page, contact
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'contact'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role'
|
||||
}
|
||||
]
|
14
erpnext/website/utils.py
Normal file
14
erpnext/website/utils.py
Normal file
@ -0,0 +1,14 @@
|
||||
def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
|
||||
"""make template"""
|
||||
import os, jinja2, markdown2
|
||||
|
||||
# markdown
|
||||
for f in convert_fields:
|
||||
doc.fields[f + '_html'] = markdown2.markdown(doc.fields[f] or '', \
|
||||
extras=["wiki-tables"])
|
||||
|
||||
# write template
|
||||
with open(path, 'r') as f:
|
||||
temp = jinja2.Template(f.read())
|
||||
|
||||
return temp.render(doc = doc.fields)
|
@ -3,7 +3,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>ERPNext</title>
|
||||
<meta name="author" content="">
|
||||
<script type="text/javascript">window._version_number="201";
|
||||
<script type="text/javascript">window._version_number="211";
|
||||
|
||||
/*
|
||||
* lib/js/wn/class.js
|
||||
|
@ -1 +1 @@
|
||||
201
|
||||
211
|
Loading…
x
Reference in New Issue
Block a user