mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 05:39:12 +00:00
[new] Chapter Module clean up after review
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 1,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:title",
|
||||
"beta": 0,
|
||||
"creation": "2017-09-14 13:36:03.904702",
|
||||
@@ -170,6 +170,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "chapters/chapter_name\nleave blank automatically set after saving chapter.",
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
@@ -297,7 +298,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-23 17:31:44.669507",
|
||||
"modified": "2017-11-24 15:47:01.752772",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Non Profit",
|
||||
"name": "Chapter",
|
||||
@@ -329,7 +330,7 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Non Profit",
|
||||
"route": "chapter",
|
||||
"route": "chapters",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
|
||||
@@ -5,18 +5,20 @@
|
||||
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):
|
||||
_website = frappe._dict(
|
||||
condition_field = "published",
|
||||
)
|
||||
|
||||
def get_context(self, context):
|
||||
context.no_cache = True
|
||||
context.parents = [dict(label='View All Chapters',
|
||||
route='chapters', title='View Chapters')]
|
||||
|
||||
def validate(self):
|
||||
chapter_head = self.chapter_head
|
||||
chapter = frappe.get_all('Chapter', filters={'published': True}, fields=['chapter_head'])
|
||||
if not self.route: #pylint: disable=E0203
|
||||
self.route = 'chapter/' + self.scrub(self.name)
|
||||
self.route = 'chapters/' + self.scrub(self.name)
|
||||
|
||||
def enable(self):
|
||||
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
|
||||
@@ -31,4 +33,4 @@ def get_list_context(context):
|
||||
context.title = 'All Chapters'
|
||||
context.no_breadcrumbs = True
|
||||
context.order_by = 'creation desc'
|
||||
context.introduction = '<p>All Chapters</p>'
|
||||
context.introduction = '<p>All Chapters</p>'
|
||||
@@ -57,8 +57,8 @@
|
||||
<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>
|
||||
<p style="margin: 20px 0 30px;"><a href="/leave-chapter?name={{ name }}" class=''>Leave this Chapter</a></p>
|
||||
<p style="margin: 20px 0 30px;"><a href="/non_profit/join-chapter?name={{ name }}" class='btn btn-primary'>Join this Chapter</a></p>
|
||||
<p style="margin: 20px 0 30px;"><a href="/non_profit/leave-chapter?name={{ name }}" class=''>Leave this Chapter</a></p>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div style="margin-bottom: 30px; max-width: 600px" class="with-border clickable">
|
||||
<a href={{ route }}>
|
||||
<a href="/{{ doc.route }}">
|
||||
<h3>{{ doc.title }}</h3>
|
||||
<p>
|
||||
<span class="label">{{ frappe.db.get_value('User', chapter_head, 'full_name') }}</span>
|
||||
@@ -14,4 +14,45 @@
|
||||
<p>{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}</p>
|
||||
</a>
|
||||
</div>
|
||||
<!-- this is a sample default list template -->
|
||||
<style type="text/css">
|
||||
|
||||
.label {
|
||||
font-weight: normal;
|
||||
background-color: #d1d8dd;
|
||||
font-size: 13px;
|
||||
padding: 3px 7px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
.with-border {
|
||||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
padding: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.with-border h3 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #5E64FF;
|
||||
}
|
||||
|
||||
.clickable a {
|
||||
color: #161c23;
|
||||
}
|
||||
|
||||
.with-border.clickable:hover {
|
||||
border-color: #36414C;
|
||||
background-color: #fafbfc;
|
||||
|
||||
}
|
||||
|
||||
.with-border a, .with-border a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user