Skip to content

Duplicate classes for menu item (possible problem in method SimpleNavigation::Item.html_options) #189

@kirillsalikhov

Description

@kirillsalikhov

I use custom renderer, and in some places has double classes('selected selected').
May be problem in SimpleNavigation::Item.html_options, if I call it twice I get double classes
(if I set any html options in navigation.rb for item).

def html_options
      // Here, if my options[:html] is not blank, I get Link not copy to @options[:html]
      html_opts = options.fetch(:html) { Hash.new } 
      html_opts[:id] ||= autogenerated_item_id

      classes = [html_opts[:class], selected_class, active_leaf_class]
      classes = classes.flatten.compact.join(' ')
      // And at this place, it modifies @options[:html], If I call this method second time, it will be       
      // doubled(selected_class and active_leaf_class will be added second time)
      html_opts[:class] = classes if classes && !classes.empty? 

      html_opts
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions