diff --git a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html index 9f713507..10b0f95b 100644 --- a/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html +++ b/foundation/erpnext_foundation/doctype/chapter/templates/chapter.html @@ -10,23 +10,25 @@ Member Name Member Email - Introduction Website URL - Enable {% for user in members %} {{ frappe.db.get_value('User', user.user, 'full_name') }} {{ frappe.db.get_value('User', user.user, 'email') }} - {{ user.introduction }} {% if user.website_url %} - {{ user.website_url }} + {{ user.website_url }} {% else %} {{ user.website_url }} {% endif %} - + + + + {{ user.introduction }} + + {% endfor %} diff --git a/foundation/www/join-chapter.html b/foundation/www/join-chapter.html index b4abcccd..4850376a 100644 --- a/foundation/www/join-chapter.html +++ b/foundation/www/join-chapter.html @@ -1,194 +1,59 @@ {% extends "templates/web.html" %} {% block page_content %} + +{% macro chapter_button() %} +

+ Go to Chapter Page

+{% endmacro %} {% if frappe.session.user=='Guest' %}

Please signup and login to join this chapter

Login

{% else %} {% if already_member %} -

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

+

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

+ {{ chapter_button() }} +

Leave Chapter

{% else %} -

Welcome to chapter {{ chapter.title }}!

- {% endif %} -
-
-
-
-
- + {% if frappe.local.request.method=='POST' %} +

Welcome to chapter {{ chapter.title }}!

+ {{ chapter_button() }} + {% else %} +
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
-
- - -
-
- - -
-
- - -
-
- -
- +
-
-
+ {% endif %} + {% endif %} -

Go to Chapter Page

{% endif %} - - {% endblock %} \ No newline at end of file diff --git a/foundation/www/join_chapter.py b/foundation/www/join_chapter.py index b5a6290d..bc9ba6ba 100644 --- a/foundation/www/join_chapter.py +++ b/foundation/www/join_chapter.py @@ -3,13 +3,20 @@ import frappe def get_context(context): context.no_cache = True chapter = frappe.get_doc('Chapter', frappe.form_dict.name) - print chapter if frappe.session.user!='Guest': 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(ignore_permissions=1) - frappe.db.commit() + if frappe.request.method=='GET': + pass + elif frappe.request.method=='POST': + chapter.append('members', dict( + user=frappe.session.user, + introduction=frappe.form_dict.introduction, + website_url=frappe.form_dict.website_url, + enabled=1 + )) + chapter.save(ignore_permissions=1) + frappe.db.commit() context.chapter = chapter diff --git a/foundation/www/user-intro.html b/foundation/www/user-intro.html deleted file mode 100644 index 6777496f..00000000 --- a/foundation/www/user-intro.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "templates/web.html" %} - -{% block page_content %} - -

Go to Chapter Page

- -{% endblock %} \ No newline at end of file diff --git a/foundation/www/user_intro.py b/foundation/www/user_intro.py deleted file mode 100644 index c5926e1a..00000000 --- a/foundation/www/user_intro.py +++ /dev/null @@ -1,15 +0,0 @@ -import frappe - -def get_context(context): - context.no_cache = True - chapter = frappe.get_doc('Chapter', frappe.form_dict.name) - print chapter - if frappe.session.user!='Guest': - if chapter in [d.name for d in chapter]: - context.already_member = True - else: - chapter.append('members', dict(user=frappe.session.user)) - chapter.save(ignore_permissions=1) - frappe.db.commit() - - context.chapter = chapter