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 520b81008fc..00000000000
--- 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 413f63fcc4c..00000000000
--- 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
markdown',
- 'doctype': 'DocField',
- 'fieldname': 'main_section',
- 'fieldtype': 'Code',
- 'label': 'Main Section'
- },
-
- # DocField
- {
- 'colour': 'White:FFF',
- 'description': 'For formatting, use \n
markdown',
- '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 8129a509ba0..00000000000
--- a/erpnext/website/doctype/home_settings/template.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- {% if doc.headline %}
-
{{ doc.headline }}
- {% endif %}
- {% if doc.banner %}
-

- {% endif %}
-
- {{ doc.main_section_html }}
-
-
- {{ doc.side_section_html }}
-
-
-
-
\ 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 00000000000..e6eeeb34fac
--- /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 00000000000..95c4143c728
--- /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 00000000000..4aefbf6bf9d
--- /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 00000000000..f07a9479ca1
--- /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/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index c6e20144bc6..faacca1566a 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -1,7 +1,10 @@
-
{{ doc.title }}
-
+ {% if doc.head_section %}
+
+ {{ doc.head_section_html }}
+
+ {% endif %}
{{ 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 754d3b8c5e3..14a082b0910 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -16,7 +16,7 @@ class DocType:
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 @@ class DocType:
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 e2c839abd39..0bacc43d67f 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
@@ -77,6 +77,16 @@
'reqd': 1
},
+ # 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',
diff --git a/erpnext/website/doctype/top_bar_settings/__init__.py b/erpnext/website/doctype/website_settings/__init__.py
similarity index 100%
rename from erpnext/website/doctype/top_bar_settings/__init__.py
rename 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 00000000000..0cbc97d24e3
--- /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 ad9a158cc5a..aaa73272576 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
@@ -74,6 +74,28 @@
'label': 'Top Bar'
},
+ # 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',
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
index d7cba895545..8a7870c7de6 100644
--- a/erpnext/website/js/topbar.js
+++ b/erpnext/website/js/topbar.js
@@ -13,14 +13,14 @@ wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
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('
\
\
\
-
[brand]\
+
[brand]\
\

\
@@ -30,9 +30,10 @@ erpnext.topbar.TopBar = Class.extend({
\
\
');
+ $('.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
\
\
-
', wn.boot.topbar));
+
', 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