Skip to content

Commit

Permalink
add allowDuplicates option
Browse files Browse the repository at this point in the history
  • Loading branch information
aehlke committed Nov 23, 2012
1 parent 3eadb11 commit 31728d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
7 changes: 7 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ whether the duplication check should do a case sensitive check or not.

Defaults to *true*.

### allowDuplicates (boolean)

Allows duplicate tags to be created.
One implication of this is that `removeTagByName` will remove all tags which match the given name.

Defaults to *false*.

### allowSpaces (boolean)

When allowSpaces is enabled the user is not required to wrap multi-word tags in quotation marks.
Expand Down
5 changes: 3 additions & 2 deletions js/tag-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
removeConfirmation: false,
caseSensitive : true,
placeholderText : null,
allowDuplicates : false,

// When enabled, quotes are not neccesary
// for inputting multi-word tags.
Expand Down Expand Up @@ -317,7 +318,7 @@

value = $.trim(value);

if (!this._isNew(value) || value === '') {
if (!allowDuplicates && (!this._isNew(value) || value === '')) {
return false;
}

Expand Down Expand Up @@ -359,7 +360,7 @@
// insert tag
this._tagInput.parent().before(tag);
},

removeTag: function(tag, animate) {
animate = typeof animate === "undefined" ? this.options.animate : animate;

Expand Down
23 changes: 12 additions & 11 deletions js/tag-it.min.js

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

0 comments on commit 31728d3

Please sign in to comment.