added website settings, refactored home
diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py
index 55a1aef..29209bc 100644
--- a/erpnext/patches/jan_mar_2012/website.py
+++ b/erpnext/patches/jan_mar_2012/website.py
@@ -11,8 +11,8 @@
from webnotes.modules import reload_doc
reload_doc('website', 'Role', 'Website Manager')
reload_doc('website', 'Module Def', 'Website')
- reload_doc('website', 'doctype', 'home_settings')
- reload_doc('website', 'doctype', 'top_bar_settings')
+ reload_doc('website', 'doctype', 'website_settings')
+ reload_doc('website', 'doctype', 'style_settings')
reload_doc('website', 'doctype', 'top_bar_item')
reload_doc('website', 'doctype', 'contact_us_settings')
reload_doc('website', 'doctype', 'about_us_settings')
@@ -22,7 +22,6 @@
reload_doc('website', 'doctype', 'product')
reload_doc('website', 'doctype', 'web_page')
- reload_doc('website', 'page', 'home')
reload_doc('website', 'page', 'contact')
reload_doc('website', 'page', 'about')
reload_doc('website', 'page', 'blog')
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 1bdbcb4..d9fb451 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -40,10 +40,11 @@
import webnotes.model.doc
if webnotes.session['user']=='Guest':
- bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings')
- bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page,
+ bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings')
+ bootinfo['website_menus'] = webnotes.conn.sql("""select label, std_page, custom_page,
parent_label, parentfield
- from `tabTop Bar Item` where parent='Top Bar Settings' order by idx asc""", as_dict=1)
+ from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1)
+ bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
else:
bootinfo['letter_heads'] = get_letter_heads()
diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js
index 9503dbe..c22aee0 100644
--- a/erpnext/startup/modules.js
+++ b/erpnext/startup/modules.js
@@ -55,7 +55,7 @@
var body_background = '#e2e2e2';
MenuPointer = function(parent, label) {
-
+ var me = this;
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
$br(this.wrapper, '3px');
@@ -73,8 +73,10 @@
$(this.wrapper)
.hover(
- function() { if(!this.selected)$bg(this, '#eee'); } ,
- function() { if(!this.selected)$bg(this, body_background); }
+ function() { if(!me.selected)
+ $bg(this, '#eee'); } ,
+ function() { if(!me.selected)
+ $bg(this, body_background); }
)
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
@@ -84,9 +86,10 @@
// ====================================================================
MenuPointer.prototype.select = function(grey) {
- $y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
- //$gr(this.wrapper, '#F84', '#F63');
- $gr(this.wrapper, '#888', '#666');
+ $y($td(this.tab, 0, 0), {
+ color:'#fff', borderBottom:'0px solid #000'
+ });
+ $(this.wrapper).css('background-color', '#999');
this.selected = 1;
if(cur_menu_pointer && cur_menu_pointer != this)
@@ -99,7 +102,7 @@
MenuPointer.prototype.deselect = function() {
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
- $gr(this.wrapper, body_background, body_background);
+ $(this.wrapper).css('background-color', body_background);
this.selected = 0;
}
diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css
index 24d3800..4f66519 100644
--- a/erpnext/startup/startup.css
+++ b/erpnext/startup/startup.css
@@ -1,13 +1,17 @@
-h1, h2, h3, h4 {
+h1, h2, h3, h4, h5 {
font-family: Tahoma, Arial, Verdana, sans-serif;
font-weight: bold;
}
-body, span, div, td, input, textarea, button, select {
+body {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
font-size: 12px;
}
+span, div, td, input, textarea, button, select {
+ font-family: inherit;
+}
+
body {
background-color: #e2e2e2;
}
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 70dcfc4..cbb03a1 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -19,6 +19,12 @@
$dh(page_body.left_sidebar);
wn.require('erpnext/website/css/website.css');
wn.require('erpnext/website/js/topbar.js');
+ if(wn.boot.custom_css) {
+ set_style(wn.boot.custom_css);
+ }
+ if(wn.boot.website_settings.title_prefix) {
+ wn.title_prefix = wn.boot.website_settings.title_prefix;
+ }
} else {
// modules
wn.require('erpnext/startup/modules.js');
diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt
index 8ac31c7..e423869 100644
--- a/erpnext/website/Module Def/Website/Website.txt
+++ b/erpnext/website/Module Def/Website/Website.txt
@@ -5,7 +5,7 @@
{
'creation': '2012-01-23 17:05:32',
'docstatus': 0,
- 'modified': '2012-01-31 15:19:28',
+ 'modified': '2012-02-02 13:23:41',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -46,14 +46,6 @@
# Module Def Item
{
- 'display_name': 'Top Bar Settings',
- 'doc_name': 'Top Bar Settings',
- 'doc_type': 'Single DocType',
- 'doctype': 'Module Def Item'
- },
-
- # Module Def Item
- {
'display_name': 'Web Page',
'doc_name': 'Web Page',
'doc_type': 'Forms',
@@ -78,6 +70,22 @@
# Module Def Item
{
+ 'display_name': 'Style Settings',
+ 'doc_name': 'Style Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
+ 'display_name': 'Website Settings',
+ 'doc_name': 'Website Settings',
+ 'doc_type': 'Single DocType',
+ 'doctype': 'Module Def Item'
+ },
+
+ # Module Def Item
+ {
'display_name': 'Home Settings',
'doc_name': 'Home Settings',
'doc_type': 'Single DocType',
@@ -102,14 +110,6 @@
# Module Def Item
{
- 'display_name': 'About Us Settings',
- 'doc_name': 'About Us Settings',
- 'doc_type': 'Single DocType',
- 'doctype': 'Module Def Item'
- },
-
- # Module Def Item
- {
'display_name': 'Products Settings',
'doc_name': 'Products Settings',
'doc_type': 'Single DocType',
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
index 146599b..cdea087 100644
--- a/erpnext/website/css/website.css
+++ b/erpnext/website/css/website.css
@@ -7,6 +7,10 @@
padding: 20px;
}
+h1 {
+ margin-bottom: 15px;
+}
+
footer {
width: 900px;
margin: auto;
@@ -16,8 +20,7 @@
margin: auto;
}
-.web-home-banner {
- width: 860px;
+.web-head-section {
margin-bottom: 20px
}
@@ -40,9 +43,13 @@
overflow-x: hidden;
}
+footer {
+ color: #777;
+}
+
.web-footer {
+ color: inherit;
text-align: center;
- color: #777;
margin: 10px;
line-height: 1.7;
}
@@ -54,11 +61,11 @@
.web-footer-menu {
margin-bottom: 7px;
}
-.web-footer a, .web-footer a:visited {
+footer a, footer a:visited {
color: #777;
}
-.web-footer a:hover {
+footer a:hover {
background-color: #777;
color: #fff;
}
@@ -75,5 +82,5 @@
}
.web-footer-menu ul li:last-child {
- border-right: 0px solid #777;
+ border-right: 0px solid #777 !important;
}
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index e9c0d74..05391ee 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -30,7 +30,7 @@
with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
p.script = Template(f.read()).render(doc=self.doc)
-
+
p.save()
website.utils.add_guest_access_to_page(p.name)
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
index 80b030a..8c33d83 100644
--- a/erpnext/website/doctype/blog/template.html
+++ b/erpnext/website/doctype/blog/template.html
@@ -1,9 +1,9 @@
<div class="layout_wrapper">
<div class="web-content" id="blog-{{ doc.name }}">
<h1>Blog</h1>
- <br>
<div class="web-main-section">
<h2>{{ doc.title }}</h2>
+ <br>
{{ doc.content_html }}
</div>
<div class="web-side-section">
diff --git a/erpnext/website/doctype/home_settings/home_settings.py b/erpnext/website/doctype/home_settings/home_settings.py
deleted file mode 100644
index 520b810..0000000
--- a/erpnext/website/doctype/home_settings/home_settings.py
+++ /dev/null
@@ -1,17 +0,0 @@
-"""
-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', 'home', 'content', make_template(self.doc, path))
-
\ No newline at end of file
diff --git a/erpnext/website/doctype/home_settings/home_settings.txt b/erpnext/website/doctype/home_settings/home_settings.txt
deleted file mode 100644
index 413f63f..0000000
--- a/erpnext/website/doctype/home_settings/home_settings.txt
+++ /dev/null
@@ -1,118 +0,0 @@
-# DocType, Home Settings
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-24 15:56:06',
- 'docstatus': 0,
- 'modified': '2012-01-25 13:31:56',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all DocType
- {
- '_last_update': '1327476129',
- 'allow_attach': 1,
- 'colour': 'White:FFF',
- 'doctype': 'DocType',
- 'issingle': 1,
- 'max_attachments': 5,
- 'module': 'Website',
- 'name': '__common__',
- 'section_style': 'Simple',
- 'show_in_menu': 0,
- 'version': 4
- },
-
- # These values are common for all DocField
- {
- 'doctype': 'DocField',
- 'name': '__common__',
- 'parent': 'Home Settings',
- 'parentfield': 'fields',
- 'parenttype': 'DocType',
- 'permlevel': 0
- },
-
- # These values are common for all DocPerm
- {
- 'create': 1,
- 'doctype': 'DocPerm',
- 'name': '__common__',
- 'parent': 'Home Settings',
- 'parentfield': 'permissions',
- 'parenttype': 'DocType',
- 'permlevel': 0,
- 'read': 1,
- 'write': 1
- },
-
- # DocType, Home Settings
- {
- 'doctype': 'DocType',
- 'name': 'Home Settings'
- },
-
- # DocPerm
- {
- 'doctype': 'DocPerm',
- 'role': 'System Manager'
- },
-
- # DocPerm
- {
- 'doctype': 'DocPerm',
- 'role': 'Website Manager'
- },
-
- # 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
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/doctype/home_settings/template.html b/erpnext/website/doctype/home_settings/template.html
deleted file mode 100644
index 8129a50..0000000
--- a/erpnext/website/doctype/home_settings/template.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<div class="layout_wrapper">
- <div class="web-content" id="content-home">
- {% if doc.headline %}
- <h1>{{ doc.headline }}</h1>
- {% endif %}
- {% if doc.banner %}
- <img src="files/{{ doc.banner }}" class="web-home-banner" />
- {% 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>
\ No newline at end of file
diff --git a/erpnext/website/doctype/home_settings/__init__.py b/erpnext/website/doctype/style_settings/__init__.py
similarity index 100%
rename from erpnext/website/doctype/home_settings/__init__.py
rename to erpnext/website/doctype/style_settings/__init__.py
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
new file mode 100644
index 0000000..e6eeeb3
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -0,0 +1,31 @@
+body {
+{% if doc.background_image %}
+ background: url("files/{{ doc.background_image }}") repeat !important;
+{% elif doc.background_color %}
+ background-color: #{{ doc.background_color }};
+{% endif %}
+{% if doc.font %}
+ font-family: {{ doc.font }} !important;
+{% endif %}
+{% if doc.font_size %}
+ font-size: {{ doc.font_size }} !important;
+{% endif %}
+}
+
+{% if doc.footer_font_color %}
+footer {
+ color: {{ doc.footer_font_color }};
+}
+footer a, footer a:visited, footer a:hover {
+ color: {{ doc.footer_font_color }};
+}
+.web-footer-menu ul li {
+ border-right: 1px solid {{ doc.footer_font_color }};
+}
+{% endif %}
+
+{% if doc.heading_font %}
+h1, h2, h3, h4, h5 {
+ font-family: {{ doc.heading_font}} !important;
+}
+{% endif %}
diff --git a/erpnext/website/doctype/style_settings/style_settings.js b/erpnext/website/doctype/style_settings/style_settings.js
new file mode 100644
index 0000000..95c4143
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.js
@@ -0,0 +1,6 @@
+wn.require('lib/js/lib/jscolor/jscolor.js');
+
+cur_frm.cscript.onload_post_render = function() {
+ cur_frm.fields_dict.background_color.input.className = 'color';
+ jscolor.bind();
+}
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py
new file mode 100644
index 0000000..4aefbf6
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.py
@@ -0,0 +1,17 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """make custom css"""
+ from jinja2 import Template
+
+ with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f:
+ temp = Template(f.read())
+
+ self.doc.custom_css = temp.render(doc = self.doc)
+
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
+
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt
new file mode 100644
index 0000000..f07a947
--- /dev/null
+++ b/erpnext/website/doctype/style_settings/style_settings.txt
@@ -0,0 +1,156 @@
+# DocType, Style Settings
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-02 09:57:25',
+ 'docstatus': 0,
+ 'modified': '2012-02-02 10:47:38',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1328159294',
+ 'allow_attach': 1,
+ 'colour': 'White:FFF',
+ 'description': 'Set your background color, font and image (tiled)',
+ 'doctype': 'DocType',
+ 'issingle': 1,
+ 'max_attachments': 1,
+ 'module': 'Website',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 9
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'Style Settings',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Style Settings',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1,
+ 'role': 'Website Manager'
+ },
+
+ # DocType, Style Settings
+ {
+ 'doctype': 'DocType',
+ 'name': 'Style Settings'
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Solid background color (default light gray)',
+ 'doctype': 'DocField',
+ 'fieldname': 'background_color',
+ 'fieldtype': 'Data',
+ 'label': 'Background Color',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'If image is selected, color will be ignored (attach first)',
+ 'doctype': 'DocField',
+ 'fieldname': 'background_image',
+ 'fieldtype': 'Select',
+ 'label': 'Background Image',
+ 'options': 'attach_files:',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'font',
+ 'fieldtype': 'Select',
+ 'label': 'Font',
+ 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'font_size',
+ 'fieldtype': 'Select',
+ 'label': 'Font Size',
+ 'options': '\n12px\n13px\n14px',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'heading_font',
+ 'fieldtype': 'Select',
+ 'label': 'Heaing Font',
+ 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Select a white footer foreground color if you have a dark background',
+ 'doctype': 'DocField',
+ 'fieldname': 'footer_font_color',
+ 'fieldtype': 'Select',
+ 'label': 'Footer Font Color',
+ 'options': '\nwhite',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Auto generated',
+ 'doctype': 'DocField',
+ 'fieldname': 'custom_css',
+ 'fieldtype': 'Code',
+ 'label': 'Custom CSS',
+ 'permlevel': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'file_list',
+ 'fieldtype': 'Text',
+ 'hidden': 1,
+ 'label': 'File List',
+ 'no_copy': 1,
+ 'permlevel': 0,
+ 'print_hide': 1
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/top_bar_settings/__init__.py b/erpnext/website/doctype/top_bar_settings/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/website/doctype/top_bar_settings/__init__.py
+++ /dev/null
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index c6e2014..faacca1 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -1,7 +1,10 @@
<div class="layout_wrapper">
<div class="web-content" id="content-{{ doc.name }}">
- <h1>{{ doc.title }}</h1>
- <br>
+ {% if doc.head_section %}
+ <div class="web-head-section">
+ {{ doc.head_section_html }}
+ </div>
+ {% endif %}
<div class="web-main-section">
{{ doc.main_section_html }}
{% if doc.next_page_html %}
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
index 754d3b8..14a082b 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -16,7 +16,7 @@
from jinja2 import Template
import os
- website.utils.markdown(self.doc, ['main_section', 'side_section'])
+ website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
self.add_page_links()
@@ -44,7 +44,8 @@
def cleanup_temp(self):
"""cleanup temp fields"""
- fl = ['main_section_html', 'side_section_html', 'see_also', 'next_page_html']
+ fl = ['main_section_html', 'side_section_html', 'see_also', \
+ 'next_page_html', 'head_section_html']
for f in fl:
if f in self.doc.fields:
del self.doc.fields[f]
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index e2c839a..0bacc43 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-02-01 16:19:39',
+ 'modified': '2012-02-02 13:15:36',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1328093309',
+ '_last_update': '1328093379',
'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': 5
+ 'version': 6
},
# These values are common for all DocField
@@ -80,6 +80,16 @@
# DocField
{
'colour': 'White:FFF',
+ 'description': 'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
+ 'doctype': 'DocField',
+ 'fieldname': 'head_section',
+ 'fieldtype': 'Text',
+ 'label': 'Head Section'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
'description': 'Content in markdown format that appears on the main side of your page',
'doctype': 'DocField',
'fieldname': 'main_section',
diff --git a/erpnext/website/doctype/home_settings/__init__.py b/erpnext/website/doctype/website_settings/__init__.py
similarity index 100%
copy from erpnext/website/doctype/home_settings/__init__.py
copy to erpnext/website/doctype/website_settings/__init__.py
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
new file mode 100644
index 0000000..0cbc97d
--- /dev/null
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -0,0 +1,20 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """clear cache"""
+ # set home page
+ import webnotes
+ from webnotes.model.doc import Document
+
+ webnotes.conn.sql("""delete from `tabDefault Home Page` where role='Guest'""")
+
+ d = Document('Default Home Page')
+ d.parent = 'Control Panel'
+ d.role = 'Guest'
+ d.home_page = self.doc.home_page
+ d.save()
+
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
\ No newline at end of file
diff --git a/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
similarity index 72%
rename from erpnext/website/doctype/top_bar_settings/top_bar_settings.txt
rename to erpnext/website/doctype/website_settings/website_settings.txt
index ad9a158..aaa7327 100644
--- a/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -1,18 +1,18 @@
-# DocType, Top Bar Settings
+# DocType, Website Settings
[
# These values are common in all dictionaries
{
- 'creation': '2012-01-24 10:21:41',
+ 'creation': '2012-02-02 13:19:50',
'docstatus': 0,
- 'modified': '2012-01-31 15:55:34',
+ 'modified': '2012-02-02 13:31:24',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1327382102',
+ '_last_update': '1328169455',
'allow_attach': 1,
'colour': 'White:FFF',
'doctype': 'DocType',
@@ -23,14 +23,14 @@
'name': '__common__',
'section_style': 'Simple',
'show_in_menu': 0,
- 'version': 4
+ 'version': 3
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
- 'parent': 'Top Bar Settings',
+ 'parent': 'Website Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
@@ -41,7 +41,7 @@
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
- 'parent': 'Top Bar Settings',
+ 'parent': 'Website Settings',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
@@ -49,10 +49,10 @@
'write': 1
},
- # DocType, Top Bar Settings
+ # DocType, Website Settings
{
'doctype': 'DocType',
- 'name': 'Top Bar Settings'
+ 'name': 'Website Settings'
},
# DocPerm
@@ -77,6 +77,28 @@
# DocField
{
'colour': 'White:FFF',
+ 'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.',
+ 'doctype': 'DocField',
+ 'fieldname': 'title_prefix',
+ 'fieldtype': 'Data',
+ 'label': 'Title Prefix'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'The "Web Page" that is the website home page',
+ 'doctype': 'DocField',
+ 'fieldname': 'home_page',
+ 'fieldtype': 'Link',
+ 'label': 'Home Page',
+ 'options': 'Web Page',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
'description': 'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag',
'doctype': 'DocField',
'fieldname': 'brand_html',
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
index d7cba89..8a7870c 100644
--- a/erpnext/website/js/topbar.js
+++ b/erpnext/website/js/topbar.js
@@ -13,14 +13,14 @@
erpnext.topbar.TopBar = Class.extend({
init: function() {
this.make();
- $('.brand').html(wn.boot.topbar.brand_html);
+ $('.brand').html(wn.boot.website_settings.brand_html);
this.make_items();
},
make: function() {
$('header').append('<div class="topbar">\
<div class="topbar-inner">\
<div class="container">\
- <a class="brand" href="#!home">[brand]</a>\
+ <a class="brand">[brand]</a>\
<ul class="nav">\
</ul>\
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
@@ -30,9 +30,10 @@
</div>\
</div>\
</div>');
+ $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
},
make_items: function() {
- var items = wn.boot.topbaritems
+ var items = wn.boot.website_menus
for(var i=0;i<items.length;i++) {
var item = items[i];
if(!item.parent_label && item.parentfield=='top_bar_items') {
@@ -55,11 +56,11 @@
<div class="web-footer-copyright">© %(copyright)s</div>\
<div class="web-footer-powered">Powered by \
<a href="https://erpnext.com">erpnext.com</a></div>\
- </div>', wn.boot.topbar));
+ </div>', wn.boot.website_settings));
this.make_items();
},
make_items: function() {
- var items = wn.boot.topbaritems
+ var items = wn.boot.website_menus
for(var i=0;i<items.length;i++) {
var item = items[i];
if(!item.parent_label && item.parentfield=='footer_items') {
diff --git a/erpnext/website/page/home/__init__.py b/erpnext/website/page/home/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/website/page/home/__init__.py
+++ /dev/null
diff --git a/erpnext/website/page/home/home.txt b/erpnext/website/page/home/home.txt
deleted file mode 100644
index c8bc806..0000000
--- a/erpnext/website/page/home/home.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Page, home
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-24 16:08:44',
- 'docstatus': 0,
- 'modified': '2012-01-24 16:08:44',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'home',
- 'standard': 'Yes'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'home',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, home
- {
- 'doctype': 'Page',
- 'name': 'home'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/version.num b/version.num
index cfd6ea5..0a1b63d 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-335
\ No newline at end of file
+353
\ No newline at end of file