Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit a75ece4

Browse files
committed
Merge pull request #32 from jdfreder/bootstrap-tags
Added bootstrap-tags 1.1
2 parents 4580993 + 80bb372 commit a75ece4

File tree

9 files changed

+959
-0
lines changed

9 files changed

+959
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ term.js/example/
6666
term.js/index.js
6767
term.js/lib/
6868
term.js/.npmignore
69+
70+
# Bootstrap-tags excludes
71+
bootstrap-tags/Guardfile
72+
bootstrap-tags/sass/*.scss

bootstrap-tags/.bower.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "bootstrap-tags",
3+
"version": "1.1.5",
4+
"homepage": "http://github.com/maxwells/bootstrap-tags",
5+
"bugs": "https://github.com/maxwells/bootstrap-tags/issues",
6+
"authors": [
7+
"Max Lahey <[email protected]>"
8+
],
9+
"description": "Boostrap-themed jquery tag interface",
10+
"main": [
11+
"dist/js/bootstrap-tags.js",
12+
"dist/css/bootstrap-tags.css"
13+
],
14+
"keywords": [
15+
"jquery",
16+
"bootstrap",
17+
"bootstrap3",
18+
"tagging",
19+
"tags",
20+
"typeahead",
21+
"autocomplete"
22+
],
23+
"license": "MIT",
24+
"ignore": [
25+
"src",
26+
"spec",
27+
"*.html"
28+
],
29+
"dependencies": {
30+
"jquery": ">=1.9.0",
31+
"bootstrap": ">=2.3.2"
32+
},
33+
"scripts": {
34+
"test": "grunt jasmine"
35+
},
36+
"_release": "1.1.5",
37+
"_resolution": {
38+
"type": "version",
39+
"tag": "1.1.5",
40+
"commit": "893dd88dcc0d2c9fb1ee72b882830085ef748e7c"
41+
},
42+
"_source": "git://github.com/maxwells/bootstrap-tags.git",
43+
"_target": "~1.1",
44+
"_originalSource": "bootstrap-tags"
45+
}

bootstrap-tags/LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2012-2014 Max Lahey
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

bootstrap-tags/README.md

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Bootstrap Tags
2+
3+
Bootstrap Tags is a jQuery plugin meant to extend Twitter Bootstrap to include tagging functionality. It supports Bootstrap 2.3.2 and ≥ 3.0.
4+
5+
[![Build Status](https://travis-ci.org/maxwells/bootstrap-tags.png?branch=master)](https://travis-ci.org/maxwells/bootstrap-tags)
6+
7+
## Demo
8+
[http://maxwells.github.com/bootstrap-tags.html](http://maxwells.github.com/bootstrap-tags.html)
9+
10+
## Installation
11+
12+
$ bower install bootstrap-tags
13+
14+
or
15+
16+
$ git clone https://github.com/maxwells/bootstrap-tags.git
17+
--> js files are located in dist/js, CSS in dist/css
18+
19+
## Features
20+
- Support for Bootstrap 2.3.2 and 3+
21+
- Autosuggest (for typing or activated by pressing the down key when empty)
22+
- Bootstrap Popovers (for extended information on a tag)
23+
- Exclusions (denial of a specified list)
24+
- Filters (allowance of only a specified list)
25+
- Placeholder prompts
26+
- Uses bootstrap button-[type] class styling (customizing your bootstrap will change tag styles accordingly)
27+
- Extensible with custom functions (eg, before/after tag addition/deletion, key presses, exclusions)
28+
29+
## Usage
30+
31+
<!-- include bootstrap tags js, css files -->
32+
<script src='path/to/bootstrap-tags/dist/js/bootstrap-tags.min.js'></script>
33+
<link rel="stylesheet" type="text/css" href="path/to/bootstrap-tags/dist/css/bootstrap-tags.css" />
34+
35+
<div id="my-tag-list" class="tag-list"></div>
36+
<script>
37+
$(function() {
38+
// If using Bootstrap 2, be sure to include:
39+
// Tags.bootstrapVersion = "2";
40+
$('#my-tag-list').tags({
41+
tagData:["boilerplate", "tags"],
42+
suggestions:["basic", "suggestions"],
43+
excludeList:["not", "these", "words"]
44+
});
45+
});
46+
</script>
47+
48+
## Documentation
49+
50+
### Settings
51+
52+
The following options are supported. Pass them as a javascript object to the `tags` jQuery function:
53+
54+
```javascript
55+
$('selector').tags({
56+
readOnly: true,
57+
tagData: ["a", "prepopulated", "list", "of", tags],
58+
beforeAddingTag: function(tag){ console.log(tag); }
59+
});
60+
```
61+
62+
option | type | description | default
63+
-------|------|-------------|---------
64+
`bootstrapVersion` | `String` | specify which version of bootstrap to format generated HTML for. Acceptable values are "2", "3" | `3`
65+
`tagData` | `Array` | a list of tags to initialize the tagging interace with | `[]`
66+
`tagSize` | `String` | describes what size input to use. Acceptable values are "lg", "md", or "sm" | `md`
67+
`readOnly` | `boolean` | whether or not to disable user input | `false`
68+
`suggestions` | `Array` | a list of terms that will populate the autosuggest feature when a user types in the first character. | `[]`
69+
`caseInsensitive` | `Boolean` | whether or not autosuggest should ignore case sensitivity | `false`
70+
`restrictTo` | `Array` | a list of allowed tags (will be combined with suggestions, if provided). User inputted tags that aren't included in this list will be ignored | `[]`
71+
`exclude` | `Array` | a list of case insensitive disallowed tags. Supports wildcarding (eg. `['*offensive*']` will ignore any word that has `offensive` in it) | `[]`
72+
`popoverData` | `Array` | a list of popover data. The index of each element should match the index of corresponding tag in `tagData` array | `null`
73+
`popovers` | `Boolean` | whether or not to enable bootstrap popovers on tag mouseover | whether `popoverData` was provided
74+
`popoverTrigger` | `String` | indicates how popovers should be triggered. Acceptable values are 'click', 'hover', 'hoverShowClickHide' | `hover`
75+
`tagClass` | `String` | which class the tag div will have for styling | `btn-info`
76+
`promptText` | `String` | placeholder string when there are no tags and nothing typed in | `Enter tags…`
77+
`maxNumTags` | `Integer` | Maximum number of allowable (user-added) tags. All tags that are initialized in the tagData property are retained. If set, then input is disabled when the number of tags exceeds this value. | `-1` (no limit)
78+
`readOnlyEmptyMessage` | `String` | text to be displayed if there are no tags in readonly mode. Can be HTML | `No tags to display...`
79+
`beforeAddingTag` | `function(String tag)` | anything external you'd like to do with the tag before adding it. Returning false will stop tag from being added | `null`
80+
`afterAddingTag` | `function(String tag)` | anything external you'd like to do with the tag after adding it | `null`
81+
`beforeDeletingTag` | `function(String tag)` | find out which tag is about to be deleted. Returning false will stop tag from being deleted | `null`
82+
`afterDeletingTag` | `function(String tag)` | find out which tag was removed by either pressing delete key or clicking the (x) | `null`
83+
`definePopover` | `function(String tag)` | must return the popover content for the tag that is being added. (eg "Content for [tag]") | `null`
84+
`excludes` | `function(String tag)` | return true if you want the tag to be excluded, false if allowed | `null`
85+
86+
### Controlling tags
87+
Some functions are chainable (returns a `Tagger` object), and can be used to move the data around outside of the plugin.
88+
89+
function | return type | description
90+
---------|-------------|-------------
91+
`hasTag(tag:string)` | `Boolean` | whether tag is in tag list
92+
`getTags()` | `Array` | a list of tags currently in the interface
93+
`getTagsWithContent()` | `Array` | a list of javascript objects with a `tag` property and `content` property
94+
`getTag(tag:string)` | `String` | returns tag as string
95+
`getTagWithContent(tag:string)` | `Object` | returns object with `tag` and `content` property (popover)
96+
`addTag(tag:string)` | `Tagger` | add a tag
97+
`renameTag(tag:string, newTag:string)` | `Tagger` | rename one tag to another value
98+
`removeLastTag()` | `Tagger` | removes last tag if it exists
99+
`removeTag(tag:string)` | `Tagger` | removes tag specified by string if it exists
100+
`addTagWithContent(tag:string, popoverContent:string)` | `Tagger` | Add a tag with associated popover content
101+
`setPopover(tag:string, popoverContent:string)` | `Tagger` | update a tag's associated popover content, if that tag exists
102+
103+
Example:
104+
105+
```javascript
106+
var tags = $('#one').tags( {
107+
suggestions : ["here", "are", "some", "suggestions"],
108+
popoverData : ["What a wonderful day", "to make some stuff", "up so that I", "can show it works"],
109+
tagData: ["tag a", "tag b", "tag c", "tag d"],
110+
excludeList : ["excuse", "my", "vulgarity"],
111+
} );
112+
tags.addTag("tag e!!").removeTag("tag b").setPopover("tag c", "Changed popover content");
113+
console.log(tags.getTags());
114+
```
115+
116+
To reference a tags instance that you've already attached to a selector, (eg. $(selector).tags(options)) you can use $(selector).tags() or $(selector).tags(index)
117+
118+
### Building
119+
120+
For a one off:
121+
122+
$ grunt build
123+
124+
_To build continously_:
125+
126+
$ grunt watch
127+
128+
### Testing
129+
130+
$ grunt test
131+
132+
### Contributing
133+
134+
If you spot a bug, experience browser incompatibility, or have feature requests, please submit them [here](https://github.com/maxwells/bootstrap-tags/issues).
135+
136+
If you want to hack away to provide a new feature/bug-fix, please follow these guidelines:
137+
138+
- Make changes to the coffeescript and sass files, not js/css. This is to ensure that the next person who comes in and edits upstream from js/css will not overwrite your changes.
139+
- Create a pull request for your feature branch, updating README documentation if necessary
140+
141+
### License
142+
143+
This project rocks and uses the MIT-LICENSE.
144+
145+
### Author
146+
147+
Max Lahey

bootstrap-tags/bower.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "bootstrap-tags",
3+
"version": "1.1.3",
4+
"homepage": "http://github.com/maxwells/bootstrap-tags",
5+
"bugs": "https://github.com/maxwells/bootstrap-tags/issues",
6+
"authors": [
7+
"Max Lahey <[email protected]>"
8+
],
9+
"description": "Boostrap-themed jquery tag interface",
10+
"main": [
11+
"dist/js/bootstrap-tags.js",
12+
"dist/css/bootstrap-tags.css"
13+
],
14+
"keywords": [
15+
"jquery",
16+
"bootstrap",
17+
"bootstrap3",
18+
"tagging",
19+
"tags",
20+
"typeahead",
21+
"autocomplete"
22+
],
23+
"license": "MIT",
24+
"ignore": [
25+
"src",
26+
"spec",
27+
"*.html"
28+
],
29+
"dependencies": {
30+
"jquery": ">=1.9.0",
31+
"bootstrap": ">=2.3.2"
32+
},
33+
"scripts": {
34+
"test": "grunt jasmine"
35+
}
36+
}
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/* bootstrap-tags styles */
2+
.bootstrap-tags.bootstrap-3 .tag a {
3+
margin: 0 0 0 .3em; }
4+
.bootstrap-tags.bootstrap-3 .glyphicon-white {
5+
color: #fff; }
6+
7+
.bootstrap-tags.bootstrap-2 .tag.md {
8+
padding: .3em .4em .4em; }
9+
.bootstrap-tags.bootstrap-2 .tag.lg {
10+
padding: .4em .4em .5em; }
11+
12+
.bootstrap-tags {
13+
position: relative; }
14+
.bootstrap-tags .tags {
15+
width: inherit;
16+
height: 0;
17+
position: absolute;
18+
padding: 0;
19+
margin: 0; }
20+
.bootstrap-tags .tag-data {
21+
display: none; }
22+
.bootstrap-tags .tags-input {
23+
width: 100%;
24+
margin: 0;
25+
padding: 0;
26+
height: 1.7em;
27+
box-sizing: content-box;
28+
-webkit-box-sizing: content-box;
29+
-moz-box-sizing: content-box; }
30+
.bootstrap-tags .tag-list {
31+
width: 280px;
32+
height: auto;
33+
min-height: 26px;
34+
left: 2px;
35+
top: 2px;
36+
position: relative; }
37+
.bootstrap-tags .tag {
38+
padding: .4em .4em .4em;
39+
margin: 0 .1em;
40+
float: left; }
41+
.bootstrap-tags .tag.sm {
42+
padding: .4em .4em .5em;
43+
font-size: 12px; }
44+
.bootstrap-tags .tag.md {
45+
font-size: 14px; }
46+
.bootstrap-tags .tag.lg {
47+
font-size: 18px;
48+
padding: .4em .4em .4em;
49+
margin: 0 .2em .2em 0; }
50+
.bootstrap-tags .tag a {
51+
color: #bbb;
52+
cursor: pointer;
53+
opacity: .5; }
54+
.bootstrap-tags .tag .remove {
55+
vertical-align: bottom;
56+
top: 0; }
57+
.bootstrap-tags ul.tags-suggestion-list {
58+
width: 300px;
59+
height: auto;
60+
list-style: none;
61+
margin: 0;
62+
z-index: 2;
63+
max-height: 160px;
64+
overflow: scroll; }
65+
.bootstrap-tags ul.tags-suggestion-list li.tags-suggestion {
66+
padding: 3px 20px;
67+
height: auto; }
68+
.bootstrap-tags ul.tags-suggestion-list li.tags-suggestion-highlighted {
69+
color: white;
70+
text-decoration: none;
71+
background-color: #0081C2;
72+
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
73+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
74+
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
75+
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
76+
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
77+
background-repeat: repeat-x;
78+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); }

0 commit comments

Comments
 (0)