File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1
1
require "podlove-web-player-rails/version"
2
+ require "podlove-web-player-rails/view_helpers"
2
3
3
4
module Podlove
4
5
module Web
5
6
module Player
6
7
module Rails
7
8
class Engine < ::Rails ::Engine
9
+ initializer "podlove-web-player-rails.view_helpers" do |app |
10
+ ActionView ::Base . send :include , ViewHelpers
11
+ end
8
12
end
9
13
end
10
14
end
Original file line number Diff line number Diff line change
1
+ module Podlove
2
+ module Web
3
+ module Player
4
+ module Rails
5
+ module ViewHelpers
6
+ def podloveaudio ( options = { } )
7
+ html = "<audio id='player'>"
8
+ html << "<source src='#{ options [ :src ] } ' type='#{ options [ :type ] } '></source>"
9
+ html << "</audio>"
10
+
11
+ options . delete ( :src )
12
+ options . delete ( :type )
13
+
14
+ script = "$('#player').podlovewebplayer(#{ options . to_json } );"
15
+
16
+ return raw html + "\n " + javascript_tag ( script )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
You can’t perform that action at this time.
0 commit comments