From 51e51da63fd1d68ca5bf09c87f41d472bddf2574 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 27 Jan 2012 12:17:09 +0530 Subject: [PATCH] added about_us --- .../receivable_voucher/receivable_voucher.py | 7 +- .../home/page/event_updates/event_updates.js | 5 +- erpnext/patches/jan_mar_2012/website.py | 16 ++- erpnext/startup/startup.css | 2 +- .../website/Module Def/Website/Website.txt | 9 +- erpnext/website/css/website.css | 3 + .../doctype/about_us_settings/__init__.py | 0 .../about_us_settings/about_us_settings.py | 23 ++++ .../about_us_settings/about_us_settings.txt | 106 ++++++++++++++++++ .../doctype/about_us_settings/template.html | 36 ++++++ .../website/doctype/about_us_team/__init__.py | 0 .../doctype/about_us_team/about_us_team.txt | 74 ++++++++++++ erpnext/website/page/about/__init__.py | 0 erpnext/website/page/about/about.txt | 42 +++++++ index.html | 2 +- version.num | 2 +- 16 files changed, 318 insertions(+), 9 deletions(-) create mode 100644 erpnext/website/doctype/about_us_settings/__init__.py create mode 100644 erpnext/website/doctype/about_us_settings/about_us_settings.py create mode 100644 erpnext/website/doctype/about_us_settings/about_us_settings.txt create mode 100644 erpnext/website/doctype/about_us_settings/template.html create mode 100644 erpnext/website/doctype/about_us_team/__init__.py create mode 100644 erpnext/website/doctype/about_us_team/about_us_team.txt create mode 100644 erpnext/website/page/about/__init__.py create mode 100644 erpnext/website/page/about/about.txt diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py index 59217362a3..12d3a4a1c7 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py @@ -14,7 +14,8 @@ sql = webnotes.conn.sql get_value = webnotes.conn.get_value in_transaction = webnotes.conn.in_transaction convert_to_lists = webnotes.conn.convert_to_lists - +session = webnotes.session + # ----------------------------------------------------------------------------------------- from utilities.transaction_base import TransactionBase @@ -153,7 +154,9 @@ class DocType(TransactionBase): def get_item_details(self, item_code): ret = get_obj('Sales Common').get_item_details(item_code, self) if item_code and cint(self.doc.is_pos) == 1: - dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1) + dtl = sql("""select income_account, warehouse, cost_center from + `tabPOS Setting` where user = '%s' and company = '%s'""" % (session['user'], + self.doc.company), as_dict=1) if not dtl: dtl = sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1) if dtl and dtl[0]['income_account']: ret['income_account'] = dtl and dtl[0]['income_account'] diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 87c7f5cbf3..078dfc2747 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -212,7 +212,8 @@ HomeWidgetItem.prototype.delete_item = function() { var callback = function(r,rt) { $(me.wrapper).slideUp(); } - $c_obj('Home Control',this.widget.delete_method, this.widget.get_item_id(this.det) ,callback); + $c_obj('Home Control',this.widget.delete_method, + this.widget.get_item_id(this.det) ,callback); } @@ -324,7 +325,7 @@ HomeToDo = function(widget) { this.widget.get_list_method = 'get_todo_list'; this.widget.delete_method = 'remove_todo_item'; this.widget.no_items_message = 'Nothing to do?'; - this.widget.get_item_id = function(det) { return det[0]; } + this.widget.get_item_id = function(det) { return det.name; } this.widget.decorator = this; diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py index ad60cc58e4..ee1f251941 100644 --- a/erpnext/patches/jan_mar_2012/website.py +++ b/erpnext/patches/jan_mar_2012/website.py @@ -1,9 +1,12 @@ # website patch import webnotes +from webnotes.model.doc import Document + def execute(): - cleanup_file_data() + add_website_manager() return + cleanup_file_data() update_patch_log() from webnotes.modules import reload_doc reload_doc('website', 'Module Def', 'Website') @@ -13,6 +16,17 @@ def execute(): reload_doc('website', 'doctype', 'top_bar_item') reload_doc('website', 'page', 'home') +def add_website_manager(): + """add website manager to system manager""" + for i in webnotes.conn.sql("""select distinct parent from tabUserRole + where role='System Manager'"""): + if not webnotes.conn.sql("""select parent from tabUserRole + where role='Website Manager' and parent=%s""", i[0]): + d = Document('UserRole') + d.parent = i[0] + d.role = 'Website Manager' + d.save(1) + def cleanup_file_data(): webnotes.conn.commit() webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""") diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index f7aff1c535..24d380053b 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -1,5 +1,5 @@ h1, h2, h3, h4 { - font-family: Tahoma, Sans Serif; + font-family: Tahoma, Arial, Verdana, sans-serif; font-weight: bold; } diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt index 326fde177c..1d5985b3c2 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-25 16:12:14', + 'modified': '2012-01-27 10:14:58', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -66,6 +66,13 @@ 'doctype': 'Module Def Item' }, + # Module Def Item + { + 'display_name': 'About Us Settings', + 'doc_name': 'About Us Settings', + 'doctype': 'Module Def Item' + }, + # Module Def Role { 'doctype': 'Module Def Role', diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index b60c2fb104..5afb47d85b 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -22,4 +22,7 @@ header .topbar .container { width: 30%; float: right; margin-bottom: 20px; + margin-right: 15px; + color: #606060; + overflow-x: hidden; } \ No newline at end of file diff --git a/erpnext/website/doctype/about_us_settings/__init__.py b/erpnext/website/doctype/about_us_settings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.py b/erpnext/website/doctype/about_us_settings/about_us_settings.py new file mode 100644 index 0000000000..31a26ce031 --- /dev/null +++ b/erpnext/website/doctype/about_us_settings/about_us_settings.py @@ -0,0 +1,23 @@ +""" +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') + + self.doc.about_team = webnotes.conn.sql("""select * from `tabAbout Us Team` + where parent='About Us Settings'""", as_dict=1) + + import markdown2 + for t in self.doc.about_team: + t['bio'] = markdown2.markdown(t['bio']) + + webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path)) diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.txt b/erpnext/website/doctype/about_us_settings/about_us_settings.txt new file mode 100644 index 0000000000..5ecae16444 --- /dev/null +++ b/erpnext/website/doctype/about_us_settings/about_us_settings.txt @@ -0,0 +1,106 @@ +# DocType, About Us Settings +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-27 10:13:16', + 'docstatus': 0, + 'modified': '2012-01-27 11:36:44', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + '_last_update': '1327641155', + 'allow_attach': 1, + 'colour': 'White:FFF', + 'doctype': 'DocType', + 'issingle': 1, + 'max_attachments': 10, + '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': 'About Us Settings', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0 + }, + + # These values are common for all DocPerm + { + 'create': 1, + 'doctype': 'DocPerm', + 'name': '__common__', + 'parent': 'About Us Settings', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'permlevel': 0, + 'read': 1, + 'role': 'Website Manager', + 'write': 1 + }, + + # DocType, About Us Settings + { + 'doctype': 'DocType', + 'name': 'About Us Settings' + }, + + # DocPerm + { + 'doctype': 'DocPerm' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'headline', + 'fieldtype': 'Data', + 'label': 'Headline' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'main_section', + 'fieldtype': 'Code', + 'label': 'Main Section' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'team', + 'fieldtype': 'Table', + 'label': 'Team', + 'options': 'About Us Team' + }, + + # DocField + { + '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/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html new file mode 100644 index 0000000000..21d6729b18 --- /dev/null +++ b/erpnext/website/doctype/about_us_settings/template.html @@ -0,0 +1,36 @@ +
+
+ {% if doc.headline %} +

