Class: BakeryTheme::ObjectListHelper::ObjectListItem

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/bakery_theme/object_list_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, options, template) ⇒ ObjectListItem

Returns a new instance of ObjectListItem.



60
61
62
63
64
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 60

def initialize(object, options, template)
  @object = object
  @options = options
  @template = template
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



66
67
68
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 66

def object
  @object
end

#optionsObject (readonly)

Returns the value of attribute options.



66
67
68
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 66

def options
  @options
end

Instance Method Details

#to_htmlObject



68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 68

def to_html
  content = ""
  content << %(<a name="#{options[:ref]}"></a>).html_safe if options[:ref]
  content << %(<span class="icon"></span>)

  inner_contents = %(<h3 class="file_name">#{h options[:name]}</h3>).html_safe

  content << (:div, inner_contents, :class => "item_contents")

  item =  :div, content.html_safe, :class => ["ui-widget-content", "ui-helper-clearfix"].compact.join(" ")
   :li, item, :id => dom_id(object), :class => [dom_class(object), "ui-widget", "ui-helper-clearfix", options[:type]].compact.map(&:to_s).join(" ")
end