Forked from riyad/bootstrap_breadcrumbs_builder.rb
Last active
December 24, 2015 07:39
Revisions
-
mrfoto revised this gist
Sep 30, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,8 @@ # class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder def render return '' if @elements.empty? @context.content_tag :ol, class: 'breadcrumb' do @elements.collect do |element| render_element element end.join("\n").html_safe -
mrfoto revised this gist
Sep 30, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,9 +14,9 @@ def render end def render_element element current = @context.current_page? compute_path(element) @context.content_tag :li, class: ('active' if current) do @context.link_to_unless_current compute_name(element), compute_path(element), element.options end end end -
mrfoto revised this gist
Sep 30, 2013 . 1 changed file with 2 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,5 @@ # You can use it with the :builder option on render_breadcrumbs: # <%= render_breadcrumbs :builder => ::BootstrapBreadcrumbsBuilder %> # # Note: You may need to adjust the autoload_paths in your config/application.rb file for rails to load this class: # config.autoload_paths += Dir["#{config.root}/lib/"] @@ -25,4 +19,4 @@ def render_element element @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) end end end -
mrfoto revised this gist
Sep 30, 2013 . 1 changed file with 7 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,28 +5,24 @@ # * separator: what should be displayed as a separator between elements # # You can use it with the :builder option on render_breadcrumbs: # <%= render_breadcrumbs :builder => ::BootstrapBreadcrumbsBuilder%> # # Note: You may need to adjust the autoload_paths in your config/application.rb file for rails to load this class: # config.autoload_paths += Dir["#{config.root}/lib/"] # class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder def render @context.content_tag(:ol, class: 'breadcrumb') do @elements.collect do |element| render_element element end.join("\n").html_safe end end def render_element element current = @context.current_page?(compute_path(element)) @context.content_tag(:li, class: ('active' if current)) do @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) end end end -
riyad revised this gist
Apr 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def render def render_element(element) current = @context.current_page?(compute_path(element)) @context.content_tag(:li, :class => ('active' if current)) do link_or_text = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) divider = @context.content_tag(:span, (@options[:separator] || '/').html_safe, :class => 'divider') unless current -
riyad revised this gist
Apr 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def render_element(element) @context.content_tag(:li, class: ('active' if current)) do link_or_text = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) divider = @context.content_tag(:span, (@options[:separator] || '/').html_safe, :class => 'divider') unless current link_or_text + (divider || '') end -
riyad revised this gist
Feb 28, 2012 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,15 @@ # The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder. # It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions. # # BootstrapBreadcrumbsBuilder accepts a limited set of options: # * separator: what should be displayed as a separator between elements # # You can use it with the :builder option on render_breadcrumbs: # <%= render_breadcrumbs :builder => ::BootstrapBreadcrumbsBuilder, :separator => "»" %> # # Note: You may need to adjust the autoload_paths in your config/application.rb file for rails to load this class: # config.autoload_paths += Dir["#{config.root}/lib/"] # class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder def render @context.content_tag(:ul, class: 'breadcrumb') do -
riyad created this gist
Feb 28, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # See SimpleBuilder in https://github.com/weppos/breadcrumbs_on_rails/blob/master/lib/breadcrumbs_on_rails/breadcrumbs.rb class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder def render @context.content_tag(:ul, class: 'breadcrumb') do @elements.collect do |element| render_element(element) end.join.html_safe end end def render_element(element) current = @context.current_page?(compute_path(element)) @context.content_tag(:li, class: ('active' if current)) do link_or_text = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) divider = @context.content_tag(:span, (@options[:separator] || '/').html_safe, class: 'divider') unless current link_or_text + (divider || '') end end end