Sha256: 8186ccca6511d8be5bec09efcc13cb4f6ca6e6a023a938e90be3435a8fd0d6dc
Contents?: true
Size: 891 Bytes
Versions: 3
Compression:
Stored size: 891 Bytes
Contents
module Seiten module HTML module Helpers def self.build_page_modifiers(page, current_page) modifiers = [] modifiers << :parent if page.children? if page.active?(current_page) modifiers << :active modifiers << (page == current_page ? :current : :expanded) end modifiers end def self.build_classes(element = nil, class_options:, modifier_options: [], modifiers: [], merge: nil) classes = [] klass = class_options[element || :base] classes << klass if modifiers.any? base = (modifier_options[:base].presence || klass) modifiers.each do |modifier| classes << "#{base}#{modifier_options[:separator]}#{modifier_options[modifier]}" end end classes << merge if merge classes.join(' ') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
seiten-1.0.2 | lib/seiten/html/helpers.rb |
seiten-1.0.1 | lib/seiten/html/helpers.rb |
seiten-1.0.0 | lib/seiten/html/helpers.rb |