Sha256: 993c2ad9e9cd746d3a598738f5dcce78e273b4cbc8734963ec9b58c10950e010

Contents?: true

Size: 960 Bytes

Versions: 10

Compression:

Stored size: 960 Bytes

Contents

module BivouacHelpers
  module SoundView
    # 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
    # http://script.aculo.us for more documentation.
    def play_sound( file, options = {} )
      javascript_tag(play_sound_js(file, options) + ";\n")
    end
    
    def play_sound_js( file, options = {} ) #:nodoc:
      %(Sound.play('/public/#{file}', #{options_for_javascript(options)}); return false)
    end
    
    # Disable sound
    def disable_sound( )
      javascript_tag(disable_sound_js + ";\n")
    end
    
    def disable_sound_js( ) #:nodoc:
      %(Sound.disable(); return false)
    end
    
    # Enable sound
    def enable_sound( )
      javascript_tag(enable_sound_js + ";\n")
    end
    
    def enable_sound_js( ) #:nodoc:
      %(Sound.enable(); return false)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bivouac-0.1.5 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.0 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.1.6 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.3 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.1 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.2 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.5 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.3.0 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.4.0 lib/bivouac/helpers/view/goh/sound.rb
bivouac-0.2.4 lib/bivouac/helpers/view/goh/sound.rb