Module: ListBlockHelper

Defined in:
app/helpers/list_block_helper.rb

Instance Method Summary collapse

Instance Method Details

#f7_list_block(*args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/list_block_helper.rb', line 3

def f7_list_block(*args, &block)
  output = []
  title = nil
  options = {}
  if args.count > 0
    if (args.first.kind_of?(String) || args.first.kind_of?(Symbol))
      title = args.first
      options = args.second || {}
    elsif arg.first.kind_of? Hash
      options = args.first
      title = options[:title]
      options = options.reject{ |k,v| k == :title }
    end
  end
  list_block_div(options) do
    concat content_block_title_div(title) unless title.blank?
    concat list_block_ul(&block)
    concat list_block_label(options) unless options[:label].blank?
  end
end

#f7_list_divider(title_or_options, options = nil, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'app/helpers/list_block_helper.rb', line 25

def f7_list_divider(title_or_options, options = nil, &block)
  if title_or_options.class == Hash
    options = title_or_options if options.nil?
    title_or_options = options[:title]
  end
  title = title_or_options

   :li do
     :div, title, :class => ['item-divider']
  end
end

#f7_list_group(title_or_options, options = nil, &block) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/list_block_helper.rb', line 39

def f7_list_group(title_or_options, options = nil, &block)
  if title_or_options.class == Hash
    options = title_or_options if options.nil?
    title_or_options = options[:title]
  end
  title = title_or_options

   :div, :class => ["list-group"] do
    concat list_group_title title unless title.blank?
    yield if block_given?
  end
end

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



53
54
55
# File 'app/helpers/list_block_helper.rb', line 53

def f7_list_group_title(title, options = {}, &block)
  list_group_li(title, options)
end

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/helpers/list_block_helper.rb', line 59

def f7_list_item(title, options = {}, &block)
   :li do
    css_classes = ["item-content"]
    tag = options[:href] ? :a : :div
    css_classes << "item-link" if tag == :a
    css_classes.concat(options[:class]) if options[:class]
    
    tag_options = options.reject { |k, v| [:title, :icon, :after].include? k }
    tag_options[:class] = css_classes
    
     tag, tag_options do
      concat list_icon_i(options[:icon]) if options[:icon]
      concat list_item_inner(title, options)
    end
  end
end