Website Product Image
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index 8db39a3..b6e1203 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -3,25 +3,19 @@
{% block header %}<h2>{{ title }}</h2>{% endblock %}
{% block content %}
+{% from "erpnext/templates/includes/macros.html" import product_image %}
<div class="item-content">
{% include 'templates/includes/product_search_box.html' %}
<div class="product-page-content" itemscope itemtype="http://schema.org/Product">
<div class="row">
- <div class="col-md-6">
+ <div class="col-sm-5">
{% if slideshow %}
{% include "templates/includes/slideshow.html" %}
{% else %}
- {% if website_image %}
- <image itemprop="image" class="item-main-image"
- src="{{ website_image }}" />
- {% else %}
- <div class="img-area">
- {% include 'templates/includes/product_missing_image.html' %}
- </div>
- {% endif %}
+ {{ product_image(website_image, "product-full-image") }}
{% endif %}
</div>
- <div class="col-md-6">
+ <div class="col-sm-7">
<!-- <h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3> -->
<div itemprop="description">
{{ web_long_description or description or _("No description given") }}
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index 6cc4212..348d330 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -39,33 +39,12 @@
{% block style %}
<style>
- .product-link {
- display: block;
- text-align: center;
- }
-
- .product-image-wrapper {
- max-width: 300px;
- margin: auto;
- }
-
- .product-image {
- width: 100%;
- height: 0;
- padding-bottom: 100%;
- border-radius: 4px;
- border: 1px solid transparent;
- background-size: cover;
- background-repeat: no-repeat;
- }
-
.product-image.missing-image {
- border: 1px dashed {{ border_color or "#d1d8dd" }};
+ border: 1px dashed {{ theme.border_color or "#d1d8dd" }};
}
- .product-text {
- padding: 15px 0px;
+ .product-image.missing-image .octicon {
+ color: {{ theme.border_color or "#d1d8dd" }};
}
-
</style>
{% endblock %}
diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js
index c0b2f46..2495182 100644
--- a/erpnext/templates/includes/cart.js
+++ b/erpnext/templates/includes/cart.js
@@ -105,8 +105,7 @@
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 @@
.html(msg || frappe._("Something went wrong!"))
.toggle(true);
} else {
- window.location.href = "order?name=" + encodeURIComponent(r.message);
+ window.location.href = "/orders/" + encodeURIComponent(r.message);
}
}
});
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
new file mode 100644
index 0000000..aa44a17
--- /dev/null
+++ b/erpnext/templates/includes/macros.html
@@ -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 %}
+
diff --git a/erpnext/templates/includes/product_in_grid.html b/erpnext/templates/includes/product_in_grid.html
index 27cc321..b670a7f 100644
--- a/erpnext/templates/includes/product_in_grid.html
+++ b/erpnext/templates/includes/product_in_grid.html
@@ -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>
diff --git a/erpnext/templates/includes/product_missing_image.html b/erpnext/templates/includes/product_missing_image.html
deleted file mode 100644
index 81b8935..0000000
--- a/erpnext/templates/includes/product_missing_image.html
+++ /dev/null
@@ -1 +0,0 @@
-<div class="missing-image"><i class="icon-camera"></i></div>
\ No newline at end of file