44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'app/helpers/bar_item_helper.rb', line 44
def f7_bar_link(title_or_options, options=nil)
output = []
link_classes = []
if title_or_options.class == Hash
options = title_or_options
title = options[:title]
else
title = title_or_options
options ||= {}
end
href = options[:href] || '#'
icon = options[:icon]
if @f7_bartype == :tabbar
link_classes << 'tab-link'
else
link_classes << :link
end
link_classes << 'icon-only' if title.blank?
options[:class] = ([options[:class]] || []) + link_classes
link_attr = options.reject { |k, v| [:title, :icon, :badge].include? k }
span_class = (@f7_bartype == :tabbar ? {:class => 'tabbar-label'} : nil)
if icon.blank?
content_tag :a, title, link_attr
else
badge = nil
link_options = {}
if @f7_bartype == :tabbar
if options[:badge].kind_of? Hash
badge_data = options[:badge]
badge_classes = [:badge]
badge_classes << badge_data[:class] unless badge_data[:class].blank?
badge = content_tag :span, badge_data[:text], :class => badge_classes
else
badge = content_tag :span, options[:badge], :class => [:badge, 'badge-red']
end
link = link_icon_i(options[:icon], badge)
end
puts " has labels: #{@has_labels ? 'true' : 'false'}"
content_tag :a, :href => href, :class => link_classes do
output << link_icon_i(options[:icon], badge)
output << content_tag(:span, title, span_class) if !title.blank? && @has_labels
output.join("\n").html_safe
end
end
end
|