Website Product Image

This commit is contained in:
Anand Doshi
2015-02-24 17:50:44 +05:30
parent 93b3a37a3b
commit da858cc587
15 changed files with 313 additions and 140 deletions

View File

@@ -105,8 +105,7 @@ $.extend(shopping_cart, {
render_item_row: function($cart_items, doc) {
doc.image_html = doc.website_image ?
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.website_image + '" /></div>' :
'{% include "templates/includes/product_missing_image.html" %}';
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.website_image + '" /></div>': "";
if(doc.description === doc.item_name) doc.description = "";
@@ -265,7 +264,7 @@ $.extend(shopping_cart, {
.html(msg || frappe._("Something went wrong!"))
.toggle(true);
} else {
window.location.href = "order?name=" + encodeURIComponent(r.message);
window.location.href = "/orders/" + encodeURIComponent(r.message);
}
}
});

View File

@@ -0,0 +1,17 @@
{% macro product_image_square(website_image, css_class="") %}
<div class="product-image product-image-square {% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
{% if website_image -%} style="background-image: url({{ website_image }});" {%- endif %}>
{% if not website_image -%}<i class="centered octicon octicon-device-camera"></i>{%- endif %}
</div>
{% endmacro %}
{% macro product_image(website_image, css_class="") %}
<div class="product-image {% if not website_image -%} missing-image {%- endif %} {{ css_class }}">
{% if website_image -%}
<img src="{{ website_image }}" class="img-responsive">
{%- else -%}
<i class="centered octicon octicon-device-camera"></i>
{%- endif %}
</div>
{% endmacro %}

View File

@@ -1,8 +1,8 @@
{% from "erpnext/templates/includes/macros.html" import product_image_square %}
<a class="product-link" href="{{ route or page_name }}">
<div class="col-sm-2 product-image-wrapper">
<div class="product-image {% if not website_image -%}missing-image{%- endif %}"
{% if website_image -%} style="background-image: url({{ website_image }});" {%- endif %}>
</div>
<div class="col-sm-2 col-xs-4 product-image-wrapper">
{{ product_image_square(website_image) }}
<div class="product-text small">{{ item_name }}</div>
</div>
</a>

View File

@@ -1 +0,0 @@
<div class="missing-image"><i class="icon-camera"></i></div>