{{ doc.headline }}

+ {% endif %} +
+ {{ doc.main_section_html }} + + {% if doc.about_team %} +

Team

+ + + {% for p in doc.about_team %} + + + + + {% endfor %} + +
+ + +

{{ p.person_name }}

+
{{ p.designation }}
+
{{ p.bio }}
+
+ {% endif %} +
+
+ {{ doc.side_section_html }} +
+
+
+
\ No newline at end of file diff --git a/erpnext/website/doctype/about_us_team/__init__.py b/erpnext/website/doctype/about_us_team/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/doctype/about_us_team/about_us_team.txt b/erpnext/website/doctype/about_us_team/about_us_team.txt new file mode 100644 index 0000000000..bbbf47df34 --- /dev/null +++ b/erpnext/website/doctype/about_us_team/about_us_team.txt @@ -0,0 +1,74 @@ +# DocType, About Us Team +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-27 10:14:18', + 'docstatus': 0, + 'modified': '2012-01-27 11:54:18', + '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': 5 + }, + + # These values are common for all DocField + { + 'doctype': 'DocField', + 'name': '__common__', + 'parent': 'About Us Team', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0 + }, + + # DocType, About Us Team + { + 'doctype': 'DocType', + 'name': 'About Us Team' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'person_name', + 'fieldtype': 'Data', + 'label': 'Person Name' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'designation', + 'fieldtype': 'Data', + 'label': 'Designation' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'image', + 'fieldtype': 'Select', + 'label': 'Image', + 'options': 'attach_files:' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'bio', + 'fieldtype': 'Text', + 'label': 'Bio (markdown)', + 'width': '300px' + } +] \ No newline at end of file diff --git a/erpnext/website/page/about/__init__.py b/erpnext/website/page/about/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/website/page/about/about.txt b/erpnext/website/page/about/about.txt new file mode 100644 index 0000000000..7e045de50f --- /dev/null +++ b/erpnext/website/page/about/about.txt @@ -0,0 +1,42 @@ +# Page, about +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-27 11:37:57', + 'docstatus': 0, + 'modified': '2012-01-27 11:37:57', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all Page + { + 'doctype': 'Page', + 'module': 'Website', + 'name': '__common__', + 'page_name': 'about', + 'standard': 'Yes' + }, + + # These values are common for all Page Role + { + 'doctype': 'Page Role', + 'name': '__common__', + 'parent': 'about', + 'parentfield': 'roles', + 'parenttype': 'Page', + 'role': 'Guest' + }, + + # Page, about + { + 'doctype': 'Page', + 'name': 'about' + }, + + # Page Role + { + 'doctype': 'Page Role' + } +] \ No newline at end of file diff --git a/index.html b/index.html index ef406505b1..02a2e506eb 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext -