Sha256: de6e9fd9b5143a737b818ff660c7417cc5d94caf7a5d93eb6e063d1325d0ca89

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

module RulesEngineView
  module Navigate
    
    def re_breadcrumbs *links
      return if links.empty?
      result = ''
      result << '<div class="re-breadcrumbs">'
      links[0 ... -1].each do |link|
        result << link
        result << "<span class='re-breadcrumbs-seperator'>></span>"
      end
      result << "<em>"
      result << "#{links[-1]}"
      result << "</em>"
      result << "<span class='re-breadcrumbs-seperator'>></span>" if links[-1] == links[0]
      result << '</div>'
      result
    end
    
    def re_breadcrumbs_right *links
      return if links.empty?
      result = ''
      result << '<div class="re-breadcrumbs">'
      links[0 ... -2].each do |link|
        result << link
        result << "<span class='re-breadcrumbs-seperator'>></span>"
      end
      result << "<em>"
      result << "#{links[-2]}"
      result << "</em>"
      result << "<span class='re-breadcrumbs-seperator'>></span>" if links[-2] == links[0]
        
      result << "<div class='re-breadcrumb-right'>#{links[-1]}</div>"
      result << '</div>'      
      result            
    end
  end  
end

ActionView::Base.class_eval do
  include RulesEngineView::Navigate
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rules_engine-0.1.7 lib/rules_engine_view/navigate.rb
rules_engine-0.1.6 lib/rules_engine_view/navigate.rb
rules_engine-0.1.5 lib/rules_engine_view/navigate.rb
rules_engine-0.1.4 lib/rules_engine_view/navigate.rb
rules_engine-0.1.3 lib/rules_engine_view/navigate.rb