added related page and other cleanups
This commit is contained in:
parent
9c69914cf6
commit
d47e1d14b7
@ -3,6 +3,10 @@
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.layout_wrapper {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
@ -12,6 +16,11 @@ header .topbar .container {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.web-home-banner {
|
||||
width: 860px;
|
||||
margin-bottom: 20px
|
||||
}
|
||||
|
||||
.web-content input[type="text"], .web-content input[type="password"], .web-content select {
|
||||
min-width: 180px;
|
||||
}
|
||||
|
@ -20,4 +20,5 @@ class DocType:
|
||||
for t in self.doc.about_team:
|
||||
t['bio'] = markdown2.markdown(t['bio'])
|
||||
|
||||
webnotes.conn.set_value('Page', 'about', 'title', self.doc.headline)
|
||||
webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path))
|
||||
|
@ -7,6 +7,7 @@
|
||||
{{ doc.content_html }}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
<p><a href="#!blog">All Blogs</a></p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
@ -13,4 +13,5 @@ class DocType:
|
||||
import os
|
||||
path = os.path.join(os.path.dirname(__file__), 'template.html')
|
||||
|
||||
webnotes.conn.set_value('Page', 'contact', 'title', self.doc.headline)
|
||||
webnotes.conn.set_value('Page', 'contact', 'content', make_template(self.doc, path))
|
||||
|
@ -4,7 +4,7 @@
|
||||
<h1>{{ doc.headline }}</h1>
|
||||
{% endif %}
|
||||
{% if doc.banner %}
|
||||
<img src="files/{{ doc.banner }}" style="width: 870px; margin-bottom: 20px" />
|
||||
<img src="files/{{ doc.banner }}" class="web-home-banner" />
|
||||
{% endif %}
|
||||
<div class="web-main-section">
|
||||
{{ doc.main_section_html }}
|
||||
|
0
erpnext/website/doctype/related_page/__init__.py
Normal file
0
erpnext/website/doctype/related_page/__init__.py
Normal file
49
erpnext/website/doctype/related_page/related_page.txt
Normal file
49
erpnext/website/doctype/related_page/related_page.txt
Normal file
@ -0,0 +1,49 @@
|
||||
# DocType, Related Page
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-01 16:16:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-01 16:16:48',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'page',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'Page',
|
||||
'name': '__common__',
|
||||
'options': 'Page',
|
||||
'parent': 'Related Page',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Related Page
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Related Page'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField'
|
||||
}
|
||||
]
|
@ -4,10 +4,18 @@
|
||||
<br>
|
||||
<div class="web-main-section">
|
||||
{{ doc.main_section_html }}
|
||||
{% if doc.next_page_html %}
|
||||
{{ doc.next_page_html }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="web-side-section">
|
||||
{{ doc.side_section_html }}
|
||||
{% if doc.see_also %}
|
||||
<h4>See Also</h4>
|
||||
{{ doc.see_also }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="clear: both">
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
</div>
|
@ -18,13 +18,34 @@ class DocType:
|
||||
|
||||
website.utils.markdown(self.doc, ['main_section', 'side_section'])
|
||||
|
||||
self.add_page_links()
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
|
||||
p.content = Template(f.read()).render(doc=self.doc)
|
||||
|
||||
p.save()
|
||||
|
||||
website.utils.add_guest_access_to_page(p.name)
|
||||
self.cleanup_temp()
|
||||
|
||||
del self.doc.fields['main_section_html']
|
||||
del self.doc.fields['side_section_html']
|
||||
def add_page_links(self):
|
||||
"""add links for next_page and see_also"""
|
||||
if self.doc.next_page:
|
||||
self.doc.next_page_html = """<div class="info-box round">
|
||||
<p style="text-align: right"><b>Next:</b>
|
||||
<a href="#!%(name)s">%(title)s</a></p></div>""" % {"name":self.doc.next_page, \
|
||||
"title": webnotes.conn.get_value("Page", self.doc.next_page, "title")}
|
||||
|
||||
self.doc.see_also = ''
|
||||
for l in webnotes.conn.sql("""select distinct t1.page, t2.title from
|
||||
`tabRelated Page` t1, tabPage t2 where
|
||||
t1.page = t2.name order by t2.title""", as_dict=1):
|
||||
self.doc.see_also += """<p><a href="#!%(page)s">%(title)s</a></p>""" % l
|
||||
|
||||
def cleanup_temp(self):
|
||||
"""cleanup temp fields"""
|
||||
fl = ['main_section_html', 'side_section_html', 'see_also', 'next_page_html']
|
||||
for f in fl:
|
||||
if f in self.doc.fields:
|
||||
del self.doc.fields[f]
|
||||
|
@ -5,14 +5,14 @@
|
||||
{
|
||||
'creation': '2012-01-31 15:18:49',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-31 15:48:50',
|
||||
'modified': '2012-02-01 16:19:39',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1328003330',
|
||||
'_last_update': '1328093309',
|
||||
'allow_attach': 1,
|
||||
'colour': 'White:FFF',
|
||||
'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n',
|
||||
@ -22,7 +22,7 @@
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 3
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -97,6 +97,28 @@
|
||||
'label': 'Side Section'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Link for next page appears at the bottom of the page',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'next_page',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'Next Page',
|
||||
'options': 'Page'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Related pages appear on the right side of the link and are linked both ways.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'related_pages',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Related Pages',
|
||||
'options': 'Related Page'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
|
@ -1 +1 @@
|
||||
327
|
||||
335
|
Loading…
Reference in New Issue
Block a user