Skip to content

Commit 7ffe4fb

Browse files
author
Bastian Bartmann
committed
removed duplication in view_helpers
1 parent 578e361 commit 7ffe4fb

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

lib/podlove-web-player-rails/view_helpers.rb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ module Player
44
module Rails
55
module ViewHelpers
66
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)
7+
podlove("audio", options)
178
end
189

1910
def podlovevideo(options = {})
20-
html = "<video id='player'>"
11+
podlove("video", options)
12+
end
13+
14+
private
15+
16+
def podlove(type, options = {})
17+
html = "<#{type} id='player'>"
2118
html << "<source src='#{options[:src]}' type='#{options[:type]}'></source>"
22-
html << "</video>"
19+
html << "</audio>"
2320

2421
options.delete(:src)
2522
options.delete(:type)

spec/spec_helper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
gem 'railties', '>= 3.0.0'
21
require 'action_controller/railtie'
32
require 'rails/test_unit/railtie'
4-
53
require 'podlove-web-player-rails'
64
require 'coveralls'
75
Coveralls.wear!

0 commit comments

Comments
 (0)