Update documentation with arrow customization info

This commit is contained in:
Garett Arrowood 2016-09-27 18:02:55 -04:00
parent 28dc9d1f5f
commit c8a256a88e
3 changed files with 23 additions and 6 deletions

View File

@ -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.

View File

@ -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|

View File

@ -77,10 +77,10 @@ module Ransack
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