[website] [minor] moving to framework
This commit is contained in:
parent
4c6120ae04
commit
7c2312a74c
@ -4,8 +4,8 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import cstr, cint, fmt_money
|
from webnotes.utils import cstr, cint, fmt_money, get_base_path
|
||||||
from webnotes.webutils import build_html, delete_page_cache
|
from webnotes.webutils import delete_page_cache
|
||||||
from selling.utils.cart import _get_cart_quotation
|
from selling.utils.cart import _get_cart_quotation
|
||||||
|
|
||||||
@webnotes.whitelist(allow_guest=True)
|
@webnotes.whitelist(allow_guest=True)
|
||||||
@ -106,10 +106,12 @@ def get_group_item_count(item_group):
|
|||||||
or name in (select parent from `tabWebsite Item Group`
|
or name in (select parent from `tabWebsite Item Group`
|
||||||
where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
|
where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
|
||||||
|
|
||||||
def get_item_for_list_in_html(r):
|
def get_item_for_list_in_html(context):
|
||||||
scrub_item_for_list(r)
|
from jinja2 import Environment, FileSystemLoader
|
||||||
r.template = "app/website/templates/html/product_in_grid.html"
|
scrub_item_for_list(context)
|
||||||
return build_html(r)
|
jenv = Environment(loader = FileSystemLoader(get_base_path()))
|
||||||
|
template = jenv.get_template("app/stock/doctype/item/templates/includes/product_in_grid.html")
|
||||||
|
return template.render(context)
|
||||||
|
|
||||||
def scrub_item_for_list(r):
|
def scrub_item_for_list(r):
|
||||||
if not r.website_description:
|
if not r.website_description:
|
||||||
|
0
setup/doctype/item_group/templates/__init__.py
Normal file
0
setup/doctype/item_group/templates/__init__.py
Normal file
@ -1,11 +1,11 @@
|
|||||||
{% extends "app/website/templates/html/page.html" %}
|
{% extends base_template %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include 'app/website/templates/html/product_search_box.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_search_box.html' %}
|
||||||
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_breadcrumbs.html' %}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{% if slideshow %}<!-- slideshow -->
|
{% if slideshow %}<!-- slideshow -->
|
||||||
{% include "app/website/templates/html/slideshow.html" %}
|
{% include "lib/website/templates/includes/slideshow.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if description %}<!-- description -->
|
{% if description %}<!-- description -->
|
||||||
<div>{{ description or ""}}</div>
|
<div>{{ description or ""}}</div>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
{{ item }}
|
{{ item }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% if len(items)==100 %}
|
{% if (items|length)==100 %}
|
||||||
<div class="alert info">Showing top 100 items.</div>
|
<div class="alert info">Showing top 100 items.</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
@ -0,0 +1,2 @@
|
|||||||
|
doctype = "Item Group"
|
||||||
|
condition_field = "show_in_website"
|
@ -43,9 +43,3 @@ class DocType:
|
|||||||
"partner_address": filter_strip_join(address_rows, "\n<br>"),
|
"partner_address": filter_strip_join(address_rows, "\n<br>"),
|
||||||
"phone": filter_strip_join(cstr(address.phone).split(","), "\n<br>")
|
"phone": filter_strip_join(cstr(address.phone).split(","), "\n<br>")
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_partner_args():
|
|
||||||
return {
|
|
||||||
"partners": webnotes.conn.sql("""select * from `tabSales Partner`
|
|
||||||
where show_in_website=1 order by name asc""", as_dict=True),
|
|
||||||
}
|
|
0
setup/doctype/sales_partner/templates/__init__.py
Normal file
0
setup/doctype/sales_partner/templates/__init__.py
Normal file
@ -1,4 +1,4 @@
|
|||||||
{% extends "app/website/templates/html/page.html" %}
|
{% extends base_template %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-md-12" itemscope itemtype="http://schema.org/Organization">
|
<div class="col-md-12" itemscope itemtype="http://schema.org/Organization">
|
@ -0,0 +1,2 @@
|
|||||||
|
doctype = "Sales Partner"
|
||||||
|
condition_field = "show_in_website"
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "app/website/templates/html/page.html" %}
|
{% extends base_template %}
|
||||||
|
|
||||||
{% set title="Partners" %}
|
{% set title="Partners" %}
|
||||||
|
|
7
setup/doctype/sales_partner/templates/pages/partners.py
Normal file
7
setup/doctype/sales_partner/templates/pages/partners.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def get_context():
|
||||||
|
return {
|
||||||
|
"partners": webnotes.conn.sql("""select * from `tabSales Partner`
|
||||||
|
where show_in_website=1 order by name asc""", as_dict=True),
|
||||||
|
}
|
0
stock/doctype/item/templates/__init__.py
Normal file
0
stock/doctype/item/templates/__init__.py
Normal file
0
stock/doctype/item/templates/generators/__init__.py
Normal file
0
stock/doctype/item/templates/generators/__init__.py
Normal file
@ -1,28 +1,32 @@
|
|||||||
{% extends "app/website/templates/html/page.html" %}
|
{% extends base_template %}
|
||||||
|
|
||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
{% include "app/website/templates/js/product_page.js" %}
|
<script>
|
||||||
|
{% include "app/stock/doctype/item/templates/includes/product_page.js" %}
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{% include "app/website/templates/css/product_page.css" %}
|
<style>
|
||||||
|
{% include "app/stock/doctype/item/templates/includes/product_page.css" %}
|
||||||
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include 'app/website/templates/html/product_search_box.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_search_box.html' %}
|
||||||
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_breadcrumbs.html' %}
|
||||||
<div class="col-md-12 product-page-content" itemscope itemtype="http://schema.org/Product">
|
<div class="col-md-12 product-page-content" itemscope itemtype="http://schema.org/Product">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{% if slideshow %}
|
{% if slideshow %}
|
||||||
{% include "app/website/templates/html/slideshow.html" %}
|
{% include "lib/website/templates/includes/html/slideshow.html" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if website_image %}
|
{% if website_image %}
|
||||||
<image itemprop="image" class="item-main-image"
|
<image itemprop="image" class="item-main-image"
|
||||||
src="{{ website_image }}" />
|
src="{{ website_image }}" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="img-area">
|
<div class="img-area">
|
||||||
{% include 'app/website/templates/html/product_missing_image.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_missing_image.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
2
stock/doctype/item/templates/generators/item.py
Normal file
2
stock/doctype/item/templates/generators/item.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
doctype = "Item"
|
||||||
|
condition_field = "show_in_website"
|
@ -1,4 +1,4 @@
|
|||||||
{% if obj.parent_groups and len(obj.parent_groups) > 1 %}
|
{% if obj.parent_groups and (obj.parent_groups|length) > 1 %}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{%- if website_image -%}
|
{%- if website_image -%}
|
||||||
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
|
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{% include 'app/website/templates/html/product_missing_image.html' %}
|
{% include 'app/stock/doctype/item/templates/includes/product_missing_image.html' %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "app/website/templates/html/page.html" %}
|
{% extends base_template %}
|
||||||
|
|
||||||
{% set title="Product Search" %}
|
{% set title="Product Search" %}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user