mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-12 17:51:20 +00:00
added about us page and settings
This commit is contained in:
@@ -65,14 +65,6 @@ p, li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.website-missing-image {
|
||||
background-color: #eee;
|
||||
padding: 40px;
|
||||
width: 32px;
|
||||
font-size: 32px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
0
website/doctype/about_us_settings/__init__.py
Normal file
0
website/doctype/about_us_settings/__init__.py
Normal file
18
website/doctype/about_us_settings/about_us_settings.py
Normal file
18
website/doctype/about_us_settings/about_us_settings.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from website.utils import url_for_website
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def onload(self):
|
||||
"""load employee"""
|
||||
emp_list = []
|
||||
for d in self.doclist.get({"doctype":"About Us Team Member"}):
|
||||
emp = webnotes.doc("Employee", d.employee)
|
||||
emp.image = url_for_website(emp.image)
|
||||
emp_list.append(emp)
|
||||
self.doclist += emp_list
|
||||
98
website/doctype/about_us_settings/about_us_settings.txt
Normal file
98
website/doctype/about_us_settings/about_us_settings.txt
Normal file
@@ -0,0 +1,98 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:24:35",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 15:51:11"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
"description": "Settings for the About Us Page",
|
||||
"doctype": "DocType",
|
||||
"module": "Website",
|
||||
"document_type": "Master",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "About Us Settings",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"parent": "About Us Settings",
|
||||
"read": 1,
|
||||
"name": "__common__",
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"role": "Website Manager",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "About Us Settings",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"description": "Introduce your company to the website visitor.",
|
||||
"doctype": "DocField",
|
||||
"label": "Company Introduction",
|
||||
"fieldname": "company_introduction",
|
||||
"fieldtype": "Text Editor"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company History",
|
||||
"fieldname": "sb0",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "\"Company History\"",
|
||||
"doctype": "DocField",
|
||||
"label": "Company History Heading",
|
||||
"fieldname": "company_history_heading",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company History",
|
||||
"fieldname": "company_history",
|
||||
"fieldtype": "Table",
|
||||
"options": "Company History"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members",
|
||||
"fieldname": "sb1",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "\"Team Members\" or \"Management\"",
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members Heading",
|
||||
"fieldname": "team_members_heading",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members",
|
||||
"fieldname": "team_members",
|
||||
"fieldtype": "Table",
|
||||
"options": "About Us Team Member"
|
||||
},
|
||||
{
|
||||
"description": "More content for the bottom of the page.",
|
||||
"doctype": "DocField",
|
||||
"label": "Footer",
|
||||
"fieldname": "footer",
|
||||
"fieldtype": "Text Editor"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
0
website/doctype/about_us_team_member/__init__.py
Normal file
0
website/doctype/about_us_team_member/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# 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
|
||||
@@ -0,0 +1,35 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:28:45",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 14:49:44"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"name": "__common__",
|
||||
"doctype": "DocType",
|
||||
"module": "Website"
|
||||
},
|
||||
{
|
||||
"parent": "About Us Team Member",
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"label": "Employee",
|
||||
"width": "300px",
|
||||
"parenttype": "DocType",
|
||||
"options": "Employee",
|
||||
"fieldname": "employee",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "About Us Team Member",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField"
|
||||
}
|
||||
]
|
||||
0
website/doctype/company_history/__init__.py
Normal file
0
website/doctype/company_history/__init__.py
Normal file
8
website/doctype/company_history/company_history.py
Normal file
8
website/doctype/company_history/company_history.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# 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
|
||||
40
website/doctype/company_history/company_history.txt
Normal file
40
website/doctype/company_history/company_history.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:25:38",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 14:25:38"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"name": "__common__",
|
||||
"doctype": "DocType",
|
||||
"module": "Website"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Company History",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "Company History",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Year",
|
||||
"fieldname": "year",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Highlight",
|
||||
"width": "300px",
|
||||
"fieldname": "highlight",
|
||||
"fieldtype": "Text"
|
||||
}
|
||||
]
|
||||
@@ -20,11 +20,11 @@
|
||||
<br>
|
||||
<h5><a href="#Form/Product Settings">Product Settings</a></h5>
|
||||
<p class="help">Settings for Product Catalog on the website.</p>
|
||||
<br>
|
||||
<h5><a href="#Form/About Us Settings">About Us Settings</a></h5>
|
||||
<p class="help">Settings for About Us Page.</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<hr>
|
||||
<h3>Reports</h3>
|
||||
<div class="reports-list"></div>
|
||||
</div>
|
||||
<div class="layout-side-section">
|
||||
<div class="psidebar">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="well well-small">
|
||||
<div class="container-fluid" style="padding-left: 0px; margin-left:-10px; line-height: 2em;">
|
||||
{% for d in sub_groups %}
|
||||
<div class="span2">
|
||||
<div class="span4">
|
||||
<a href="{{ d.page_name }}">{{ d.name }} ({{ d.count }})</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<div class='website-missing-image'><i class='icon-camera'></i></div>
|
||||
<div class='missing-image'><i class='icon-camera'></i></div>
|
||||
40
website/templates/pages/about.html
Normal file
40
website/templates/pages/about.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{% extends "html/page.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="layout-wrapper">
|
||||
<div class="layout-main">
|
||||
{% if obj.doc.company_introduction %}
|
||||
{{ obj.doc.company_introduction }}
|
||||
{% endif %}
|
||||
{% if obj.doclist.get({"doctype":"Company History"}) %}
|
||||
<h3>{{ obj.doc.company_history_heading or "Company History" }}</h3>
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
{% for d in obj.doclist.get({"doctype":"Company History"}) %}
|
||||
<tr>
|
||||
<td style="width: 30%; text-align: right"><h4>{{ d.year }}</h4></td>
|
||||
<td>{{ d.highlight }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% if obj.doclist.get({"doctype":"Employee"}) %}
|
||||
<h3>{{ obj.doc.team_members_heading or "Team Members" }}</h3>
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
{% for d in obj.doclist.get({"doctype":"Employee"}) %}
|
||||
<tr>
|
||||
<td style="text-align:right; width: 30%;">
|
||||
<img src="{{ d.image }}" style=""></td>
|
||||
<td><h4>{{ d.employee_name }}</h4>
|
||||
{{ d.bio }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{{ obj.doc.footer or "" }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -40,6 +40,10 @@ page_map = {
|
||||
})
|
||||
}
|
||||
|
||||
page_settings_map = {
|
||||
"about": "About Us Settings"
|
||||
}
|
||||
|
||||
def render(page_name):
|
||||
"""render html page"""
|
||||
try:
|
||||
@@ -98,6 +102,10 @@ def update_page_name(doc, title):
|
||||
"""set page_name and check if it is unique"""
|
||||
webnotes.conn.set(doc, "page_name", page_name(title))
|
||||
|
||||
standard_pages = get_template_pages()
|
||||
if doc.page_name in standard_pages:
|
||||
webnotes.conn.sql("""Page Name cannot be one of %s""" % ', '.join(standard_pages))
|
||||
|
||||
res = webnotes.conn.sql("""\
|
||||
select count(*) from `tab%s`
|
||||
where page_name=%s and name!=%s""" % (doc.doctype, '%s', '%s'),
|
||||
@@ -135,10 +143,12 @@ def prepare_args(page_name):
|
||||
page_name = get_home_page()
|
||||
|
||||
if page_name in get_template_pages():
|
||||
args = {
|
||||
args = webnotes._dict({
|
||||
'template': 'pages/%s.html' % page_name,
|
||||
'name': page_name,
|
||||
}
|
||||
})
|
||||
if page_name in page_settings_map:
|
||||
args.obj = webnotes.model_wrapper(page_settings_map[page_name]).obj
|
||||
else:
|
||||
args = get_doc_fields(page_name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user