Merge pull request #27 from ashwinisave35/chapter_development

Chapter development
This commit is contained in:
Rushabh Mehta
2017-05-23 12:40:50 +05:30
committed by GitHub
5 changed files with 87 additions and 53 deletions

View File

@@ -8,28 +8,31 @@
{% if members %}
<table class="table table-bordered small" style="max-width: 600px;">
<tr>
<th>Member Name</th>
<th>Member Email</th>
<th>Website URL</th>
<th width="10%" ></th>
<th>Member Details</th>
</tr>
{% for user in members %}
<tr>
<td>{{ frappe.db.get_value('User', user.user, 'full_name') }}</td>
<td>{{ frappe.db.get_value('User', user.user, 'email') }}</td>
<td>{{ loop.index }}</td>
<td>
{% if user.website_url %}
<a href="{{ user.website_url }}">{{ user.website_url }}</a>
{% else %}
{{ user.website_url }}
{% endif %}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">{{ frappe.db.get_value('User', user.user, 'full_name') }}</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
{% if user.website_url %}
<a href="{{ user.website_url }}">{{ user.website_url }}</a>
{% else %}
{% endif %}
</div>
<div class="col-lg-12">
{% if user.website_url %}
{{ user.introduction }}
{% endif %}
</div>
</div>
</td>
</tr>
<tr>
<td colspan="3">
{{ user.introduction }}
</td>
</tr>
{% endfor %}
</table>
{% else %}
@@ -55,6 +58,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 %}

View File

@@ -50,13 +50,13 @@
"collapsible": 0,
"columns": 0,
"fieldname": "introduction",
"fieldtype": "Text",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Introduction",
"length": 0,
@@ -73,36 +73,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "enabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Enabled",
"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,
@@ -132,6 +102,36 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "enabled",
"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": "Enabled",
"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
}
],
"has_web_view": 0,
@@ -144,7 +144,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-05-12 16:36:07.139907",
"modified": "2017-05-22 16:29:01.536405",
"modified_by": "Administrator",
"module": "ERPNext Foundation",
"name": "Chapter Member",

View File

@@ -24,9 +24,9 @@
<div class="col-lg-8 col-md-8">
<form name="user-intro" action="/join-chapter" method='POST'>
<div class="form-group">
<input name="name" class="form-control" type="text"
<input name="name" class="hidden form-control" type="text"
value="{{chapter.name}}">
<input name="csrf_token" class="form-control" type="text"
<input name="csrf_token" class="hidden form-control" type="text"
value="{{frappe.session.csrf_token}}">
</div>
<div class="form-group">
@@ -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">

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

View 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