[website] [minor] moving to framework

This commit is contained in:
Rushabh Mehta
2013-09-09 12:17:45 +05:30
parent 46089dbc97
commit c59c4e0699
40 changed files with 49 additions and 61 deletions

View File

@@ -228,7 +228,7 @@ class DocType(DocListController):
def update_website(self):
def _invalidate_cache():
from website.helpers.product import invalidate_cache_for
from selling.utils.product import invalidate_cache_for
invalidate_cache_for(self.doc.item_group)
@@ -259,7 +259,7 @@ class DocType(DocListController):
return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
def prepare_template_args(self):
from website.helpers.product import get_parent_item_groups
from selling.utils.product import get_parent_item_groups
self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
self.doc.title = self.doc.item_name

View File

@@ -0,0 +1,12 @@
{% if obj.parent_groups and len(obj.parent_groups) > 1 %}
<div class="col-md-12">
<div class="clearfix">
<ul class="breadcrumb">
{% for ig in obj.parent_groups[:-1] %}
<li><a href="{{ ig.page_name }}.html">{{ ig.name }}</a></li>
{% endfor %}
<li class="active">{{ obj.parent_groups[-1].name }}</li>
</ul>
</div>
</div>
{% endif %}

View File

@@ -0,0 +1,14 @@
<div class="col-md-3">
<div style="height: 120px; overflow: hidden;">
<a href="{{ page_name }}">
{%- if website_image -%}
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
{%- else -%}
{% include 'app/website/templates/html/product_missing_image.html' %}
{%- endif -%}
</a>
</div>
<div style="height: 100px; overflow: hidden; font-size: 80%;">
<h4 style="margin-bottom: 2px;"><a href="{{ page_name }}">{{ item_name }}</a></h4>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<!-- TODO product listing -->
<div class="col-md-12">
<div style="height: 120px; overflow: hidden;">
<a href="{{ page_name }}">
{%- if website_image -%}
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
{%- else -%}
{% include 'app/website/templates/html/product_missing_image.html' %}
{%- endif -%}
</a>
</div>
<div style="height: 100px; overflow: hidden; font-size: 80%;">
<h4 style="margin-bottom: 2px;"><a href="{{ page_name }}">{{ item_name }}</a></h4>
</div>
</div>

View File

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

View File

@@ -0,0 +1,29 @@
<div class="col-md-12 clearfix">
<div class="pull-right" style="margin-top: 15px; margin-bottom: 15px;">
<form class="form-search">
<div class="input-group col-md-4 col-md-offset-8">
<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>
// redirect to product search page
$(document).ready(function() {
$('.dropdown-toggle').dropdown()
$("#btn-product-search").click(function() {
var txt = $("#product-search").val();
if(txt) {
window.location.href="product_search.html?q=" + txt;
}
return false;
});
$("#product-search").keypress(function(e) {
if(e.which==13) $("#product-search-btn").click();
})
})
</script>
</div>

View File

@@ -0,0 +1,42 @@
{% extends "app/website/templates/html/page.html" %}
{% block content %}
{% include 'app/website/templates/html/product_search_box.html' %}
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
<div class="col-md-12">
{% if slideshow %}<!-- slideshow -->
{% include "app/website/templates/html/slideshow.html" %}
{% endif %}
{% if description %}<!-- description -->
<div>{{ description or ""}}</div>
{% else %}
<h3>{{ name }}</h3>
{% endif %}
</div>
<div class="col-md-12">
{% if sub_groups %}
<hr />
<div class="row">
{% for d in sub_groups %}
<div class="col-md-4">
<a href="{{ d.page_name }}">{{ d.name }} ({{ d.count }})</a>
</div>
{% endfor %}
</div>
<hr />
{% endif %}
{% if items %}
<div id="search-list" class="row">
{% for item in items %}
{{ item }}
{% endfor %}
</div>
{% if len(items)==100 %}
<div class="alert info">Showing top 100 items.</div>
{% endif %}
{% else %}
<div class="alert">No items listed.</div>
{% endif %}
</div>
{% endblock %}

View File

@@ -0,0 +1,74 @@
{% extends "app/website/templates/html/page.html" %}
{% block javascript %}
{% include "app/website/templates/js/product_page.js" %}
{% endblock %}
{% block css %}
{% include "app/website/templates/css/product_page.css" %}
{% endblock %}
{% block content %}
{% include 'app/website/templates/html/product_search_box.html' %}
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
<div class="col-md-12 product-page-content" itemscope itemtype="http://schema.org/Product">
<div class="row">
<div class="col-md-6">
{% if slideshow %}
{% include "app/website/templates/html/slideshow.html" %}
{% else %}
{% if website_image %}
<image itemprop="image" class="item-main-image"
src="{{ website_image }}" />
{% else %}
<div class="img-area">
{% include 'app/website/templates/html/product_missing_image.html' %}
</div>
{% endif %}
{% endif %}
</div>
<div class="col-md-6">
<h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3>
<p class="help">Item Code: <span itemprop="productID">{{ name }}</span></p>
<h4>Product Description</h4>
<div itemprop="description">
{{ web_long_description or description or "[No description given]" }}
</div>
<div style="min-height: 100px; margin: 10px 0;">
<div class="item-price-info" style="display: none;">
<h4 class="item-price" itemprop="price"></h4>
<div class="item-stock" itemprop="availablity"></div>
<div id="item-add-to-cart">
<button class="btn btn-primary">
<i class="icon-shopping-cart"></i> Add to Cart</button>
</div>
<div id="item-update-cart" class="input-group col-md-4" style="display: none;
padding-left: 0px; padding-right: 0px;">
<input class="form-control" type="text">
<div class="input-group-btn">
<button class="btn btn-primary">
<i class="icon-ok"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%}
<div class="row" style="margin-top: 20px">
<div class="col-md-12">
<h4>Specifications</h4>
<table class="table table-bordered" style="width: 100%">
{% for d in obj.doclist.get(
{"doctype":"Item Website Specification"}) -%}
<tr>
<td style="width: 30%;">{{ d.label }}</td>
<td>{{ d.description }}</td>
</tr>
{%- endfor %}
</table>
</div>
</div>
{%- endif %}
</div>
{% endblock %}

View File

@@ -0,0 +1,33 @@
{% extends "app/website/templates/html/page.html" %}
{% set title="Product Search" %}
{% block javascript %}
{% include "app/website/templates/js/product_list.js" %}
{% endblock %}
{% block content %}
<script>
$(document).ready(function() {
var txt = get_url_arg("q");
$(".search-results").html("Search results for: " + txt);
window.search = txt;
window.start = 0;
window.get_product_list();
});
</script>
{% include 'app/website/templates/html/product_search_box.html' %}
<div class="col-md-12">
<h3 class="search-results">Search Results</h3>
<div id="search-list" class="row">
</div>
<div style="text-align: center;">
<div class="more-btn"
style="display: none; text-align: center;">
<button class="btn">More...</button>
</div>
</div>
</div>
{% endblock %}