Module: BivouacHelpers::SoundView

Defined in:
lib/bivouac/helpers/view/goh/sound.rb

Instance Method Summary collapse

Instance Method Details

#disable_soundObject

Disable sound



21
22
23
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 21

def disable_sound( )
  javascript_tag(disable_sound_js + ";\n")
end

#disable_sound_jsObject

:nodoc:



25
26
27
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 25

def disable_sound_js( ) #:nodoc:
  %(Sound.disable(); return false)
end

#enable_soundObject

Enable sound



30
31
32
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 30

def enable_sound( )
  javascript_tag(enable_sound_js + ";\n")
end

#enable_sound_jsObject

:nodoc:



34
35
36
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 34

def enable_sound_js( ) #:nodoc:
  %(Sound.enable(); return false)
end

#play_sound(file, options = {}) ⇒ Object

Play the file file

Example:

play_sound("my_song.mp3", :replace => true)

The file must be in public

You can change the behaviour with various options, see script.aculo.us for more documentation.



12
13
14
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 12

def play_sound( file, options = {} )
  javascript_tag(play_sound_js(file, options) + ";\n")
end

#play_sound_js(file, options = {}) ⇒ Object

:nodoc:



16
17
18
# File 'lib/bivouac/helpers/view/goh/sound.rb', line 16

def play_sound_js( file, options = {} ) #:nodoc:
  %(Sound.play('/public/#{file}', #{options_for_javascript(options)}); return false)
end