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 %}

{{ title }}

+

Details

{{ introduction }}

-


Join this Chapter

+

List of Members

+{% if members %} + + + + + + {% for user in members %} + + + + + + {% endfor %} +
Member NameMember Email
{{ frappe.db.get_value('User', user.user, 'full_name') }}{{ frappe.db.get_value('User', user.user, 'email') }}
+{% else %} +

No member yet.

+{% endif %} + +

Chapter Head

+ + + + + + + + + + + + + +
Name{{ frappe.db.get_value('User', chapter_head, 'full_name') }}
Email{{ frappe.db.get_value('User', chapter_head, 'email') }}
Phone{{ frappe.db.get_value('User', chapter_head, 'phone') }}
+

Address

+

{{ address }}

+ +

Join this Chapter

+ +
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+ {% endblock %} \ No newline at end of file diff --git a/foundation/erpnext_foundation/doctype/chapter/templates/chapter_row.html b/foundation/erpnext_foundation/doctype/chapter/templates/chapter_row.html index fba2398e..042aede1 100644 --- a/foundation/erpnext_foundation/doctype/chapter/templates/chapter_row.html +++ b/foundation/erpnext_foundation/doctype/chapter/templates/chapter_row.html @@ -1,4 +1,17 @@ -
- {{ title }} hosted by {{ chapter_head }} +
+ +

{{ doc.title }}

+

+ {{ frappe.db.get_value('User', chapter_head, 'full_name') }} + + {% if members %} + Members: {{ members|length }} + {% else %} + Members: 0 + {% endif %} + +

+

{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}

+
\ No newline at end of file diff --git a/foundation/hooks.py b/foundation/hooks.py index 456f7a7a..fb3a95ea 100644 --- a/foundation/hooks.py +++ b/foundation/hooks.py @@ -37,13 +37,14 @@ web_include_css = "/assets/foundation/css/style.css" home_page = "index" website_context = { - "navbar_search": 1, + # "navbar_search": 1, "brand_html": "ERPNext Foundation", "copyright": "ERPNext Open Source Software Foundation", "footer_address": "
ERPNext is and will always be 100% Open Source", "top_bar_items": [ {"label": "Service Providers", "url": "/service-providers"}, {"label": "Jobs", "url": "/erpnext-jobs"}, + {"label": "Chapters", "url": "/chapters"}, ], "footer_items": [ {"label": "Foundation", "child_items": [ diff --git a/foundation/www/join-chapter.html b/foundation/www/join-chapter.html index b49b9a20..7ec84ed3 100644 --- a/foundation/www/join-chapter.html +++ b/foundation/www/join-chapter.html @@ -3,9 +3,13 @@ {% block page_content %} {% if frappe.session.user=='Guest' %}

Please signup and login to join this chapter

-

Login

+

Login

{% else %} + {% if already_member %} +

You are already a member of {{ chapter.title }}!

+ {% else %}

Welcome to chapter {{ chapter.title }}!

+ {% endif %}

Go to Chapter Page

{% 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