Skip to content
Open

4.0 #84

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions .jshintrc

This file was deleted.

5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

120 changes: 66 additions & 54 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,54 +1,66 @@
aldeed:[email protected]
aldeed:[email protected]
aldeed:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
momentjs:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
aldeed:[email protected]
aldeed:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
aldeed:autoform-select2
=========================
# aldeed:autoform-select2

An add-on Meteor package for [aldeed:autoform](https://github.com/aldeed/meteor-autoform). Provides a single custom input type, "select2", which renders an input using the [select2](https://select2.github.io/) plugin.

Expand All @@ -9,7 +8,7 @@ An add-on Meteor package for [aldeed:autoform](https://github.com/aldeed/meteor-

You must use select2 4.0+.

Option 1:
#### Option 1:

Add this to `<head>`:

Expand All @@ -18,7 +17,7 @@ Add this to `<head>`:
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
```

Option 2:
#### Option 2:

Install the NPM package (and its jQuery dependency):

Expand All @@ -33,7 +32,7 @@ import 'select2';
import 'select2/dist/css/select2.css';
```

Option 3:
#### Option 3:

Get the files from GitHub and add them directly in your app /client/lib folder.

Expand Down Expand Up @@ -69,6 +68,40 @@ In a Meteor app directory, enter:
$ meteor add aldeed:autoform-select2
```

You can import this library dynamically or statically.

Dynamically, in your `client/main.js`:

```js
import { AutoFormSelect2 } from 'meteor/aldeed:autoform-select2';
// ...
await AutoFormSelect2.load()
```

Or statically, in your `client/main.js`:

```js
import 'meteor/aldeed:autoform-select2/static';
```

### Installing Bootstrap theme

As of version 4.x there is no tight coupling to Bootstrap themes anymore.
If you want to use the Bootstrap theme, you can install create use the following code:

```js
const from = Template.afSelect2
from.helpers({
atts: function addFormControlAtts () {
const { select2Options, ...rest } = this.atts
// Add bootstrap class
return AutoForm.Utility.addClass(rest, 'form-control')
}
})
```



## Usage

Specify "select2" for the `type` attribute of any input. This can be done in a number of ways:
Expand Down
Loading