Search code examples
ruby-on-rails-4rubygemsfont-awesomewill-paginateslim-lang

Rails: How to put font-awesome symbol in will-paginate label?


I am using will_paginate and font-awesome-rails gems in my app.

I want to replace will_paginate 'Previous' and 'Next' labels with this font-awesome symbol.

To replace those will_paginate labels I can write this piece of code (I am using Slim):

= will_paginate @articles, :previous_label => 'my_own_text', :next_label => 'my_own_text'

but I don't know how to insert any font-awesome symbol there.

Any ideas?


Solution

  • will_paginate exposes only few things to be able to customize the look and feel of the pagination, which covers most of the cases, but not all the cases.

    Try this:

    = will_paginate @articles, :previous_label => '<i class="fa fa-angle-left"></i>', :next_label => '<i class="fa fa-angle-right"></i>'
    

    I haven't tested it. If it doesn't work, then the only way I can think of is to monkey-patch the will_paginate pagination renderer.