mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
“Leave Chapter” button added for Foundation -> Chapter section.
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
{% if members %}
|
||||
<table class="table table-bordered small" style="max-width: 600px;">
|
||||
<tr>
|
||||
<th>Serial No.</th>
|
||||
<th>Member Name</th>
|
||||
<th>Member Email</th>
|
||||
<th>Website URL</th>
|
||||
</tr>
|
||||
{% for user in members %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ frappe.db.get_value('User', user.user, 'full_name') }}</td>
|
||||
<td>{{ frappe.db.get_value('User', user.user, 'email') }}</td>
|
||||
<td>
|
||||
{% if user.website_url %}
|
||||
<a href="{{ user.website_url }}">{{ user.website_url }}</a>
|
||||
@@ -29,7 +29,6 @@
|
||||
{{ user.introduction }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
@@ -55,6 +54,7 @@
|
||||
<p>{{ address }}</p>
|
||||
|
||||
<p style="margin: 20px 0 30px;"><a href="/join-chapter?name={{ name }}" class='btn btn-primary'>Join this Chapter</a></p>
|
||||
<p style="margin: 20px 0 30px;"><a href="/leave-chapter?name={{ name }}" class=''>Leave this Chapter</a></p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -98,7 +98,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -128,7 +128,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -144,7 +144,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-05-12 16:36:07.139907",
|
||||
"modified": "2017-05-16 15:24:25.355107",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Foundation",
|
||||
"name": "Chapter Member",
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="website_url" class="">Website URL</label>
|
||||
<input name="website_url" class="form-control" type="text"
|
||||
<input name="website_url" required class="form-control" type="text"
|
||||
placeholder="https://example.com" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="introduction" class="">Introduction</label>
|
||||
<textarea name="introduction" class="form-control"
|
||||
<textarea name="introduction" required class="form-control"
|
||||
placeholder="Your profession and how you are associated with ERPNext"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
16
foundation/www/leave-chapter.html
Normal file
16
foundation/www/leave-chapter.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "templates/web.html" %}
|
||||
<!--
|
||||
{% macro chapter_button() %}
|
||||
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>
|
||||
Go to Chapter Page</a></p>
|
||||
{% endmacro %}
|
||||
-->
|
||||
{% block page_content %}
|
||||
|
||||
{% if member_deleted %}
|
||||
<p>You are not a member of {{ chapter.title }}!</p>
|
||||
<p>Please signup and login to join this chapter</p>
|
||||
|
||||
<p><a href="/join-chapter?name={{ chapter.name }}" class='btn btn-primary'>Become Member agian</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
14
foundation/www/leave_chapter.py
Normal file
14
foundation/www/leave_chapter.py
Normal file
@@ -0,0 +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':
|
||||
if frappe.session.user in [d.user for d in chapter.members]:
|
||||
user = frappe.session.user
|
||||
parent = frappe.form_dict.name
|
||||
frappe.db.sql("""delete from `tabChapter Member` where parent = %s and user = %s """, (parent, user))
|
||||
|
||||
context.member_deleted = True
|
||||
|
||||
context.chapter = chapter
|
||||
Reference in New Issue
Block a user