diff --git a/foundation/erpnext_foundation/doctype/chapter/chapter.json b/foundation/erpnext_foundation/doctype/chapter/chapter.json index d13154e7..cb6f00e1 100644 --- a/foundation/erpnext_foundation/doctype/chapter/chapter.json +++ b/foundation/erpnext_foundation/doctype/chapter/chapter.json @@ -50,7 +50,7 @@ "collapsible": 0, "columns": 0, "fieldname": "chapter_head", - "fieldtype": "Data", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -61,6 +61,7 @@ "label": "Chapter Head", "length": 0, "no_copy": 0, + "options": "User", "permlevel": 0, "precision": "", "print_hide": 0, @@ -103,6 +104,66 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "published", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Published", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "route", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Route", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -133,6 +194,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "address", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Address", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -170,8 +261,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "route", - "fieldtype": "Data", + "fieldname": "comments", + "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -179,39 +270,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Route", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "published", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Published", + "label": "Comments", "length": 0, "no_copy": 0, + "options": "Chapter Comments", "permlevel": 0, "precision": "", "print_hide": 0, @@ -236,7 +298,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-05-08 17:05:38.056334", + "modified": "2017-05-10 16:33:43.490022", "modified_by": "Administrator", "module": "ERPNext Foundation", "name": "Chapter", diff --git a/foundation/erpnext_foundation/doctype/chapter/chapter.py b/foundation/erpnext_foundation/doctype/chapter/chapter.py index 6ca9ef8f..dcbff3d4 100644 --- a/foundation/erpnext_foundation/doctype/chapter/chapter.py +++ b/foundation/erpnext_foundation/doctype/chapter/chapter.py @@ -7,6 +7,8 @@ import frappe from frappe.website.website_generator import WebsiteGenerator class Chapter(WebsiteGenerator): + def get_context(self, context): + context.no_cache = True pass def get_list_context(context): diff --git a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html index 9a0d82b2..a4d796e2 100644 --- a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html +++ b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html @@ -2,8 +2,65 @@ {% block page_content %}
{{ introduction }}
- +| Member Name | +Member Email | +
|---|---|
| {{ frappe.db.get_value('User', user.user, 'full_name') }} | +{{ frappe.db.get_value('User', user.user, 'email') }} | +
No member yet.
+{% endif %} + +| Name | +{{ frappe.db.get_value('User', chapter_head, 'full_name') }} | +
| {{ frappe.db.get_value('User', chapter_head, 'email') }} | +|
| Phone | +{{ frappe.db.get_value('User', chapter_head, 'phone') }} | +
{{ address }}
+ + + +Please signup and login to join this chapter
- + {% else %} + {% if already_member %} +You are already a member of {{ chapter.title }}!
+ {% else %}Welcome to chapter {{ chapter.title }}!
+ {% endif %} {% endif %} diff --git a/foundation/www/join_chapter.py b/foundation/www/join_chapter.py index 0e4cfc5c..d18bad72 100644 --- a/foundation/www/join_chapter.py +++ b/foundation/www/join_chapter.py @@ -1,12 +1,14 @@ import frappe def get_context(context): + context.no_cache = True + chapter = frappe.get_doc('Chapter', frappe.form_dict.name) if frappe.session.user!='Guest': - chapter = frappe.get_doc('Chapter', frappe.form_dict.name) - - if frappe.session.user not in [d.user for d in chapter.members]: + if frappe.session.user in [d.user for d in chapter.members]: + context.already_member = True + else: chapter.append('members', dict(user=frappe.session.user)) - chapter.save() + chapter.save(ignore_permissions=1) frappe.db.commit() - context.chapter = chapter + context.chapter = chapter