Skip to content

Commit

Permalink
Merge branch 'maurogeorge-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
GBH committed Mar 17, 2017
2 parents 2fbfe29 + a34740f commit e6c5006
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Here's a list of available options that can be used as the `:active` value
* Symbol -> :exclusive | :inclusive | :exact
* Regex -> /regex/
* Controller/Action Pair -> [[:controller], [:action_a, :action_b]]
* Hash -> { param_a: 1, param_b: 2 }
```

## More Examples
Expand Down Expand Up @@ -61,11 +62,11 @@ that as well. Let's try to activate links urls of which begin with 'use':
active_link_to 'Users', users_path, active: /^\/use/
```

If we need to set link to be active based on an exact match, we can do
that as well:
If we need to set link to be active based on an exact match, for example on
filter made via a query string, we can do that as well:

```ruby
active_link_to 'Users', users_path, active: :exact
active_link_to 'Users', users_path(role_eq: 'admin'), active: :exact
```

What if we need to mark link active for all URLs that match a particular controller,
Expand All @@ -88,6 +89,12 @@ Sometimes it should be as easy as giving link true or false value:
active_link_to 'Users', users_path, active: true
```

If we need to set link to be active based on `params`, we can do that as well:

```ruby
active_link_to 'Admin users', users_path(role_eq: 'admin'), :active => { role_eq: 'admin' }
```

## More Options
You can specify active and inactive css classes for links:

Expand Down

0 comments on commit e6c5006

Please sign in to comment.