Module: TransitHelper
Instance Method Summary
collapse
#form_for
#paginate
#deliver, #deliver_content, #deliver_rss
Instance Method Details
#audio_player(source, html_attrs = {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'app/helpers/transit_helper.rb', line 31
def audio_player(source, html_attrs = {})
attrs = {
id: "audio_player_#{Time.now.to_i}",
class: 'audio_player'
}
wrapper = html_attrs.delete(:wrapper) || :div
data_attrs = { source: source }
html_attrs.reverse_merge!( attrs.merge!(data: { context_attributes: Base64.encode64s(data_attrs.to_json) }) )
content_tag(wrapper, "", html_attrs)
end
|
#transit_assets ⇒ Object
8
9
10
11
12
13
|
# File 'app/helpers/transit_helper.rb', line 8
def transit_assets
return '' unless controller.class.name.match(/Transit/)
stylesheet_link_tag('transit') <<
javascript_include_tag('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js') <<
javascript_include_tag('transit/admin')
end
|
#video_player(source, html_attrs = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/helpers/transit_helper.rb', line 15
def video_player(source, html_attrs = {})
attrs = {
id: "video_player_#{Time.now.to_i}",
class: 'video_player'
}
wrapper = html_attrs.delete(:wrapper) || :div
data_attrs = { source: source, ext: File.extname(source).sub('.','') };
if img = html_attrs.delete(:image)
data_attrs.merge!(image: img)
end
html_attrs.reverse_merge!( attrs.merge!(data: { context_attributes: Base64.encode64s(data_attrs.to_json) } ))
content_tag(wrapper, "", html_attrs)
end
|