Permalink
Browse files

Recounting gallery items modified. Refs #6164

  • Loading branch information...
1 parent 409f23c commit 3abe9430c095deb69523c0f7ddfb3c1047e4f7e2 Jonas Fiala committed Jun 30, 2010
Showing with 7 additions and 4 deletions.
  1. +5 −3 ella/newman/media/js/inlines.js
  2. +2 −1 tests/example_project/tests/test_newman/test_galleries.py
@@ -521,16 +521,18 @@ var __GalleryFormHandler = function () {
log_inline.log('GalleryItems won\'t be recounted.(reason: already recounted)');
return;
}
- $form.find('.gallery-item .item-order').each( function() {
+ $form.find('.gallery-item .item-order').each( function(index, element) {
if (!this.value) return;
var value = parseInt(this.value);
var multiplier = 1;
if (value >= 1 && value <= 99) {
multiplier = NEWMAN_GALLERY_ITEM_ORDER_DEGREE_MULTIPLIER;
} else if (value >= NEWMAN_GALLERY_ITEM_ORDER_DEGREE_MULTIPLIER && value <= (99 * NEWMAN_GALLERY_ITEM_ORDER_DEGREE_MULTIPLIER)) {
- multiplier = 1.0 / NEWMAN_GALLERY_ITEM_ORDER_DEGREE_MULTIPLIER;
+ //multiplier = 1.0 / NEWMAN_GALLERY_ITEM_ORDER_DEGREE_MULTIPLIER;
+ multiplier = 1;
}
- var res = Math.floor(Number(value) * multiplier);// force res to be a whole number
+ //var res = Math.floor(Number(value) * multiplier);// force res to be a whole number
+ var res = Math.floor(Number(index + 1) * multiplier);// force res to be a whole number
log_inline.log('Recounting ' , value , ' to ' , res , ' for element ' , this);
this.value = res.toString();
me.gallery_ordering_modified = true;
@@ -50,6 +50,7 @@ def test_recycle_gallery(self):
data = {
'title' : u'From preset 马 žš experiment',
+ 'slug': u'from-preset-zs-experiment'
}
self.fill_fields(data)
# verify all fields
@@ -59,7 +60,7 @@ def test_recycle_gallery(self):
'title' : u'From preset 马 žš experiment',
'description' : u'Gallery description',
'content' : u'šialený obsah galörie',
- 'slug' : u'experiment',
+ 'slug': u'from-preset-zs-experiment',
'galleryitem_set-0-target_id': '1',
'galleryitem_set-1-target_id': '2',
'galleryitem_set-2-target_id': '3',

0 comments on commit 3abe943

Please sign in to comment.