Skip to content

Commit

Permalink
re-building assets
Browse files Browse the repository at this point in the history
  • Loading branch information
lucknerjb committed Mar 25, 2015
1 parent 2799ad7 commit 145c00c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bootstrap-tagsinput.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-tagsinput",
"version": "0.5.1",
"version": "0.5.0",
"title": "Bootstrap Tags Input",
"author": {
"name": "Tim Schlechter"
Expand All @@ -24,4 +24,4 @@
],
"download": "http://timschlechter.github.io/bootstrap-tagsinput/build/bootstrap-tagsinput.zip",
"homepage": "http://timschlechter.github.io/bootstrap-tagsinput/examples/"
}
}
18 changes: 14 additions & 4 deletions dist/bootstrap-tagsinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,21 @@

// typeahead.js
if (self.options.typeaheadjs) {
var typeaheadjs = self.options.typeaheadjs || {};
var typeaheadConfig = null;
var typeaheadDatasets = {};

// Determine if main configurations were passed or simply a dataset
var typeaheadjs = self.options.typeaheadjs;
if ($.isArray(typeaheadjs)) {
typeaheadConfig = typeaheadjs[0];
typeaheadDatasets = typeaheadjs[1];
} else {
typeaheadDatasets = typeaheadjs;
}

self.$input.typeahead(null, typeaheadjs).on('typeahead:selected', $.proxy(function (obj, datum) {
if (typeaheadjs.valueKey)
self.add(datum[typeaheadjs.valueKey]);
self.$input.typeahead(typeaheadConfig, typeaheadDatasets).on('typeahead:selected', $.proxy(function (obj, datum) {
if (typeaheadDatasets.valueKey)
self.add(datum[typeaheadDatasets.valueKey]);
else
self.add(datum);
self.$input.typeahead('val', '');
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-tagsinput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/bootstrap-tagsinput.zip
Binary file not shown.
24 changes: 18 additions & 6 deletions examples/assets/app_bs3.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,23 @@ elt.tagsinput({
},
itemValue: 'value',
itemText: 'text',
typeaheadjs: {
name: 'cities',
displayKey: 'text',
source: cities.ttAdapter()
}
// typeaheadjs: {
// name: 'cities',
// displayKey: 'text',
// source: cities.ttAdapter()
// }
typeaheadjs: [
{
hint: true,
highlight: true,
minLength: 2
},
{
name: 'cities',
displayKey: 'text',
source: cities.ttAdapter()
}
]
});
elt.tagsinput('add', { "value": 1 , "text": "Amsterdam" , "continent": "Europe" });
elt.tagsinput('add', { "value": 4 , "text": "Washington" , "continent": "America" });
Expand All @@ -80,4 +92,4 @@ elt.tagsinput('add', { "value": 10, "text": "Beijing" , "continent": "Asia"
elt.tagsinput('add', { "value": 13, "text": "Cairo" , "continent": "Africa" });

// HACK: overrule hardcoded display inline-block of typeahead.js
$(".twitter-typeahead").css('display', 'inline');
$(".twitter-typeahead").css('display', 'inline');
Loading

0 comments on commit 145c00c

Please sign in to comment.