mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-17 02:10:45 +02:00
[wip] added chapters
This commit is contained in:
12
foundation/www/join-chapter.html
Normal file
12
foundation/www/join-chapter.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block page_content %}
|
||||
{% if frappe.session.user=='Guest' %}
|
||||
<p>Please signup and login to join this chapter</p>
|
||||
<p><a href="/login" class='btn btn-primary'>Login</a></p>
|
||||
{% else %}
|
||||
<p>Welcome to chapter {{ chapter.title }}!</p>
|
||||
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>Go to Chapter Page</a></p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
12
foundation/www/join_chapter.py
Normal file
12
foundation/www/join_chapter.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
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]:
|
||||
chapter.append('members', dict(user=frappe.session.user))
|
||||
chapter.save()
|
||||
frappe.db.commit()
|
||||
|
||||
context.chapter = chapter
|
||||
Reference in New Issue
Block a user