[fix] product search in new block header_actions

This commit is contained in:
Rushabh Mehta 2015-06-01 17:23:42 +05:30
parent a33d468d30
commit aded46d33e
6 changed files with 28 additions and 22 deletions

View File

@ -2,10 +2,13 @@
{% block header %}<h2>{{ title }}</h2>{% endblock %} {% block header %}<h2>{{ title }}</h2>{% endblock %}
{% block header_actions %}
{% include 'templates/includes/product_search_box.html' %}
{% endblock %}
{% block content %} {% block content %}
{% from "erpnext/templates/includes/macros.html" import product_image %} {% from "erpnext/templates/includes/macros.html" import product_image %}
<div class="item-content"> <div class="item-content">
{% include 'templates/includes/product_search_box.html' %}
<div class="product-page-content" itemscope itemtype="http://schema.org/Product"> <div class="product-page-content" itemscope itemtype="http://schema.org/Product">
<div class="row"> <div class="row">
<div class="col-sm-5"> <div class="col-sm-5">

View File

@ -1,6 +1,9 @@
{% block header_actions %}
{% include 'templates/includes/product_search_box.html' %}
{% endblock %}
{% block content %} {% block content %}
<div class="item-group-content"> <div class="item-group-content">
{% include 'templates/includes/product_search_box.html' %}
<div> <div>
{% if slideshow %}<!-- slideshow --> {% if slideshow %}<!-- slideshow -->
{% include "templates/includes/slideshow.html" %} {% include "templates/includes/slideshow.html" %}

View File

@ -1,6 +1,6 @@
{% from "erpnext/templates/includes/macros.html" import product_image_square %} {% from "erpnext/templates/includes/macros.html" import product_image_square %}
<a class="product-link" href="{{ (route or page_name)|with_leading_slash }}"> <a class="product-link" href="{{ (route or page_name)|abs_url }}">
<div class="col-sm-2 col-xs-4 product-image-wrapper"> <div class="col-sm-2 col-xs-4 product-image-wrapper">
{{ product_image_square(website_image) }} {{ product_image_square(website_image) }}
<div class="text-ellipsis inline-block small product-text">{{ item_name }}</div> <div class="text-ellipsis inline-block small product-text">{{ item_name }}</div>

View File

@ -1,15 +1,15 @@
<!-- TODO product listing --> <!-- TODO product listing -->
<div class="container content"> <div class="container content">
<div style="height: 120px; overflow: hidden;"> <div style="height: 120px; overflow: hidden;">
<a href="{{ (route or page_name)|with_leading_slash }}"> <a href="{{ (route or page_name)|abs_url }}">
{%- if website_image -%} {%- if website_image -%}
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image|with_leading_slash }}"> <img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image|abs_url }}">
{%- else -%} {%- else -%}
<div style="width: 80%; height: 120px; background-color: #F7FAFC;"></div> <div style="width: 80%; height: 120px; background-color: #F7FAFC;"></div>
{%- endif -%} {%- endif -%}
</a> </a>
</div> </div>
<div style="height: 100px; overflow: hidden; font-size: 80%;"> <div style="height: 100px; overflow: hidden; font-size: 80%;">
<div><a href="{{ (route or page_name)|with_leading_slash }}">{{ item_name }}</a></div> <div><a href="{{ (route or page_name)|abs_url }}">{{ item_name }}</a></div>
</div> </div>
</div> </div>

View File

@ -1,20 +1,17 @@
<div class="product-search pull-right">
<form class="form-inline form-search">
<div class="input-group">
<input class="form-control" type="text" id="product-search"
placeholder="Product Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="btn-product-search">
<i class="icon-search"></i></button>
</span>
</div>
</form>
</div>
<script> <script>
frappe.ready(function() { frappe.ready(function() {
$(".product-search").remove();
$('<div class="product-search pull-right">\
<form class="form-inline form-search">\
<div class="input-group">\
<input class="form-control" type="text" id="product-search" placeholder="Product Search...">\
<span class="input-group-btn">\
<button class="btn btn-default" type="button" id="btn-product-search">\
<i class="icon-search"></i></button>\
</span>\
</div>\
</form>\
</div>').prependTo(".page-header-block");
$('.dropdown-toggle').dropdown();
$("#btn-product-search").click(function() { $("#btn-product-search").click(function() {
var txt = $("#product-search").val(); var txt = $("#product-search").val();
if(txt) { if(txt) {

View File

@ -2,6 +2,10 @@
{% block header %}<h2>Product Search</h2>{% endblock %} {% block header %}<h2>Product Search</h2>{% endblock %}
{% block header_actions %}
{% include 'templates/includes/product_search_box.html' %}
{% endblock %}
{% block content %} {% block content %}
<script>{% include "templates/includes/product_list.js" %}</script> <script>{% include "templates/includes/product_list.js" %}</script>
@ -15,7 +19,6 @@ $(document).ready(function() {
}); });
</script> </script>
{% include "templates/includes/product_search_box.html" %}
<div class="product-search-content"> <div class="product-search-content">
<h3 class="search-results">Search Results</h3> <h3 class="search-results">Search Results</h3>
<div id="search-list" class="row"> <div id="search-list" class="row">