mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
[new] Chapter Web Form Added
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
"label": "Chapter Head",
|
"label": "Chapter Head",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"options": "User",
|
"options": "Member",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"description": "chapters/chapter_name",
|
||||||
"fieldname": "route",
|
"fieldname": "route",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@@ -189,7 +190,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@@ -297,7 +298,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-08-02 13:04:00.723298",
|
"modified": "2017-11-08 04:10:39.262164",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Foundation",
|
"module": "ERPNext Foundation",
|
||||||
"name": "Chapter",
|
"name": "Chapter",
|
||||||
|
|||||||
@@ -11,13 +11,20 @@ from frappe import _
|
|||||||
class Chapter(WebsiteGenerator):
|
class Chapter(WebsiteGenerator):
|
||||||
def get_context(self, context):
|
def get_context(self, context):
|
||||||
context.no_cache = True
|
context.no_cache = True
|
||||||
|
context.parents = [dict(label='View Chapters',
|
||||||
|
route='chapters', title='View Chapters')]
|
||||||
|
context.published = self.published
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
if not self.route:
|
||||||
|
self.route = 'chapters/' + self.scrub(self.title)
|
||||||
|
|
||||||
|
|
||||||
chapter_head = self.chapter_head
|
chapter_head = self.chapter_head
|
||||||
chapter = frappe.get_all('Chapter', filters={'published': True}, fields=['chapter_head'])
|
chapter = frappe.get_all('Chapter', filters={'published': True}, fields=['chapter_head'])
|
||||||
|
|
||||||
# if chapter_head in [d.chapter_head for d in chapter]:
|
# if chapter_head in [d.chapter_head for d in chapter]:
|
||||||
# frappe.throw(_('You are not allow to create more than one Chapter'))
|
# frappe.throw(_('You are not allow to create more than one Chapter'))
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
{% if published %}
|
||||||
<a href={{ route }}>
|
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
||||||
<h3>{{ doc.title }}</h3>
|
<a href={{ route }}>
|
||||||
<p>
|
<h3>{{ doc.title }}</h3>
|
||||||
<span class="label">{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</span>
|
<p>
|
||||||
<span class="label">
|
<span class="label">{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</span>
|
||||||
{% if members %}
|
<span class="label">
|
||||||
Members: {{ members|length }}
|
{% if members %}
|
||||||
{% else %}
|
Members: {{ members|length }}
|
||||||
Members: 0
|
{% else %}
|
||||||
{% endif %}
|
Members: 0
|
||||||
</span>
|
{% endif %}
|
||||||
</p>
|
</span>
|
||||||
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
</p>
|
||||||
</a>
|
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<!-- this is a sample default list template -->
|
<!-- this is a sample default list template -->
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
frappe.ready(function() {
|
||||||
|
// bind events here
|
||||||
|
})
|
||||||
107
foundation/erpnext_foundation/web_form/chapter/chapter.json
Normal file
107
foundation/erpnext_foundation/web_form/chapter/chapter.json
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
"accept_payment": 0,
|
||||||
|
"allow_comments": 0,
|
||||||
|
"allow_delete": 0,
|
||||||
|
"allow_edit": 1,
|
||||||
|
"allow_incomplete": 0,
|
||||||
|
"allow_multiple": 0,
|
||||||
|
"allow_print": 0,
|
||||||
|
"amount": 0.0,
|
||||||
|
"amount_based_on_field": 0,
|
||||||
|
"creation": "2017-11-08 03:27:03.739352",
|
||||||
|
"currency": "USD",
|
||||||
|
"doc_type": "Chapter",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Web Form",
|
||||||
|
"idx": 0,
|
||||||
|
"introduction_text": "Update Chapter Profile that will be shown on your Chapter Listing.",
|
||||||
|
"is_standard": 1,
|
||||||
|
"login_required": 1,
|
||||||
|
"max_attachment_size": 0,
|
||||||
|
"modified": "2017-11-08 04:10:21.294071",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "ERPNext Foundation",
|
||||||
|
"name": "chapter",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"payment_button_label": "Buy Now",
|
||||||
|
"published": 1,
|
||||||
|
"route": "chapter-settings",
|
||||||
|
"show_sidebar": 1,
|
||||||
|
"sidebar_items": [],
|
||||||
|
"success_url": "/chapters",
|
||||||
|
"title": "Chapter",
|
||||||
|
"web_form_fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "title",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Title",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "chapter_head",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Chapter Head Email",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"options": "",
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "introduction",
|
||||||
|
"fieldtype": "Text Editor",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Introduction",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "meetup_embed_html",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Meetup Embed HTML",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "region",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Region",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "address",
|
||||||
|
"fieldtype": "Text",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Address",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "chapters/chapter_name",
|
||||||
|
"fieldname": "route",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Route",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
# do your magic here
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user