Fixed mass_tagger bug when selecting images with similar ids

The mass_tagger extension behaves incorrectly if the id of an image is
the same as the ending of the id of another image.

Example:
Select image 143: var string == "143:"
Select image 113: var string == "143:113:"
Select image 43: var string == "1113:"
So either the wrong image will be tagged, or it will cause an error if
that image doesn't exist.
This commit is contained in:
Geosohh 2014-07-29 18:02:50 -03:00
parent 196e4d5300
commit 3d2c55a9d5

View file

@ -23,7 +23,7 @@ function toggle_tag( button, id ) {
var list = $('#mass_tagger_ids'); var list = $('#mass_tagger_ids');
var string = list.val(); var string = list.val();
if( string.indexOf( id ) > -1 ) { if( (string.indexOf(id) == 0) || (string.indexOf(":"+id) > -1) ) {
$(button).css('border', 'none'); $(button).css('border', 'none');
string = string.replace(id, ''); string = string.replace(id, '');
list.val(string); list.val(string);