lib/builders/html_builder.rb in navigasmic-0.4.1 vs lib/builders/html_builder.rb in navigasmic-0.5.0

- old
+ new

@@ -32,11 +32,12 @@ buffer = template.capture(self, &proc) group = template.content_tag(@@group_tag, buffer) label = label_for_group(label) unless label.blank? - template.content_tag(@@item_tag, label.to_s + group, options.delete(:html)) + visible = options[:hidden_unless].blank? ? true : options[:hidden_unless].is_a?(Proc) ? options[:hidden_unless].call : options[:hidden_unless] + visible ? template.content_tag(@@item_tag, label.to_s + group, options.delete(:html)) : '' end def item(label, options = {}, &proc) buffer = block_given? ? template.capture(self, &proc) : '' @@ -49,10 +50,10 @@ options[:html][:class] = template.add_class(options[:html][:class], @@classnames[:highlighted]) if item.highlighted?(template.request.path, template.params) label = label_for_item(label) label = template.link_to(label, item.link, options.delete(:link_html)) unless item.link.empty? || item.disabled? - template.content_tag(@@item_tag, label + buffer, options.delete(:html)) + item.hidden? ? '' : template.content_tag(@@item_tag, label + buffer, options.delete(:html)) end def label_for_group(label) template.content_tag(@@label_tag, label.to_s) end \ No newline at end of file