Permalink
Browse files

Merged 0.6 branch.

  • Loading branch information...
2 parents e75664a + 5d28582 commit d1f91fa95e20e56c46bd9e47481b10d18007d51c @diefenbach diefenbach committed Mar 8, 2012
View
@@ -60,3 +60,9 @@ b392197d44095112932a2d1f7c6b39e403141534 0.6.7
953c1e3503b2e924bc24d5ded3d363d6e1bf3d9d 0.6.8
baca3fb996542b6cf02c232b4e7bf1a576c7d6be 0.6.7
76afc2b1bec9a0f1649fce4f60dfbc79fe1707f3 0.7.0b1
+2cf4031298a241b1e4522b837fa3b09c001bd4a1 0.6.9
+2cf4031298a241b1e4522b837fa3b09c001bd4a1 0.6.9
+0000000000000000000000000000000000000000 0.6.9
+0000000000000000000000000000000000000000 0.6.9
+d6a3c0f3de9d1f09891af9b1c2e817f3cc17a3a8 0.6.9
+>>>>>>> other
View
@@ -146,6 +146,18 @@ HISTORY
* Using Python's locale to display currencies
* New contact form
+0.5.0 (2012-03-08)
+------------------
+
+* Security fix
+
+0.5.0 beta 8 (2011-06-25)
+-------------------------
+
+* Bugfix: pinned version of djangorecipe to 0.23.1
+* Enhancement: added active_name and active_price to variants management view; issue #51
+* Enhancement: cleaned up password reset templates
+
0.5.0 beta 7 (2011-04-13)
-------------------------
View
@@ -31,6 +31,17 @@ The latest development state can be found here:
Changes
=======
+0.7.0 beta 2
+------------
+
+* Security fix
+* Added manufacturer field to product management (Maciej Wiśniowski)
+* Bugfix: fixed pagination for product page; issue #152 (Maciej Wiśniowski)
+* Bugfix: fixed deleting of image for payment and shipping methods; issue #150
+* Bugfix: fixed markup; #issue #148
+* Bugfix: fixed updating of attachments; issue #147
+* Improved javascript: prevent FOUC for category-tabs and manage-tabs;
+
0.7.0 beta 1
------------
View
@@ -1313,6 +1313,14 @@ def get_sku(self):
else:
return self.sku
+ def get_manufacturer(self):
+ """Always return parent manufacturer for variants.
+ """
+ if self.is_variant():
+ return self.parent.manufacturer
+ else:
+ return self.manufacturer
+
def has_related_products(self):
"""Returns True if the product has related products.
"""
View
@@ -24,6 +24,7 @@
url(r'^edit-product-manufacturer/(?P<manufacturer_id>\d*)/(?P<product_id>\d*)$', "edit_product", name="lfs_manufacturer_edit_product"),
url(r'^category-state-manufacturer/(?P<manufacturer_id>\d*)/(?P<category_id>\d*)$', "category_state", name="lfs_manufacturer_category_state"),
url(r'^manufacturer-inline/(?P<manufacturer_id>\d*)/(?P<category_id>\d*)$', "manufacturer_inline", name="lfs_manufacturer_inline"),
+ url(r'^manufacturers-ajax/$', "manufacturers_ajax", name="lfs_manufacturers_ajax"),
)
# Marketing
@@ -11,6 +11,7 @@
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
+from django.views.decorators.cache import never_cache
# lfs imports
import lfs.core.utils
@@ -20,7 +21,6 @@
from lfs.catalog.models import Product
from lfs.core.utils import LazyEncoder
from lfs.manufacturer.models import Manufacturer
-from lfs.manufacturer.models import Manufacturer
class ManufacturerDataForm(ModelForm):
@@ -287,3 +287,20 @@ def _get_category_state(manufacturer, category):
klass = ""
return (checked, klass)
+
+
+@never_cache
+@permission_required("core.manage_shop", login_url="/login/")
+def manufacturers_ajax(request):
+ """ Returns list of manufacturers for autocomplete
+ """
+ term = request.GET.get('term', '')
+ manufacturers = Manufacturer.objects.filter(name__istartswith=term)[:10]
+
+ out = []
+ for man in manufacturers:
+ out.append({'label': man.name,
+ 'value': man.pk})
+
+ result = simplejson.dumps(out, cls=LazyEncoder)
+ return HttpResponse(result)
@@ -16,6 +16,8 @@
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
+from django.forms.widgets import HiddenInput
+from django.conf import settings
# lfs imports
import lfs.core.utils
@@ -34,6 +36,7 @@
from lfs.manage.views.product.attachments import manage_attachments
from lfs.manage.views.lfs_portlets import portlets_inline
from lfs.manage.utils import get_current_page
+from lfs.manufacturer.models import Manufacturer
from lfs.utils.widgets import SelectImage
@@ -68,10 +71,13 @@ def __init__(self, *args, **kwargs):
super(ProductDataForm, self).__init__(*args, **kwargs)
self.fields["template"].widget = SelectImage(choices=PRODUCT_TEMPLATES)
self.fields["active_base_price"].widget = CheckboxInput()
+ man_count = Manufacturer.objects.count()
+ if man_count > getattr(settings, 'LFS_SELECT_LIMIT', 20):
+ self.fields["manufacturer"].widget = HiddenInput()
class Meta:
model = Product
- fields = ("active", "name", "slug", "sku", "sku_manufacturer", "price", "tax", "price_calculator",
+ fields = ("active", "name", "slug", "manufacturer", "sku", "sku_manufacturer", "price", "tax", "price_calculator",
"short_description", "description", "for_sale", "for_sale_price", "static_block", "template",
"active_price_calculation", "price_calculation", "price_unit", "unit", "type_of_quantity_field",
"active_base_price", "base_price_unit", "base_price_amount")
@@ -98,7 +104,7 @@ class VariantDataForm(forms.ModelForm):
"""
class Meta:
model = Product
- fields = ("active", "active_name", "name", "slug", "active_sku", "sku", "sku_manufacturer",
+ fields = ("active", "active_name", "name", "slug", "manufacturer", "active_sku", "sku", "sku_manufacturer",
"active_price", "price", "price_calculator", "active_short_description", "short_description", "active_description",
"description", "for_sale", "for_sale_price", "active_for_sale", "active_for_sale_price",
"active_related_products", "active_static_block", "static_block", "template",
@@ -157,13 +163,11 @@ def manage_product(request, product_id, template_name="manage/product/product.ht
"""
Displays the whole manage/edit form for the product with the passed id.
"""
- AMOUNT = 20
product = lfs_get_object_or_404(Product, pk=product_id)
products = _get_filtered_products_for_product_view(request)
- paginator = Paginator(products, AMOUNT)
-
+ paginator = Paginator(products, 25)
temp = product.parent if product.is_variant() else product
- page = get_current_page(request, products, temp, AMOUNT)
+ page = get_current_page(request, products, temp, 25)
try:
page = paginator.page(page)
@@ -401,7 +405,7 @@ def edit_product_data(request, product_id, template_name="manage/product/data.ht
"""
product = lfs_get_object_or_404(Product, pk=product_id)
products = _get_filtered_products_for_product_view(request)
- paginator = Paginator(products, 20)
+ paginator = Paginator(products, 25)
page = paginator.page(request.REQUEST.get("page", 1))
# Transform empty field / "on" from checkbox to integer
@@ -471,7 +475,7 @@ def reset_filters(request):
del request.session["product_filters"]
products = _get_filtered_products(request)
- paginator = Paginator(products, 20)
+ paginator = Paginator(products, 25)
page = paginator.page(request.REQUEST.get("page", 1))
product_id = request.REQUEST.get("product-id", 0)
@@ -495,7 +499,7 @@ def save_products(request):
Saves products with passed ids (by request body).
"""
products = _get_filtered_products(request)
- paginator = Paginator(products, 20)
+ paginator = Paginator(products, 25)
page = paginator.page(request.REQUEST.get("page", 1))
if request.POST.get("action") == "delete":
@@ -579,7 +583,7 @@ def set_name_filter(request):
request.session["product_filters"] = product_filters
products = _get_filtered_products_for_product_view(request)
- paginator = Paginator(products, 20)
+ paginator = Paginator(products, 25)
page = paginator.page(request.REQUEST.get("page", 1))
product_id = request.REQUEST.get("product-id", 0)
@@ -550,7 +550,8 @@ select.categories {
/* input fields */
#id_name, #id_slug, #id_sku, #id_shop_owner, #id_from_email, #id_title, #id_redirect_to, #id_sku_manufacturer, #redirect_to, #id_position, #id_unit,
#id_priority, #id_price, #id_for_sale_price, #id_tax, #id_module, #id_link, #id_parent, #id_static_block, #id_price_unit, #id_template, #id_meta_title,
-#id_type, #id_step_type, #id_delivery_time, #id_type_of_quantity_field, #id_price_calculator, #id_base_price_unit, #id_base_price_amount, #id_active_base_price {
+#id_type, #id_step_type, #id_delivery_time, #id_type_of_quantity_field, #id_price_calculator, #id_base_price_unit, #id_base_price_amount, #id_active_base_price,
+#id_manufacturer_autocomplete, #id_manufacturer {
width: 200px;
}
View
@@ -145,8 +145,16 @@ $(function() {
// ReferenceError due to undefined tinymce
}
show_ajax_loading();
+
+ // trigger form-save-start event when form is about to be submitted
+ var form = $(this).closest("form");
+ var form_id = form.get(0).id;
+ var event = jQuery.Event("form-save-start");
+ event.form_id = form_id;
+ $('body').trigger(event);
+
var action = $(this).attr("name")
- $(this).parents("form:first").ajaxSubmit({
+ form.ajaxSubmit({
data : {"action" : action},
success : function(data) {
data = $.parseJSON(data);
@@ -162,6 +170,11 @@ $(function() {
}
hide_ajax_loading();
update_editor();
+
+ // trigger form-save-end event when new HTML has already been injected into page
+ var event = jQuery.Event("form-save-end");
+ event.form_id = form_id;
+ $('body').trigger(event);
}
})
return false;
@@ -288,66 +301,64 @@ $(function() {
knot.parent().find(".category-state").html("");
};
- $(function() {
- $(".category-ajax-link").live("click", function() {
- var url = $(this).attr("href");
+ $(".category-ajax-link").live("click", function() {
+ var url = $(this).attr("href");
- // Loads children of clicked category.
- if ($(this).hasClass("collapsed")) {
- $.post(url, function(data) {
- data = $.parseJSON(data);
- for (var html in data["html"])
- $(data["html"][html][0]).html(data["html"][html][1]);
- })
- $(this).removeClass("collapsed");
- $(this).addClass("expanded");
- }
- // Removes children of clicked category.
- else {
- $(this).siblings("div").html("")
- $(this).removeClass("expanded");
- $(this).addClass("collapsed");
- }
- return false;
- });
+ // Loads children of clicked category.
+ if ($(this).hasClass("collapsed")) {
+ $.post(url, function(data) {
+ data = $.parseJSON(data);
+ for (var html in data["html"])
+ $(data["html"][html][0]).html(data["html"][html][1]);
+ })
+ $(this).removeClass("collapsed");
+ $(this).addClass("expanded");
+ }
+ // Removes children of clicked category.
+ else {
+ $(this).siblings("div").html("")
+ $(this).removeClass("expanded");
+ $(this).addClass("collapsed");
+ }
+ return false;
+ });
- $(".export-category-input").live("click", function() {
+ $(".export-category-input").live("click", function() {
- // select / deselect all child nodes
- var input = $(this);
- var parent_checked = this.checked;
- $(this).parent().find("input").each(function() { this.checked = parent_checked; })
+ // select / deselect all child nodes
+ var input = $(this);
+ var parent_checked = this.checked;
+ $(this).parent().find("input").each(function() { this.checked = parent_checked; })
- // Updates child and parent categories of clicked category
- var url = $(this).attr("data");
- if (parent_checked == true) {
- $.post(url, {"action" : "add"}, function(data) {
- update_sub_categories(input);
- update_parent_categories(input);
- });
- }
- else {
- $.post(url, {"action" : "remove"}, function(data) {
- update_sub_categories(input);
- update_parent_categories(input);
- });
- }
- });
+ // Updates child and parent categories of clicked category
+ var url = $(this).attr("data");
+ if (parent_checked == true) {
+ $.post(url, {"action" : "add"}, function(data) {
+ update_sub_categories(input);
+ update_parent_categories(input);
+ });
+ }
+ else {
+ $.post(url, {"action" : "remove"}, function(data) {
+ update_sub_categories(input);
+ update_parent_categories(input);
+ });
+ }
+ });
- $(".export-product-input").live("click", function() {
- // Add / Remove product
- var input = $(this);
- var url = $(this).attr("data");
- var checked = this.checked;
+ $(".export-product-input").live("click", function() {
+ // Add / Remove product
+ var input = $(this);
+ var url = $(this).attr("data");
+ var checked = this.checked;
- // Updates parent catgories of clicked product
- if (checked == true) {
- $.post(url, {"action" : "add"}, function(data) { update_parent_categories(input) } );
- }
- else {
- $.post(url, {"action" : "remove"}, function(data) { update_parent_categories(input) });
- }
- });
+ // Updates parent catgories of clicked product
+ if (checked == true) {
+ $.post(url, {"action" : "add"}, function(data) { update_parent_categories(input) } );
+ }
+ else {
+ $.post(url, {"action" : "remove"}, function(data) { update_parent_categories(input) });
+ }
});
$(".category-variants-options").live("change", function() {
Oops, something went wrong.

0 comments on commit d1f91fa

Please sign in to comment.