<commit_before>[![Gitter](https://img.shields.io/badge/gitter-join_chat-brightgreen.svg)](https://gitter.im/zimme/meteor-active-route)
[![Code Climate](https://img.shields.io/codeclimate/github/zimme/meteor-active-route.svg)](https://codeclimate.com/github/zimme/meteor-active-route)

# Active route helpers

This package provide helpers for figuring out if some route or path is or isn't
the currently active route.

### Install

```sh
meteor add zimme:active-route
```

### Supported routers

The currently supported routes are

* `iron:router`
* `meteorhacks:flow-router`

If both routers are installed `iron:router` checks will take precedence.

### Template helpers

#### Usage

Basic usage examples.

##### isActiveRoute

Template helper to check if the supplied route name matches the currently active route's
name.

Returns either a configurable `'string'`, which defaults to `'active'`, or
`false`.

```html
<li class="{{isActiveRoute 'home'}}">...</li>
<li class="{{isActiveRoute route='home'}}">...</li>
<li class="{{isActiveRoute regex='home|dashboard'}}">...</li>
{{#if isActiveRoute 'home'}}
  <span>Show only if 'home' is the current route's name</span>
{{/if}}
{{#if isActiveRoute regex="^products"}}
  <span>Show only if the current route's name begins with 'products'</span><commit_msg>Add links to supported routers<commit_after>[![Gitter](https://img.shields.io/badge/gitter-join_chat-brightgreen.svg)](https://gitter.im/zimme/meteor-active-route)
[![Code Climate](https://img.shields.io/codeclimate/github/zimme/meteor-active-route.svg)](https://codeclimate.com/github/zimme/meteor-active-route)

# Active route helpers

This package provide helpers for figuring out if some route or path is or isn't
the currently active route.

### Install

```sh
meteor add zimme:active-route
```

### Supported routers

The currently supported routes are

* [`iron:router`](https://atmospherejs.com/iron/router)
* [`meteorhacks:flow-router`](https://atmospherejs.com/meteorhacks/flow-router)

If both routers are installed `iron:router` checks will take precedence.

### Template helpers

#### Usage

Basic usage examples.

##### isActiveRoute

Template helper to check if the supplied route name matches the currently active route's
name.

Returns either a configurable `'string'`, which defaults to `'active'`, or
`false`.

```html
<li class="{{isActiveRoute 'home'}}">...</li>
<li class="{{isActiveRoute route='home'}}">...</li>
<li class="{{isActiveRoute regex='home|dashboard'}}">...</li>
{{#if isActiveRoute 'home'}}
  <span>Show only if 'home' is the current route's name</span>
{{/if}}
{{#if isActiveRoute regex="^products"}}
  <span>Show only if the current route's name begins with 'products'</span>
{'fraction_non_alphanumeric': 0.1637835848362164, 'fraction_numerical': 0.0, 'mean_word_length': 5.4714285714285715, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3967708', 'n_tokens_mistral': 899, 'n_tokens_neox': 851, 'n_words': 239}