[new] Chapter Web Form Added

This commit is contained in:
Vishal
2017-11-08 15:47:58 +05:30
parent 7950be133a
commit 0328746190
7 changed files with 149 additions and 20 deletions

View File

@@ -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",

View File

@@ -11,8 +11,15 @@ 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'])

View File

@@ -1,4 +1,5 @@
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable"> {% if published %}
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
<a href={{ route }}> <a href={{ route }}>
<h3>{{ doc.title }}</h3> <h3>{{ doc.title }}</h3>
<p> <p>
@@ -13,5 +14,6 @@
</p> </p>
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p> <p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
</a> </a>
</div> </div>
{% endif %}
<!-- this is a sample default list template --> <!-- this is a sample default list template -->

View File

@@ -0,0 +1,3 @@
frappe.ready(function() {
// bind events here
})

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

View File

@@ -0,0 +1,9 @@
from __future__ import unicode_literals
import frappe
def get_context(context):
# do your magic here
pass