mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
address now not in dialog, added slideshows in products and groups and removed transaction history from customer / supplier / sales partner
This commit is contained in:
@@ -42,9 +42,5 @@ class DocType():
|
||||
|
||||
def prepare_template_args(self):
|
||||
if self.doc.slideshow:
|
||||
slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow)
|
||||
self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
|
||||
self.doc.slideshow_header = slideshow.doc.header or ""
|
||||
for s in self.slides:
|
||||
if s.image and not s.image.lower().startswith("http"):
|
||||
s.image = "files/" + s.image
|
||||
from website.helpers.slideshow import get_slideshow
|
||||
get_slideshow(self)
|
||||
|
||||
0
website/doctype/website_script/__init__.py
Normal file
0
website/doctype/website_script/__init__.py
Normal file
8
website/doctype/website_script/website_script.py
Normal file
8
website/doctype/website_script/website_script.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
51
website/doctype/website_script/website_script.txt
Normal file
51
website/doctype/website_script/website_script.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 11:51:24",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 12:25:04"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
"description": "Script to attach to all web pages.",
|
||||
"doctype": "DocType",
|
||||
"module": "Website",
|
||||
"document_type": "Other",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"parent": "Website Script",
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"label": "Javascript",
|
||||
"parenttype": "DocType",
|
||||
"options": "Javascript",
|
||||
"fieldname": "javascript",
|
||||
"fieldtype": "Code",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"parent": "Website Script",
|
||||
"read": 1,
|
||||
"name": "__common__",
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"role": "Website Manager",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "Website Script",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
@@ -4,7 +4,7 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-12 23:29:36",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-25 15:41:48"
|
||||
"modified": "2012-12-27 12:27:02"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
@@ -80,6 +80,15 @@
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "Background shade of the top menu bar",
|
||||
"doctype": "DocField",
|
||||
"label": "Top Bar Background",
|
||||
"options": "Black\nWhite",
|
||||
"fieldname": "top_bar_background",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag. Keep size as 200px x 30px",
|
||||
"doctype": "DocField",
|
||||
@@ -171,22 +180,6 @@
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Startup",
|
||||
"fieldname": "analytics",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "Bind events on startup and page change",
|
||||
"doctype": "DocField",
|
||||
"label": "Startup Code",
|
||||
"options": "Javascript",
|
||||
"fieldname": "startup_code",
|
||||
"fieldtype": "Code",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
# License: GNU General Public License (v3). For more information see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes
|
||||
from webnotes.utils import cstr
|
||||
from website.utils import build_html, url_for_website, delete_page_cache
|
||||
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
@@ -26,8 +29,6 @@ def get_product_info(item_code):
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_product_list(search=None, product_group=None, start=0, limit=10):
|
||||
from webnotes.utils import cstr
|
||||
|
||||
# base query
|
||||
query = """select name, item_name, page_name, website_image, item_group,
|
||||
web_long_description as website_description
|
||||
@@ -81,7 +82,6 @@ def get_group_item_count(item_group):
|
||||
where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
|
||||
|
||||
def get_item_for_list_in_html(r):
|
||||
from website.utils import build_html
|
||||
scrub_item_for_list(r)
|
||||
r.template = "html/product_in_list.html"
|
||||
return build_html(r)
|
||||
@@ -91,8 +91,7 @@ def scrub_item_for_list(r):
|
||||
r.website_description = "No description given"
|
||||
if len(r.website_description.split(" ")) > 24:
|
||||
r.website_description = " ".join(r.website_description.split(" ")[:24]) + "..."
|
||||
if r.website_image and not r.website_image.lower().startswith("http"):
|
||||
r.website_image = "files/" + r.website_image
|
||||
r.website_image = url_for_website(r.website_image)
|
||||
|
||||
def get_parent_item_groups(item_group_name):
|
||||
item_group = webnotes.doc("Item Group", item_group_name)
|
||||
@@ -102,6 +101,5 @@ def get_parent_item_groups(item_group_name):
|
||||
order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
|
||||
|
||||
def invalidate_cache_for(item_group):
|
||||
from website.utils import delete_page_cache
|
||||
for i in get_parent_item_groups(item_group):
|
||||
delete_page_cache(i.page_name)
|
||||
26
website/helpers/slideshow.py
Normal file
26
website/helpers/slideshow.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import webnotes
|
||||
|
||||
def get_slideshow(obj):
|
||||
slideshow = webnotes.model_wrapper("Website Slideshow", obj.doc.slideshow)
|
||||
obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
|
||||
obj.doc.slideshow_header = slideshow.doc.header or ""
|
||||
for s in obj.slides:
|
||||
if s.image and not s.image.lower().startswith("http"):
|
||||
s.image = "files/" + s.image
|
||||
|
||||
@@ -29,18 +29,15 @@
|
||||
<div class="layout-side-section">
|
||||
<div class="psidebar">
|
||||
<div class="section">
|
||||
<p><b>Create website with static pages and blogs</b></p>
|
||||
<ul>
|
||||
<li>"Website Settings" - to setup header and footers.
|
||||
<li>"Web Page" - for static web page.
|
||||
<li>"Blog" - for blog entry.
|
||||
</ul>
|
||||
<p><b>Notes: </b></p>
|
||||
<ul>
|
||||
<li>All pages are accessible via `#` + page name appended to your url.
|
||||
<li>Product catalogue is updated from Item Master (set Show in Website = 'Yes', in
|
||||
Sales Settings).
|
||||
</ul> </div>
|
||||
<div class="section-head">Advanced</div>
|
||||
<div class="section-body">
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Javascript to append to the head section of the page."
|
||||
href="#Form/Website Script">Website Script</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</header>
|
||||
<div id="body_div">
|
||||
<div class="navbar-wrapper">
|
||||
<div class="navbar navbar-inverse"
|
||||
<div class="navbar{% if top_bar_background=="Black" %} navbar-inverse{% endif %}"
|
||||
style="margin-bottom: 0px;">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
@@ -61,7 +61,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>$('.dropdown-toggle').dropdown()</script>
|
||||
|
||||
<div class="content" id="page-{{ name }}" style="display: block;">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
<div class="layout-main" style="padding: 30px;">
|
||||
{% include 'html/product_search_box.html' %}
|
||||
{% include 'html/product_breadcrumbs.html' %}
|
||||
{% if description %}
|
||||
{% if slideshow %}<!-- slideshow -->
|
||||
{% include "html/slideshow.html" %}
|
||||
{% endif %}
|
||||
{% if description %}<!-- description -->
|
||||
<div>{{ description or ""}}</div>
|
||||
{% else %}
|
||||
<h3>{{ name }}</h3>
|
||||
|
||||
@@ -22,19 +22,25 @@
|
||||
<div class="layout-main" style="padding: 30px;">
|
||||
{% include 'html/product_search_box.html' %}
|
||||
{% include 'html/product_breadcrumbs.html' %}
|
||||
<h3>{{ item_name }}</h3>
|
||||
<h3 itemprop="name">{{ item_name }}</h3>
|
||||
<p class="help">Item Code: {{ name }}</p>
|
||||
<div class="product-page-content">
|
||||
<div class="span6">
|
||||
{% if website_image %}
|
||||
<image class="item-main-image" src="{% if website_image.lower().startswith('http') %}{{ website_image}}{% else %}files/{{ website_image }}{% endif %}" />
|
||||
<div class="product-page-content"
|
||||
itemscope itemtype="http://schema.org/Product">
|
||||
{% if slideshow %}
|
||||
{% include "html/slideshow.html" %}
|
||||
{% else %}
|
||||
<div class="img-area">
|
||||
{% include 'html/product_missing_image.html' %}
|
||||
<div class="span6">
|
||||
{% if website_image %}
|
||||
<image itemprop="image" class="item-main-image"
|
||||
src="{{ website_image }}" />
|
||||
{% else %}
|
||||
<div class="img-area">
|
||||
{% include 'html/product_missing_image.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<br><br>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<div class="item-price hide">
|
||||
<p>Price:</p>
|
||||
@@ -44,7 +50,7 @@
|
||||
<div class="clearfix"></div>
|
||||
<div class="span9">
|
||||
<h3>Product Description</h3>
|
||||
<div>
|
||||
<div itemprop="description">
|
||||
{{ web_long_description or web_short_description or
|
||||
"[No description given]" }}
|
||||
</div>
|
||||
|
||||
21
website/templates/html/slideshow.html
Normal file
21
website/templates/html/slideshow.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{% if slideshow %}
|
||||
{{ slideshow_header }}
|
||||
<div id="myCarousel" class="carousel slide">
|
||||
<div class="carousel-inner">
|
||||
{% for slide in obj.slides %}
|
||||
<div class="{% if slide.idx==1 %}active {% endif %}item">
|
||||
<img src="{{ slide.image }}" />
|
||||
<div class="carousel-caption">
|
||||
<h4>{{ slide.heading }}</h4>
|
||||
<p>{{ slide.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a class="carousel-control left" href="#myCarousel"
|
||||
data-slide="prev">‹</a>
|
||||
<a class="carousel-control right" href="#myCarousel"
|
||||
data-slide="next">›</a>
|
||||
</div>
|
||||
<script>$(".carousel").carousel();</script>
|
||||
{% endif %}
|
||||
@@ -10,27 +10,7 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" style="text-align: {{ text_align }};">
|
||||
<div class="layout-main">
|
||||
{% if slideshow %}
|
||||
{{ slideshow_header }}
|
||||
<div id="myCarousel" class="carousel slide">
|
||||
<div class="carousel-inner">
|
||||
{% for slide in obj.slides %}
|
||||
<div class="{% if slide.idx==1 %}active {% endif %}item">
|
||||
<img src="{{ slide.image }}" />
|
||||
<div class="carousel-caption">
|
||||
<h4>{{ slide.heading }}</h4>
|
||||
<p>{{ slide.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a class="carousel-control left" href="#myCarousel"
|
||||
data-slide="prev">‹</a>
|
||||
<a class="carousel-control right" href="#myCarousel"
|
||||
data-slide="next">›</a>
|
||||
</div>
|
||||
<script>$(".carousel").carousel();</script>
|
||||
{% endif %}
|
||||
{% include "html/slideshow.html" %}
|
||||
{{ main_section }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -226,12 +226,14 @@ def get_outer_env():
|
||||
})
|
||||
|
||||
settings = webnotes.doc("Website Settings", "Website Settings")
|
||||
for k in ["brand_html", "copyright", "address"]:
|
||||
for k in ["brand_html", "copyright", "address", "top_bar_background"]:
|
||||
if k in settings.fields:
|
||||
ret[k] = settings.fields[k]
|
||||
|
||||
if not ret.brand_html:
|
||||
ret.brand_html = "ERPNext"
|
||||
if not ret.top_bar_background:
|
||||
ret.top_bar_background = "Black"
|
||||
return ret
|
||||
|
||||
def get_home_page():
|
||||
@@ -250,4 +252,10 @@ def clear_cache(page_name=None):
|
||||
webnotes.cache().delete_keys("page:")
|
||||
|
||||
def delete_page_cache(page_name):
|
||||
webnotes.cache().delete_value("page:" + page_name)
|
||||
webnotes.cache().delete_value("page:" + page_name)
|
||||
|
||||
def url_for_website(url):
|
||||
if url and not url.lower().startswith("http"):
|
||||
return "files/" + url
|
||||
else:
|
||||
return url
|
||||
Reference in New Issue
Block a user