Skip to content

Commit

Permalink
Update documentation with arrow customization info
Browse files Browse the repository at this point in the history
  • Loading branch information
garettarrowood committed Sep 28, 2016
1 parent 28dc9d1 commit c8a256a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log

## Unreleased

### Added

* Add config option to customize up and down arrows used for direction indicators in the FormHelper. PR [#726](https://github.com/activerecord-hackery/ransack/pull/726)

*Garett Arrowood*

### Fixed

* Use class attributes properly so that inheritance is respected.
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,18 @@ The sort link may be displayed without the order indicator arrow by passing
<%= sort_link(@q, :name, hide_indicator: true) %>
```

Alternatively, all sort links may be displayed without the order indicator arrow
by adding this to an initializer file like `config/initializers/ransack.rb`:
These indicator arrows may also be customized by setting them in an initializer file like `config/initializers/ransack.rb`:

```ruby
Ransack.configure do |c|
c.custom_arrows = {
up_arrow: '<i class="custom-up-arrow-icon"></i>',
down_arrow: 'U+02193'
}
end
```

Alternatively, all sort links may be displayed without the order indicator arrows:

```ruby
Ransack.configure do |c|
Expand Down
8 changes: 4 additions & 4 deletions lib/ransack/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def ignore_unknown_conditions=(boolean)
self.options[:ignore_unknown_conditions] = boolean
end

# Ransack's default arrows are html-code snippets found options at the
# top of this file. Arrows may be anything wrapped in quotation marks.
# Both arrows or a single arrow may be globally overridden in an
# initializer file like `config/initializers/ransack.rb` as follows:
# Ransack's default indicator arrows are html-code snippets. These
# arrows may be replaced by anything wrapped in quotation marks. Both
# or just one arrow may be globally overridden in an initializer file
# like `config/initializers/ransack.rb` as follows:
#
# Ransack.configure do |config|
# # Set the up_arrow as an icon, set the down arrow as unicode
Expand Down

0 comments on commit c8a256a

Please sign in to comment.