From a8ad3907db6bb639ceebae6ab34738b164bbe61b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 25 Jan 2012 10:37:35 +0530 Subject: [PATCH] added website page, home, patch --- .../jan_mar_2012/subdomain_login_patch.py | 7 ++ erpnext/patches/jan_mar_2012/website.py | 17 +++++ erpnext/startup/modules.js | 3 +- .../website/Module Def/Website/Website.txt | 16 +++- erpnext/website/css/website.css | 9 +++ .../website/doctype/home_settings/__init__.py | 0 .../doctype/home_settings/home_settings.txt | 75 +++++++++++++++++++ erpnext/website/js/topbar.js | 5 +- erpnext/website/page/__init__.py | 0 erpnext/website/page/home/__init__.py | 0 erpnext/website/page/home/home.html | 17 +++++ erpnext/website/page/home/home.txt | 42 +++++++++++ index.html | 2 +- version.num | 2 +- 14 files changed, 186 insertions(+), 9 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/website.py create mode 100644 erpnext/website/css/website.css create mode 100644 erpnext/website/doctype/home_settings/__init__.py create mode 100644 erpnext/website/doctype/home_settings/home_settings.txt create mode 100644 erpnext/website/page/__init__.py create mode 100644 erpnext/website/page/home/__init__.py create mode 100644 erpnext/website/page/home/home.html create mode 100644 erpnext/website/page/home/home.txt diff --git a/erpnext/patches/jan_mar_2012/subdomain_login_patch.py b/erpnext/patches/jan_mar_2012/subdomain_login_patch.py index ced5c68a17..5c58b08e15 100644 --- a/erpnext/patches/jan_mar_2012/subdomain_login_patch.py +++ b/erpnext/patches/jan_mar_2012/subdomain_login_patch.py @@ -15,8 +15,15 @@ def cleanup(): delete_doc("DocType", "SSO Control") delete_doc("DocType", "WN ERP Client Control") delete_doc("DocType", "DocTrigger") + + # cleanup control panel delete_doc("DocType", "Control Panel") reload_doc("core", "doctype", "control_panel") + + # cleanup page + delete_doc("DocType", "Control Panel") + reload_doc("core", "doctype", "control_panel") + webnotes.conn.sql("""delete from tabSingles where field like 'startup_%' and doctype='Control Panel'""") diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py new file mode 100644 index 0000000000..a19cd447dd --- /dev/null +++ b/erpnext/patches/jan_mar_2012/website.py @@ -0,0 +1,17 @@ +# website patch + +import webnotes +def execute(): + update_patch_log() + from webnotes.modules import reload_doc + reload_doc('website', 'Module Def', 'Website') + reload_doc('website', 'Role', 'Website Manager') + reload_doc('website', 'doctype', 'home_settings') + reload_doc('website', 'doctype', 'top_bar_settings') + reload_doc('website', 'doctype', 'top_bar_item') + reload_doc('website', 'page', 'home') + +def update_patch_log(): + webnotes.conn.commit() + webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""") + webnotes.conn.begin() diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js index 29adfcb182..3dd7b3e5fc 100644 --- a/erpnext/startup/modules.js +++ b/erpnext/startup/modules.js @@ -215,7 +215,8 @@ SidebarItem.prototype.show_items = function() { } } if(me.il[i].doc_type=='Reports') has_reports = 1; - if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1; + if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) + has_tools = 1; } // reports if(has_reports) { diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt index 0a5e1b8c5f..7e67c3c7e7 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-24 10:29:53', + 'modified': '2012-01-24 15:57:51', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -21,9 +21,6 @@ # These values are common for all Module Def Item { - 'display_name': 'Top Bar Settings', - 'doc_name': 'Top Bar Settings', - 'doc_type': 'Single DocType', 'doctype': 'Module Def Item', 'name': '__common__', 'parent': 'Website', @@ -49,6 +46,17 @@ # 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': 'Home Settings', + 'doc_name': 'Home Settings', + 'doc_type': 'Forms', 'doctype': 'Module Def Item' }, diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css new file mode 100644 index 0000000000..025856de1b --- /dev/null +++ b/erpnext/website/css/website.css @@ -0,0 +1,9 @@ +#body_div { + width: 900px; + margin: auto; +} + +header .topbar .container { + width: 900px; + margin: auto; +} \ No newline at end of file diff --git a/erpnext/website/doctype/home_settings/__init__.py b/erpnext/website/doctype/home_settings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/doctype/home_settings/home_settings.txt b/erpnext/website/doctype/home_settings/home_settings.txt new file mode 100644 index 0000000000..b95be64be0 --- /dev/null +++ b/erpnext/website/doctype/home_settings/home_settings.txt @@ -0,0 +1,75 @@ +# DocType, Home Settings +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-24 15:56:06', + 'docstatus': 0, + 'modified': '2012-01-24 15:56:06', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + 'colour': 'White:FFF', + 'doctype': 'DocType', + 'issingle': 1, + 'module': 'Website', + 'name': '__common__', + 'section_style': 'Simple', + 'show_in_menu': 0, + 'version': 1 + }, + + # 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', + 'fieldname': 'banner_html', + 'fieldtype': 'Code', + 'label': 'Banner HTML', + '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 + { + 'doctype': 'DocField' + } +] \ No newline at end of file diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index 49ec7000ab..85d975bdb4 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -36,8 +36,9 @@ erpnext.topbar.TopBar = Class.extend({ for(var i=0;i\ - %(label)s', item)) + item.route = item.std_page.toLowerCase(); + $('header .nav:first').append(repl('
  • %(label)s
  • ', item)) } } } diff --git a/erpnext/website/page/__init__.py b/erpnext/website/page/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/page/home/__init__.py b/erpnext/website/page/home/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/page/home/home.html b/erpnext/website/page/home/home.html new file mode 100644 index 0000000000..3c1bc5ea9a --- /dev/null +++ b/erpnext/website/page/home/home.html @@ -0,0 +1,17 @@ +#!python + +from webnotes.model.doc import getsingle + +home_settings = getsingle('Home Settings') + +html= """ +
    +
    + %(banner_html)s +
    +
    +""" % home_settings + +out = { + "content": html +} \ No newline at end of file diff --git a/erpnext/website/page/home/home.txt b/erpnext/website/page/home/home.txt new file mode 100644 index 0000000000..c8bc806556 --- /dev/null +++ b/erpnext/website/page/home/home.txt @@ -0,0 +1,42 @@ +# 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/index.html b/index.html index eddf8de0d0..0f6b0db015 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext -