added related page and other cleanups
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
index c653c3b..146599b 100644
--- a/erpnext/website/css/website.css
+++ b/erpnext/website/css/website.css
@@ -3,6 +3,10 @@
margin: auto;
}
+.layout_wrapper {
+ padding: 20px;
+}
+
footer {
width: 900px;
margin: auto;
@@ -12,6 +16,11 @@
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;
}
diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.py b/erpnext/website/doctype/about_us_settings/about_us_settings.py
index 31a26ce..8a31ff0 100644
--- a/erpnext/website/doctype/about_us_settings/about_us_settings.py
+++ b/erpnext/website/doctype/about_us_settings/about_us_settings.py
@@ -20,4 +20,5 @@
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))
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
index 8a22cc2..80b030a 100644
--- a/erpnext/website/doctype/blog/template.html
+++ b/erpnext/website/doctype/blog/template.html
@@ -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>
diff --git a/erpnext/website/doctype/contact_us_settings/contact_us_settings.py b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py
index 65d50db..d2fc3c4 100644
--- a/erpnext/website/doctype/contact_us_settings/contact_us_settings.py
+++ b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py
@@ -13,4 +13,5 @@
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))
diff --git a/erpnext/website/doctype/home_settings/template.html b/erpnext/website/doctype/home_settings/template.html
index d43f1ef..8129a50 100644
--- a/erpnext/website/doctype/home_settings/template.html
+++ b/erpnext/website/doctype/home_settings/template.html
@@ -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 }}
diff --git a/erpnext/website/doctype/related_page/__init__.py b/erpnext/website/doctype/related_page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/website/doctype/related_page/__init__.py
diff --git a/erpnext/website/doctype/related_page/related_page.txt b/erpnext/website/doctype/related_page/related_page.txt
new file mode 100644
index 0000000..3cb674f
--- /dev/null
+++ b/erpnext/website/doctype/related_page/related_page.txt
@@ -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'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index 8b0049b..c6e2014 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -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>
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
index d2ad6d3..754d3b8 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -18,13 +18,34 @@
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()
+
+ 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
- del self.doc.fields['main_section_html']
- del self.doc.fields['side_section_html']
-
\ No newline at end of file
+ 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]
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index aa08a8e..e2c839a 100644
--- a/erpnext/website/doctype/web_page/web_page.txt
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -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
@@ -99,6 +99,28 @@
# 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',
'fieldname': 'file_list',
'fieldtype': 'Text',
diff --git a/version.num b/version.num
index 98c1572..cfd6ea5 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-327
\ No newline at end of file
+335
\ No newline at end of file