Skip to content

Commit

Permalink
#542: + _prepareGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
RubaXa committed Sep 3, 2015
1 parent ca3c2a3 commit d87cf00
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,23 @@
}
}
}
}, 30)
}, 30),

_prepareGroup = function (options) {
var group = options.group;

if (!group || typeof group != 'object') {
group = options.group = {name: group};
}

['pull', 'put'].forEach(function (key) {
if (!(key in group)) {
group[key] = true;
}
});

options.groups = ' ' + group.name + (group.put.join ? ' ' + group.put.join(' ') : '') + ' ';
}
;


Expand Down Expand Up @@ -197,22 +213,7 @@
!(name in options) && (options[name] = defaults[name]);
}

var group = options.group;

if (!group || typeof group != 'object') {
group = options.group = { name: group };
}


['pull', 'put'].forEach(function (key) {
if (!(key in group)) {
group[key] = true;
}
});


options.groups = ' ' + group.name + (group.put.join ? ' ' + group.put.join(' ') : '') + ' ';

_prepareGroup(options);

// Bind all private methods
for (var fn in this) {
Expand Down Expand Up @@ -906,6 +907,10 @@
return options[name];
} else {
options[name] = value;

if (name === 'group') {
_prepareGroup(options);
}
}
},

Expand Down

0 comments on commit d87cf00

Please sign in to comment.