Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
James Kingsley committed Jun 20, 2017
1 parent fc32573 commit 5034808
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,30 @@ return [

## Usage

Start off by including the front-end assets; **don't forget to include Tribute!**
First you will need to import [Tribute](https://github.com/zurb/tribute).

```html
<script type="text/javascript" src="/js/laravel-mentions.js"></script>
<link rel="stylesheet" type="text/css" href="/css/laravel-mentions.css">
```
npm install tributejs --save-dev
```

Then include Tribute in your `bootstrap.js` file and assign it globally.

```js
import Tribute from "tributejs";
window.Tribute = Tribute;
```

Now in your `bootstrap.js` file you can import the `Mentions` class and also assign it globally.

```js
import Mentions from './laravel-mentions';
window.Mentions = Mentions;
```

Now to include the styling just import it into your SCSS file.

```css
@import "laravel-mentions";
```

Now let's setup the form where we'll write a comment that has mentions:
Expand Down Expand Up @@ -127,14 +146,17 @@ Next add the script to initialize the mentions:
```js
new Mentions({
// Input element selector
// Defaults to .has-mentions
input: '.has-mentions',

// Mentions form field selector
mentions: '#mentions',
// Output form field selector
// Defaults to #mentions
output: '#mentions',

// Pools
pools: [{
// Trigger the popup on the @ symbol
// Defaults to @
trigger: '@',

// Pool name from the mentions config
Expand Down

0 comments on commit 5034808

Please sign in to comment.