[merge] merge with master

This commit is contained in:
Rushabh Mehta
2013-05-24 16:09:13 +05:30
120 changed files with 1431 additions and 712 deletions

View File

@@ -76,10 +76,12 @@ class DocType:
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.published_on)
self.doc.content_html = self.doc.content
if self.doc.blogger:
self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
self.doc.description = self.doc.blog_intro or self.doc.content[:140]
self.doc.meta_description = self.doc.description
self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")

View File

@@ -44,3 +44,5 @@ class DocType():
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
get_slideshow(self)
self.doc.meta_description = self.doc.description

View File

@@ -5,4 +5,9 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
self.doc, self.doclist = d, dl
def on_update(self):
# a slide show can be in use and any change in it should get reflected
from webnotes.webutils import clear_cache
clear_cache()

View File

@@ -49,9 +49,10 @@ rss_item = u"""
def generate():
"""generate rss feed"""
import webnotes, os
import os, urllib
import webnotes
from webnotes.model.doc import Document
from website.helpers.blog import get_blog_content
from webnotes.utils import escape_html
host = (os.environ.get('HTTPS') and 'https://' or 'http://') + os.environ.get('HTTP_HOST')
@@ -62,7 +63,8 @@ def generate():
order by published_on desc limit 20""", as_dict=1)
for blog in blog_list:
blog.link = host + '/' + blog.name + '.html'
blog.link = urllib.quote(host + '/' + blog.name + '.html')
blog.content = escape_html(blog.content or "")
items += rss_item % blog

View File

@@ -4,10 +4,9 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr
from webnotes.utils import cstr, cint
from webnotes.webutils import build_html, delete_page_cache
@webnotes.whitelist(allow_guest=True)
def get_product_info(item_code):
"""get product price / stock info"""
@@ -20,10 +19,20 @@ def get_product_info(item_code):
in_stock = in_stock[0][0] > 0 and 1 or 0
else:
in_stock = -1
price = price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
`tabItem Price` where parent=%s and price_list_name=%s""",
(item_code, price_list), as_dict=1) or []
price = price and price[0] or None
if price:
price["ref_currency"] = not cint(webnotes.conn.get_default("hide_currency_symbol")) \
and (webnotes.conn.get_value("Currency", price.ref_currency, "symbol") or price.ref_currency) \
or ""
return {
"price": price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
`tabItem Price` where parent=%s and price_list_name=%s""",
(item_code, price_list), as_dict=1) or [],
"price": price,
"stock": in_stock
}

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License (v3). For more information see license.txt
from __future__ import unicode_literals
frame_xml = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">%s
</urlset>"""
@@ -32,10 +33,11 @@ def generate(domain):
for p in pages:
if count >= max_items: break
page_url = os.path.join(domain, urllib.quote(p[0]))
modified = p[1].strftime('%Y-%m-%d')
site_map += link_xml % (page_url, modified)
count += 1
if p[0]:
page_url = os.path.join(domain, urllib.quote(p[0]))
modified = p[1].strftime('%Y-%m-%d')
site_map += link_xml % (page_url, modified)
count += 1
if count >= max_items: break

View File

@@ -7,4 +7,7 @@
font-size: 18px;
line-height: 200%;
}
.item-price {
margin-top: 20px;
}
</style>

View File

@@ -12,6 +12,10 @@
{% else %}
<h3>{{ name }}</h3>
{% endif %}
</div>
{% include 'app/website/templates/html/product_search_box.html' %}
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
<div class="col col-lg-12">
{% if sub_groups %}
<hr />
<div class="row">

View File

@@ -35,23 +35,25 @@
{{ web_long_description or web_short_description or
"[No description given]" }}
</div>
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
<div class="item-price hide"></div>
<div class="item-stock"></div>
</div>
</div>
{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%}
<div class="row" style="margin-top: 20px">
<div class="span12">
<h4>Specifications</h4>
<table class="table table-bordered" style="width: 100%">
{% for d in obj.doclist.get(
{"doctype":"Item Website Specification"}) %}
{"doctype":"Item Website Specification"}) -%}
<tr>
<td style="width: 30%;">{{ d.label }}</td>
<td>{{ d.description }}</td>
</tr>
{% endfor %}
{%- endfor %}
</table>
{% endif %}
<div class="item-price hide">
<p>Price:</p>
</div>
<div class="item-stock"></div>
</div>
</div>
{%- endif %}
</div>
{% endblock %}

View File

@@ -8,7 +8,7 @@
{% if slide.heading or slide.description %}
<div class="carousel-caption">
{% if slide.heading %}<h4>{{ slide.heading }}</h4>{% endif %}
{% if slide.heading %}<p>{{ slide.description }}</p>{% endif %}
{% if slide.description %}<p>{{ slide.description }}</p>{% endif %}
</div>
{% endif %}
</div>

View File

@@ -26,8 +26,8 @@ $(document).ready(function() {
success: function(data) {
if(data.message) {
if(data.message.price) {
$("<h4>").html(data.message.price[0].ref_currency + " "
+ data.message.price[0].ref_rate).appendTo(".item-price");
$("<h4>").html(data.message.price.ref_currency + " "
+ data.message.price.ref_rate).appendTo(".item-price");
$(".item-price").toggle(true);
}
if(data.message.stock==0) {