Module: BakeryTheme::ObjectListHelper

Included in:
BakeryThemeHelper
Defined in:
app/helpers/bakery_theme/object_list_helper.rb

Defined Under Namespace

Classes: ObjectListItem

Instance Method Summary collapse

Instance Method Details

#group_list(options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 4

def group_list(options = {}, &block)
  attributes         = options
  attributes[:class] ||= []
  attributes[:class] << "content_items"
  attributes[:class] << "object_list" # folder_item_list
  attributes[:class] << @content_space
  content = capture do
    yield
  end
   :ol, content, tag_attributes_for(attributes)
end

#object_list(options = {}, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 16

def object_list(options = {}, &block)
  sortable           = options.delete :sortable
  object             = options.delete :object
  display_mode       = options.delete :display_mode
  custom_class       = options.delete :class
  refresh_url        = options.delete :update

  attributes         = options
  attributes[:id] = dom_id(object, :children) if object
  attributes[:'data-change-url'] = refresh_url if refresh_url
  attributes[:class] ||= []
  attributes[:class] << custom_class if custom_class
  attributes[:class] << "object_list" #folder_item_list
  attributes[:class] << "content_list"
  attributes[:class] << "content_items"
  attributes[:class] << "grid_display" if display_mode == :grid
  attributes[:class] << "sortable_content" if sortable
  attributes[:class] << @content_space
  content = capture do
    yield
  end      
  content << (:li, "", :class => "dragspace") if sortable
   :ol, content, tag_attributes_for(attributes)
end

#object_list_item_for(object, options = {}) {|item| ... } ⇒ Object

Yields:

  • (item)


41
42
43
44
45
# File 'app/helpers/bakery_theme/object_list_helper.rb', line 41

def object_list_item_for object, options = {}
  item = ObjectListItem.new object, options, self
  yield item if block_given?
  item.to_html
end