Skip to content

Commit

Permalink
Compability with simple-navigation 4.0.0
Browse files Browse the repository at this point in the history
I am not sure if it can work with simple-navigation prior 4.0.0 or not, so I simply forced the gemspec to work only with ver 4+.
  • Loading branch information
pzgz committed Oct 21, 2015
1 parent 1cbfa07 commit 03f1a18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/simple-navigation-bootstrap/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SimpleNavigationBootstrap
VERSION = "1.0.2"
VERSION = "1.0.3"
end
13 changes: 6 additions & 7 deletions lib/simple_navigation/rendering/renderer/bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@ def tag_for(item, name = '', icon = nil, split = false, dropdown = false)
link << content_tag(:i, '', :class => [icon].flatten.compact.join(' ')) unless icon.nil?
link << name
if include_sub_navigation?(item)
item_options = item.html_options
item_options[:link] = Hash.new if item_options[:link].nil?
item_options[:link][:class] = Array.new if item_options[:link][:class].nil?
item_link_html_opts = item.link_html_options || Hash.new
item_link_html_opts[:class] = Array.new if item_link_html_opts[:class].nil?
unless split
if dropdown
item_options[:link][:class] << 'dropdown-toggle'
item_options[:link][:'data-toggle'] = 'dropdown'
item_options[:link][:'data-target'] = '#'
item_link_html_opts[:class] << 'dropdown-toggle'
item_link_html_opts[:'data-toggle'] = 'dropdown'
item_link_html_opts[:'data-target'] = '#'
end
link << content_tag(:b, '', :class => 'caret')
end
item.html_options = item_options
item.instance_variable_set(:'@link_html_options', item_link_html_opts)
end
link_to(link.join(" ").html_safe, url, options_for(item))
end
Expand Down
2 changes: 1 addition & 1 deletion simple-navigation-bootstrap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Gem::Specification.new do |s|

# specify any dependencies here; for example:
s.add_development_dependency "rake"
s.add_runtime_dependency "simple-navigation", ">= 3.7.0", "< 4.0.0"
s.add_runtime_dependency "simple-navigation", ">= 4.0.0"
s.add_runtime_dependency "railties", ">= 3.1"
end

1 comment on commit 03f1a18

@zealot128
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit looks good!
Would you consider opening a Pull Request on the main repository, so that all the simple-nav users can use this? pdf#13

谢谢了!

Please sign in to comment.