mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
Merge pull request #25 from ashwinisave35/chapter_development
Updated page view for Chapters list and Individual Chapter view.
This commit is contained in:
@@ -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,
|
||||
@@ -163,66 +254,6 @@
|
||||
"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": 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",
|
||||
"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": 1,
|
||||
@@ -236,7 +267,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-05-08 17:05:38.056334",
|
||||
"modified": "2017-05-11 17:07:13.825474",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Foundation",
|
||||
"name": "Chapter",
|
||||
|
||||
@@ -5,9 +5,26 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.website.website_generator import WebsiteGenerator
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class Chapter(WebsiteGenerator):
|
||||
pass
|
||||
def get_context(self, context):
|
||||
context.no_cache = True
|
||||
|
||||
def validate(self):
|
||||
chapter_head = self.chapter_head
|
||||
chapter = frappe.get_all('Chapter', filters={'published': True}, fields=['chapter_head'])
|
||||
|
||||
# if chapter_head in [d.chapter_head for d in chapter]:
|
||||
# frappe.throw(_('You are not allow to create more than one Chapter'))
|
||||
|
||||
def enable(self):
|
||||
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
||||
chapter.append('members', dict(enable=self.value))
|
||||
chapter.save(ignore_permissions=1)
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
def get_list_context(context):
|
||||
context.allow_guest = True
|
||||
|
||||
@@ -2,8 +2,60 @@
|
||||
|
||||
{% block page_content %}
|
||||
<h1>{{ title }}</h1>
|
||||
<h3>Details</h3>
|
||||
<p>{{ introduction }}</p>
|
||||
<p><br><a href="/join-chapter?name={{ name }}" class='btn btn-primary'>Join this Chapter</a></p>
|
||||
<h3>List of Members</h3>
|
||||
{% 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>
|
||||
</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>
|
||||
{% if user.website_url %}
|
||||
<a href="{{ user.website_url }}">{{ user.website_url }}</a>
|
||||
{% else %}
|
||||
{{ user.website_url }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
{{ user.introduction }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No member yet.</p>
|
||||
{% endif %}
|
||||
|
||||
<h3>Chapter Head</h3>
|
||||
<table class="table table-bordered" style="max-width: 400px;">
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email</td>
|
||||
<td>{{ frappe.db.get_value('User', chapter_head, 'email') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Phone</td>
|
||||
<td>{{ frappe.db.get_value('User', chapter_head, 'phone') }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Address</h3>
|
||||
<p>{{ address }}</p>
|
||||
|
||||
<p style="margin: 20px 0 30px;"><a href="/join-chapter?name={{ name }}" class='btn btn-primary'>Join this Chapter</a></p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- this is a sample default web page template -->
|
||||
@@ -1,4 +1,17 @@
|
||||
<div>
|
||||
<a href={{ route }}>{{ title }} hosted by {{ chapter_head }}</a>
|
||||
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
||||
<a href={{ route }}>
|
||||
<h3>{{ doc.title }}</h3>
|
||||
<p>
|
||||
<span class="label">{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</span>
|
||||
<span class="label">
|
||||
{% if members %}
|
||||
Members: {{ members|length }}
|
||||
{% else %}
|
||||
Members: 0
|
||||
{% endif %}
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
||||
</a>
|
||||
</div>
|
||||
<!-- this is a sample default list template -->
|
||||
@@ -42,6 +42,96 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "introduction",
|
||||
"fieldtype": "Text",
|
||||
"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": "Introduction",
|
||||
"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": "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,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "website_url",
|
||||
"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": "Website URL",
|
||||
"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,
|
||||
@@ -54,7 +144,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-05-08 17:01:30.018083",
|
||||
"modified": "2017-05-12 16:36:07.139907",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Foundation",
|
||||
"name": "Chapter Member",
|
||||
|
||||
@@ -7,4 +7,8 @@ import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ChapterMember(Document):
|
||||
pass
|
||||
def get_context(self, context):
|
||||
context.no_cache = True
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2017, EOSSF and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Chapter Message', {
|
||||
onload: function(frm){
|
||||
console.log("here" + frappe.session.user)
|
||||
chapter_head = frappe.session.user
|
||||
frappe.db.get_value('Chapter', {chapter_head: chapter_head}, 'name', function(data) {
|
||||
frm.set_value('chapter', data.name);
|
||||
})
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,153 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-05-11 14:22:40.165630",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "subject",
|
||||
"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": "Subject",
|
||||
"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,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "message",
|
||||
"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": " Message",
|
||||
"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,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "chapter",
|
||||
"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": "Chapter",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"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
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-05-12 11:10:12.066924",
|
||||
"modified_by": "Administrator",
|
||||
"module": "ERPNext Foundation",
|
||||
"name": "Chapter Message",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, EOSSF and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class ChapterMessage(Document):
|
||||
def get_context(self, context):
|
||||
context.no_cache = True
|
||||
|
||||
def validate(self):
|
||||
chapter = frappe.get_doc('Chapter', self.chapter)
|
||||
if frappe.session.user != chapter.chapter_head:
|
||||
frappe.throw(_('You are not athourize to send message for this Chapter.'))
|
||||
|
||||
def on_update(self):
|
||||
chapter = frappe.get_doc('Chapter', self.chapter)
|
||||
recipients = [d.user for d in chapter.members]
|
||||
message = self.message
|
||||
message += "Chapter Title: " + self.chapter
|
||||
# chapter_title = self.chapter
|
||||
|
||||
frappe.sendmail(recipients = recipients,
|
||||
message = self.message,
|
||||
subject = self.subject)
|
||||
# reference_doctype=self.doctype, reference_name=self.name)
|
||||
|
||||
|
||||
def get_members_emails(chapterTitle):
|
||||
|
||||
members_list = frappe.get_all('User', fields=['email'],
|
||||
filters={'chapter.title': chapterTitle})
|
||||
|
||||
out = []
|
||||
for e in members_list:
|
||||
if e.email:
|
||||
# don't add if holiday
|
||||
out.append(e.email)
|
||||
print out
|
||||
return out
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, EOSSF and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestChapterMessage(unittest.TestCase):
|
||||
pass
|
||||
@@ -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": "<img class='navbar-icon' src='/assets/foundation/img/erpnext-foundation-icon.svg' />ERPNext Foundation",
|
||||
"copyright": "ERPNext Open Source Software Foundation",
|
||||
"footer_address": "<br>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": [
|
||||
|
||||
@@ -1,12 +1,59 @@
|
||||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
{% macro chapter_button() %}
|
||||
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>
|
||||
Go to Chapter Page</a></p>
|
||||
{% endmacro %}
|
||||
{% 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>
|
||||
<p><a href="/login?redirect-to=/{{ chapter.route }}" class='btn btn-primary'>Login</a></p>
|
||||
{% else %}
|
||||
{% if already_member %}
|
||||
<p>You are already a member of {{ chapter.title }}!</p>
|
||||
{{ chapter_button() }}
|
||||
<p><a href="">Leave Chapter</a></p>
|
||||
{% else %}
|
||||
{% if frappe.local.request.method=='POST' %}
|
||||
<p>Welcome to chapter {{ chapter.title }}!</p>
|
||||
<p><a href="/{{ chapter.route }}" class='btn btn-primary'>Go to Chapter Page</a></p>
|
||||
{{ chapter_button() }}
|
||||
{% else %}
|
||||
<div style="padding: 20px 0;">
|
||||
<div class="row">
|
||||
<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"
|
||||
value="{{chapter.name}}">
|
||||
<input name="csrf_token" class="form-control" type="text"
|
||||
value="{{frappe.session.csrf_token}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="user" class="">User Name</label>
|
||||
<input name="user" class="form-control" type="text" value="{{ frappe.session.user }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="website_url" class="">Website URL</label>
|
||||
<input name="website_url" 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"
|
||||
placeholder="Your profession and how you are associated with ERPNext"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="Submit" id="update_member" class="btn-primary">
|
||||
Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
12
foundation/www/join_chapter.js
Normal file
12
foundation/www/join_chapter.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2017, EOSSF and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Chapter Member', {
|
||||
onsubmit: function (frm) {
|
||||
console.log("here" + frappe.session.user)
|
||||
// body...
|
||||
}
|
||||
refresh: function(frm) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -1,12 +1,22 @@
|
||||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
if frappe.session.user!='Guest':
|
||||
context.no_cache = True
|
||||
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()
|
||||
if frappe.session.user!='Guest':
|
||||
if frappe.session.user in [d.user for d in chapter.members]:
|
||||
context.already_member = True
|
||||
else:
|
||||
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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{% macro gold_member(m) %}
|
||||
<div class='gold-member'>
|
||||
<div class="media with-border clickable" style="cursor: pointer;" onclick="location.href='{{ m.route }}'">
|
||||
<div class="media with-border clickable {{ 'text-muted' if m.placeholder else '' }}" style="cursor: pointer;" onclick="location.href='{{ m.route }}'">
|
||||
<div class="media-left">
|
||||
<a href="{{ m.route }}">
|
||||
<img class="media-object" src="{{ m.image or '/assets/foundation/img/gold.png' }}"
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
{% macro silver_member(m) %}
|
||||
<div class='col-sm-4'>
|
||||
<div class='silver-member with-border clickable' style="cursor: pointer;" onclick="location.href='{{ m.route }}'">
|
||||
<div class="silver-member with-border clickable {{ 'text-muted' if m.placeholder else '' }}"
|
||||
style="cursor: pointer;" onclick="location.href='{{ m.route }}'">
|
||||
<h4>{{ m.title }}</h4>
|
||||
<p><span class=label>Silver Member</span></p>
|
||||
<p>{{ m.introduction[:100] }}</p>
|
||||
|
||||
@@ -27,7 +27,8 @@ def get_context(context):
|
||||
title='Your Company',
|
||||
introduction='Become a Gold Member today and get your company featured here',
|
||||
image='/assets/foundation/img/gold.png',
|
||||
route='/members'
|
||||
route='/members',
|
||||
placeholder=True
|
||||
))
|
||||
|
||||
context.silver_members = []
|
||||
@@ -43,7 +44,8 @@ def get_context(context):
|
||||
title='Your Company',
|
||||
introduction='Become a Silver Member today and get your company featured here',
|
||||
image='/assets/foundation/img/silver.png',
|
||||
route='/members'
|
||||
route='/members',
|
||||
placeholder=True
|
||||
))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user