Sha256: a7fe578b72db714584393f7a52ac97a1b3e8b63ce803e167275785065267deb1
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
module KirguduBase class Dynamic::Breadcrumbs::Item < ::KirguduBase::Dynamic::BaseModel def initialize(label, url = nil) self.label = label self.url = url self.items = [] self.css_styles = {} self.css_classes = [] end attr_reader :label attr_reader :url attr_reader :items attr_reader :css_classes attr_reader :css_styles validates_presence_of :label #validates_url_format_of :url, allow_blank: true def has_link? !(self.url.nil? || self.url.blank?) end def has_items? items.length > 0 end def css(key, value = nil) if value css_styles[key] = value value else css_styles[key] end end def has_css_styles? css_styles.keys.length > 0 end def add_css_class(css_class) self.css_classes << css_class end def remove_css_class(css_class) self.css_classes.delete(css_class) end def get_css_classes css_classes end def clear_css_classes css_classes.clear end # removes nils and duplicates def clean_css_classes css_classes.compact! css_classes.uniq! end def has_css_classes? css_classes.length > 0 end private attr_writer :label attr_writer :url attr_writer :items attr_accessor :css_classes attr_accessor :css_styles end end
Version data entries
3 entries across 3 versions & 1 rubygems