This commit is contained in:
Marcin Kurczewski 2013-10-21 14:48:28 +02:00
parent 6b55706fb4
commit 0f72ef3963
3 changed files with 28 additions and 12 deletions

View file

@ -179,3 +179,25 @@ $(function()
}
});
});
function getTagItOptions()
{
return {
caseSensitive: false,
autocomplete:
{
source:
function(request, response)
{
var term = request.term.toLowerCase();
var results = $.grep(this.options.availableTags, function(a)
{
return a.toLowerCase().indexOf(term) != -1;
});
if (!this.options.allowDuplicates)
results = this._subtractArray(results, this.assignedTags());
response(results);
},
}
};
}

View file

@ -14,12 +14,9 @@ $(function()
{
tags = data['tags'];
var tagItOptions =
{
caseSensitive: true,
availableTags: tags,
placeholderText: $('.tags input').attr('placeholder')
};
var tagItOptions = getTagItOptions();
tagItOptions.availableTags = tags;
tagItOptions.placeholderText = $('.tags input').attr('placeholder');
$('.tags input').tagit(tagItOptions);
e.preventDefault();

View file

@ -158,12 +158,9 @@ $(function()
$('.posts').append(postDom);
postDom.show();
var tagItOptions =
{
caseSensitive: true,
availableTags: tags,
placeholderText: $('.tags input').attr('placeholder')
};
var tagItOptions = getTagItOptions();
tagItOptions.availableTags = tags;
tagItOptions.placeholderText = $('.tags input').attr('placeholder');
$('.tags input', postDom).tagit(tagItOptions);
if (!file.type.match('image.*'))