address now not in dialog, added slideshows in products and groups and removed transaction history from customer / supplier / sales partner
diff --git a/website/doctype/web_page/web_page.py b/website/doctype/web_page/web_page.py
index 324893d..d902744 100644
--- a/website/doctype/web_page/web_page.py
+++ b/website/doctype/web_page/web_page.py
@@ -42,9 +42,5 @@
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)
diff --git a/website/doctype/website_script/__init__.py b/website/doctype/website_script/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/website/doctype/website_script/__init__.py
diff --git a/website/doctype/website_script/website_script.py b/website/doctype/website_script/website_script.py
new file mode 100644
index 0000000..928aa9f
--- /dev/null
+++ b/website/doctype/website_script/website_script.py
@@ -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
\ No newline at end of file
diff --git a/website/doctype/website_script/website_script.txt b/website/doctype/website_script/website_script.txt
new file mode 100644
index 0000000..cf22537
--- /dev/null
+++ b/website/doctype/website_script/website_script.txt
@@ -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"
+ }
+]
\ No newline at end of file
diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt
index 4ef8add..78e9336 100644
--- a/website/doctype/website_settings/website_settings.txt
+++ b/website/doctype/website_settings/website_settings.txt
@@ -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,
@@ -81,6 +81,15 @@
"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",
"label": "Brand HTML",
@@ -172,22 +181,6 @@
"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",
"write": 1,
diff --git a/website/helpers/product.py b/website/helpers/product.py
index 0497124..1e8257a 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -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 @@
@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 @@
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 @@
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 @@
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)
\ No newline at end of file
diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py
new file mode 100644
index 0000000..2c2ae4b
--- /dev/null
+++ b/website/helpers/slideshow.py
@@ -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
+
\ No newline at end of file
diff --git a/website/page/website_home/website_home.html b/website/page/website_home/website_home.html
index 8c986cc..b32995b 100644
--- a/website/page/website_home/website_home.html
+++ b/website/page/website_home/website_home.html
@@ -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>
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
index aef91a9..322ce60 100644
--- a/website/templates/html/outer.html
+++ b/website/templates/html/outer.html
@@ -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 %}
diff --git a/website/templates/html/product_group.html b/website/templates/html/product_group.html
index c44f695..7c22a15 100644
--- a/website/templates/html/product_group.html
+++ b/website/templates/html/product_group.html
@@ -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>
diff --git a/website/templates/html/product_page.html b/website/templates/html/product_page.html
index 898a669..a574cf6 100644
--- a/website/templates/html/product_page.html
+++ b/website/templates/html/product_page.html
@@ -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>
diff --git a/website/templates/html/slideshow.html b/website/templates/html/slideshow.html
new file mode 100644
index 0000000..8641724
--- /dev/null
+++ b/website/templates/html/slideshow.html
@@ -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 %}
diff --git a/website/templates/html/web_page.html b/website/templates/html/web_page.html
index 78da963..aaa0aa8 100644
--- a/website/templates/html/web_page.html
+++ b/website/templates/html/web_page.html
@@ -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>
diff --git a/website/utils.py b/website/utils.py
index 4af4981..8d24574 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -226,12 +226,14 @@
})
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 @@
webnotes.cache().delete_keys("page:")
def delete_page_cache(page_name):
- webnotes.cache().delete_value("page:" + page_name)
\ No newline at end of file
+ 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
\ No newline at end of file