added home template
This commit is contained in:
parent
9c7a01ade9
commit
4b1fe0528a
0
blank.html
Normal file
0
blank.html
Normal file
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import webnotes
|
import webnotes
|
||||||
def execute():
|
def execute():
|
||||||
|
cleanup_file_data()
|
||||||
|
return
|
||||||
update_patch_log()
|
update_patch_log()
|
||||||
from webnotes.modules import reload_doc
|
from webnotes.modules import reload_doc
|
||||||
reload_doc('website', 'Module Def', 'Website')
|
reload_doc('website', 'Module Def', 'Website')
|
||||||
@ -11,6 +13,11 @@ def execute():
|
|||||||
reload_doc('website', 'doctype', 'top_bar_item')
|
reload_doc('website', 'doctype', 'top_bar_item')
|
||||||
reload_doc('website', 'page', 'home')
|
reload_doc('website', 'page', 'home')
|
||||||
|
|
||||||
|
def cleanup_file_data():
|
||||||
|
webnotes.conn.commit()
|
||||||
|
webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
|
||||||
|
webnotes.conn.begin()
|
||||||
|
|
||||||
def update_patch_log():
|
def update_patch_log():
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
|
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
|
||||||
|
@ -50,4 +50,4 @@ def get_letter_heads():
|
|||||||
"""load letter heads with startup"""
|
"""load letter heads with startup"""
|
||||||
import webnotes
|
import webnotes
|
||||||
ret = webnotes.conn.sql("select name, content from `tabLetter Head` where ifnull(disabled,0)=0")
|
ret = webnotes.conn.sql("select name, content from `tabLetter Head` where ifnull(disabled,0)=0")
|
||||||
dict(ret)
|
return dict(ret)
|
||||||
|
@ -7,3 +7,15 @@ header .topbar .container {
|
|||||||
width: 900px;
|
width: 900px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.web-main-section {
|
||||||
|
width: 65%;
|
||||||
|
float: left;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.web-side-section {
|
||||||
|
width: 30%;
|
||||||
|
float: right;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
26
erpnext/website/doctype/home_settings/home_settings.py
Normal file
26
erpnext/website/doctype/home_settings/home_settings.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"""
|
||||||
|
generate home html
|
||||||
|
"""
|
||||||
|
|
||||||
|
class DocType:
|
||||||
|
def __init__(self, d, dl):
|
||||||
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
def on_update(self):
|
||||||
|
"""make home html"""
|
||||||
|
import os, jinja2, markdown2
|
||||||
|
import webnotes
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
@ -5,31 +5,29 @@
|
|||||||
{
|
{
|
||||||
'creation': '2012-01-24 15:56:06',
|
'creation': '2012-01-24 15:56:06',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-01-24 15:56:06',
|
'modified': '2012-01-25 13:31:56',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
|
'_last_update': '1327476129',
|
||||||
|
'allow_attach': 1,
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
'doctype': 'DocType',
|
'doctype': 'DocType',
|
||||||
'issingle': 1,
|
'issingle': 1,
|
||||||
|
'max_attachments': 5,
|
||||||
'module': 'Website',
|
'module': 'Website',
|
||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'section_style': 'Simple',
|
'section_style': 'Simple',
|
||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'version': 1
|
'version': 4
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
{
|
{
|
||||||
'colour': 'White:FFF',
|
|
||||||
'description': 'HTML that will appear on the top part of the home page. Usually should contain a headline and image.',
|
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'banner_html',
|
|
||||||
'fieldtype': 'Code',
|
|
||||||
'label': 'Banner HTML',
|
|
||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'parent': 'Home Settings',
|
'parent': 'Home Settings',
|
||||||
'parentfield': 'fields',
|
'parentfield': 'fields',
|
||||||
@ -70,6 +68,51 @@
|
|||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': 'DocField'
|
'colour': 'White:FFF',
|
||||||
|
'description': 'HTML that will appear on the top part of the home page. For no headline, leave blank',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'headline',
|
||||||
|
'fieldtype': 'Text',
|
||||||
|
'label': 'Headline'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'banner',
|
||||||
|
'fieldtype': 'Select',
|
||||||
|
'label': 'Banner',
|
||||||
|
'options': 'attach_files:'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'For formatting, use \n<a href="http://warpedvisions.org/projects/markdown-cheat-sheet/" \ntarget = "_blank">markdown</a>',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'main_section',
|
||||||
|
'fieldtype': 'Code',
|
||||||
|
'label': 'Main Section'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': 'White:FFF',
|
||||||
|
'description': 'For formatting, use \n<a href="http://warpedvisions.org/projects/markdown-cheat-sheet/" \ntarget = "_blank">markdown</a>',
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'side_section',
|
||||||
|
'fieldtype': 'Code',
|
||||||
|
'label': 'Side Section'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'file_list',
|
||||||
|
'fieldtype': 'Text',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': 'File List',
|
||||||
|
'no_copy': 1,
|
||||||
|
'print_hide': 1
|
||||||
}
|
}
|
||||||
]
|
]
|
17
erpnext/website/doctype/home_settings/template.html
Normal file
17
erpnext/website/doctype/home_settings/template.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div class="layout_wrapper">
|
||||||
|
<div id="content-home">
|
||||||
|
{% if doc.headline %}
|
||||||
|
<h1>{{ doc.headline }}</h1>
|
||||||
|
{% endif %}
|
||||||
|
{% if doc.banner %}
|
||||||
|
<img src="files/{{ doc.banner }}" style="width: 870px; margin-bottom: 20px" />
|
||||||
|
{% endif %}
|
||||||
|
<div class="web-main-section">
|
||||||
|
{{ doc.main_section_html }}
|
||||||
|
</div>
|
||||||
|
<div class="web-side-section">
|
||||||
|
{{ doc.side_section_html }}
|
||||||
|
</div>
|
||||||
|
<div style="clear: both"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,17 +0,0 @@
|
|||||||
#!python
|
|
||||||
|
|
||||||
from webnotes.model.doc import getsingle
|
|
||||||
from jinja2 import Template
|
|
||||||
|
|
||||||
|
|
||||||
temp = Template("""
|
|
||||||
<div class="layout_wrapper">
|
|
||||||
<div id="content-home">
|
|
||||||
{{ home_settings.banner_html }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
""")
|
|
||||||
|
|
||||||
out = {
|
|
||||||
"content": temp.render(home_settings = getsingle('Home Settings'))
|
|
||||||
}
|
|
@ -3,7 +3,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ERPNext</title>
|
<title>ERPNext</title>
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<script type="text/javascript">window._version_number="192";
|
<script type="text/javascript">window._version_number="201";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/class.js
|
* lib/js/wn/class.js
|
||||||
|
@ -1 +1 @@
|
|||||||
192
|
201
|
Loading…
x
Reference in New Issue
Block a user