remotes/origin/artem
Gena 11 years ago
parent d8a3517c4b
commit 1dc43ec164
  1. 2
      batiskaf/jinja2_ext/thumbnails.py
  2. 1
      batiskaf/settings.py
  3. 136
      static/js/_.js
  4. 8
      store/admin.py

@ -3,5 +3,5 @@ from easy_thumbnails.files import get_thumbnailer
def thumbnail(img, size='420x420'):
weight, height = size.split('x')
options = {'size': (int(weight), int(height)), 'crop': 'upscale'}
options = {'size': (int(weight), int(height))}
return get_thumbnailer(img).get_thumbnail(options)

@ -17,7 +17,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
ADMINS = (
('spacenergy', 'spacenergy@me.com'),
)
MANAGERS = ADMINS

@ -66,89 +66,89 @@ $(document).ready(function () {
});
$('.product-min-thumbnails a').each(function(){
var link = $(this);
link.on('click', function(){
$('.product-big-thumbnail img').prop('src', link.prop('href'));
$('.product-big-thumbnail-container').trigger('zoom.destroy');
$('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")});
$('.product-min-thumbnails a').each(function(){
var link = $(this);
link.on('click', function(){
$('.product-big-thumbnail img').prop('src', link.prop('href'));
$('.product-big-thumbnail-container').trigger('zoom.destroy');
$('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")});
//$('a#product-big-image-url').prop('href', link.attr('data-big-url'))
return false;
})
});
$('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")});
function create_cart_add_link(product_pk, count){
return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname);
}
function selectVariation(value, index){
var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price');
var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count');
$('.product-detail-price-span').html(price);
if (in_stock > 0){
$(".product-count-selecter").selecter('destroy');
$('.product-in-stock').show();
$('.product-not-in-stock').hide();
$('.product-count-selecter').html('');
for (i=0; i<in_stock; i++){
var option = $('<option/>');
option.attr({ 'value': i+1 }).text((i+1) + ' шт.');
$('.product-count-selecter').append(option);
}
$(".product-count-selecter").selecter({
callback: selectCount
});
selectCount(1, index);
$('#product-add-to-cart-link').prop('href',
create_cart_add_link($('.product-variations-selecter').val(),
$('.product-count-selecter').val()));
}else{
$('.product-count-selecter').selecter('destroy');
$('.product-in-stock').hide();
$('.product-not-in-stock').show();
});
$('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")});
function create_cart_add_link(product_pk, count){
return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname);
}
function selectVariation(value, index){
var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price');
var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count');
$('.product-detail-price-span').html(price);
if (in_stock > 0){
$(".product-count-selecter").selecter('destroy');
$('.product-in-stock').show();
$('.product-not-in-stock').hide();
$('.product-count-selecter').html('');
for (i=0; i<in_stock; i++){
var option = $('<option/>');
option.attr({ 'value': i+1 }).text((i+1) + ' шт.');
$('.product-count-selecter').append(option);
}
$(".product-count-selecter").selecter({
callback: selectCount
});
selectCount(1, index);
$('#product-add-to-cart-link').prop('href',
create_cart_add_link($('.product-variations-selecter').val(),
$('.product-count-selecter').val()));
}else{
$('.product-count-selecter').selecter('destroy');
$('.product-in-stock').hide();
$('.product-not-in-stock').show();
}
$(".product-variations-selecter").selecter({
callback: selectVariation
});
}
function selectCount(value, index){
var price = parseInt($('.product-detail-price-span').html());
$('.itogo-span').html(price*value);
$('#product-add-to-cart-link').prop('href',
create_cart_add_link($('.product-variations-selecter').val(),
$('.product-count-selecter').val()));
}
$(".product-variations-selecter").selecter({
callback: selectVariation
});
$(".product-count-selecter").selecter({
callback: selectCount
});
function selectCount(value, index){
var price = parseInt($('.product-detail-price-span').html());
$('.itogo-span').html(price*value);
$('#product-add-to-cart-link').prop('href',
create_cart_add_link($('.product-variations-selecter').val(),
$('.product-count-selecter').val()));
}
$(".product-count-selecter").selecter({
callback: selectCount
});
if ($('.product-count-selecter option').size() < 1){
$('.product-in-stock').hide();
$('.product-not-in-stock').show();
}else{
$(".product-count-selecter").selecter();
}
if ($('.product-count-selecter option').size() < 1){
$('.product-in-stock').hide();
$('.product-not-in-stock').show();
$('ul.messages li').each(function(){
var li = $(this);
var messageType = li.attr('data-type');
swal({
html: true,
type: messageType,
title: "OK!",
text: li.html()
}else{
$(".product-count-selecter").selecter();
}
$('ul.messages li').each(function(){
var li = $(this);
var messageType = li.attr('data-type');
swal({
html: true,
type: messageType,
title: "OK!",
text: li.html()
});
});
});

@ -24,7 +24,13 @@ class BrandAdmin(admin.ModelAdmin):
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = ('title',)
def get_str(object):
return object.__str__()
get_str.short_description = 'Полный путь'
list_display = ('title', get_str,)
prepopulated_fields = {"slug": ("title",)}
inlines = [AttributeForCategoryInline, ]

Loading…
Cancel
Save