feat: use blog_post_list as default

This commit is contained in:
Shivam Mishra 2020-06-01 19:15:00 +05:30
parent 882b200f32
commit 8e815552f6
5 changed files with 6 additions and 26 deletions

View file

@ -483,6 +483,9 @@ class Meta(Document):
def get_row_template(self):
return self.get_web_template(suffix='_row')
def get_list_template(self):
return self.get_web_template(suffix='_list')
def get_web_template(self, suffix=''):
'''Returns the relative path of the row template for this doctype'''
module_name = frappe.scrub(self.module)

View file

@ -1,25 +0,0 @@
{% if sub_title %}
<h4 class="text-muted">{{ sub_title }}</h4>
{% endif %}
{% if not result -%}
<div class="text-muted" style="min-height: 300px;">
{{ no_result_message or _("Nothing to show") }}
</div>
{% else %}
<div class="website-list" data-doctype="{{ doctype }}"
data-txt="{{ txt or '[notxt]' | e }}">
<!-- {% if not hide_filters -%}
{% include "templates/includes/list/filters.html" %}
{%- endif %} -->
{% if result_heading_template %}{% include result_heading_template %}{% endif %}
<div class="result">
{% for item in result %}
{{ item }}
{% endfor %}
</div>
<div class="more-block {% if not show_more -%} hidden {%- endif %}">
<button class="btn btn-light btn-more btn-sm">{{ _("More") }}</button>
</div>
</div>
{%- endif %}

View file

@ -153,7 +153,6 @@ class BlogPost(WebsiteGenerator):
def get_list_context(context=None):
list_context = frappe._dict(
template = "/templates/includes/blog/blog.html",
get_list = get_blog_list,
no_breadcrumbs = True,
hide_filters = True,

View file

@ -171,6 +171,9 @@ def get_list_context(context, doctype, web_form_name=None):
if not meta.custom and not list_context.row_template:
list_context.row_template = meta.get_row_template()
if not meta.custom and not list_context.list_template:
list_context.template = meta.get_list_template()
return list_context
def get_list(doctype, txt, filters, limit_start, limit_page_length=20, ignore_permissions=False,