3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/helpers/tungsten/topology_grid_helper.rb', line 3
def topology_grid(name, components=2, options={}, &block)
options[:class] = "topology-grid-wrapper #{options[:class]} #{ 'disabled' if options[:disabled] }".strip
options[:'data-track-input-state'] = "##{name}-slider"
disabled = options.delete(:disabled)
label = block_given? ? capture(&block) : options.delete(:label)
content_tag( :div, options){
concat content_tag( :div, class: "topology-grid"){
components.times do
concat content_tag( :div, class: "component") {}
end
}
if options[:step_label]
concat tag( :span, 'data-step-label': "#{options[:step_label]}", class: "topology-grid-label")
options.delete(:step_label)
elsif label
concat content_tag( :span, class: "topology-grid-label"){ label }
end
}
end
|