codeplant / simple-navigation

A ruby gem for creating navigations (with multiple levels) for your Rails, Sinatra or Padrino applications. Render your navigation as html list, link list or breadcrumbs.
http://simple-navigation-demo.codeplant.ch/
MIT License
885 stars 136 forks source link

Changes needed for custom renderers? #199

Closed gltarsa closed 5 years ago

gltarsa commented 7 years ago

Did the requirements for a custom renderer change when your gem moved from v3 to v4?

We have been using simple-navigation for some time in conjunction with an add-on gem to include bootstrap rendering. Recently, I needed to use the link_html feature and upgraded to 4.0.3 so that I could use it. The add-on gem is no longer actively maintained, but another user posted a PR to get it working with 4.0.3, I pulled those changes into a private repo and link_html work for me now. However, the new combination of 4.0.3 + add-on now appears to ignore other options, so that code like this:

    primary.item :ticket,
      "Ticket",
      url_for('//mycompany/ticket'),
      link_html: { target: '_blank' },
      icon: ['fa fa-ticket'],
      if: -> { can? :create, Ticket }

Appears to ignore the icon: ['fa fa-ticket'] option. That snippet used to render as a small ticket icon followed by the word "Ticket" now renders as just "Ticket" with no icon. No CSS for the icon is present in the view.

The changes to the custom renderer were minimal and there appears to be nothing there that would explain this. I read the article in the Wiki on custom renderers and spent some time verifying that the add-on gem appears to adhere to those guidelines. I also noticed that it is circa 2013 and that got me wondering if there is more to building a custom renderer for simple-navigation V4.

Any insights into this issue would be appreciated.

andi commented 7 years ago

Could you provide the code for the custom renderer you use?

n-rodriguez commented 7 years ago

https://github.com/jbox-web/simple_navigation_bootstrap/issues/1