[cleanup] homepage
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
index 5ec396d..689d94e 100644
--- a/erpnext/templates/pages/home.html
+++ b/erpnext/templates/pages/home.html
@@ -27,7 +27,7 @@
</div>
</div>
<!-- TODO: remove hardcoding of /products -->
- <div class=" text-center text-uppercase"><a href="/products" class="btn btn-primary all-products"> {{ _("View All Products") }}</a></div>
+ <div class="text-center"><a href="/products" class="btn btn-primary all-products"> {{ _("View All Products") }}</a></div>
</div>
{% endif %}
</div>
@@ -46,7 +46,7 @@
.btn-login {
width: 80px;
}
-
-
+
+
</style>
{% endblock %}
diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py
index e7ff2ce..4440f7e 100644
--- a/erpnext/templates/pages/home.py
+++ b/erpnext/templates/pages/home.py
@@ -3,19 +3,27 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import cstr, nowdate
-from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
no_cache = 1
no_sitemap = 1
def get_context(context):
homepage = frappe.get_doc('Homepage')
-
+
for item in homepage.products:
- item.route = '/' + '/'.join(frappe.db.get_value('Item', item.item_code, ['parent_website_route', 'page_name']))
-
-
+ parent_website_route, page_name = frappe.db.get_value('Item', item.item_code,
+ ['parent_website_route', 'page_name'])
+ item.route = '/' + '/'.join(filter(None, [parent_website_route, page_name]))
+
+ # show atleast 3 products
+ if len(homepage.products) < 3:
+ for i in xrange(3 - len(homepage.products)):
+ homepage.append('products', {
+ 'item_code': 'product-{0}'.format(i),
+ 'item_name': frappe._('Product {0}').format(i),
+ 'route': '#'
+ })
+
return {
'homepage': homepage
}
\ No newline at end of file
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index 98f7431..61b4546 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -59,7 +59,7 @@
<div class="col-sm-2 col-xs-3 text-right">
{{ d.get_formatted("amount") }}
<p class="text-muted small">{{
- _("Rate: {0}").format(d.get_formatted("rate")) }}</p>
+ _("@ {0}").format(d.get_formatted("rate")) }}</p>
</div>
</div>
{% endfor %}