Module: HeadshotHelper
- Defined in:
- lib/app/helpers/headshot_helper.rb
Instance Method Summary collapse
- #headshot_camera(width = 400, height = 300) ⇒ Object
- #headshot_config_button(label = 'Configure', options = {}) ⇒ Object
- #headshot_default_config(session_key, capture_path, options = {}) ⇒ Object
- #headshot_default_options ⇒ Object
- #headshot_snap_button(label = 'Snap', options = {}) ⇒ Object
Instance Method Details
#headshot_camera(width = 400, height = 300) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/app/helpers/headshot_helper.rb', line 18 def headshot_camera(width = 400, height = 300) raw(%{ <script language="JavaScript"> headshotInitializer.setup(#{width}, #{height}, params); </script> }) end |
#headshot_config_button(label = 'Configure', options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/app/helpers/headshot_helper.rb', line 10 def (label = 'Configure', = {}) .reverse_merge!({ :onclick => 'headshot.configure()' }) (label, ) end |
#headshot_default_config(session_key, capture_path, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/app/helpers/headshot_helper.rb', line 26 def headshot_default_config(session_key, capture_path, = {}) .reverse_merge!() session_value = u([session_key]) raw(%{ <script language="JavaScript"> var params = { session_key_name: encodeURIComponent('#{session_value}'), csrf_token: encodeURI(encodeURI(headshotUtils.getPageMetaValue('csrf-token'))) }; var headshotHandlers = { onComplete: function(msg) { headshot.reset(); }, snap: function() { headshot.snap(); } } headshot.set_swf_url('#{[:swf_url]}'); headshot.set_api_url('#{capture_path}'); headshot.set_quality(#{[:quality]}); headshot.set_shutter_sound(#{[:shutter_sound]}, '#{[:shutter_sound_url]}'); headshot.set_hook('onComplete', '#{[:on_complete]}'); </script> }) end |
#headshot_default_options ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/app/helpers/headshot_helper.rb', line 54 def { :swf_url => '/swfs/headshot.swf', :quality => 90, :shutter_sound => true, :shutter_sound_url => '/audio/shutter.mp3', :on_complete => 'headshotHandlers.onComplete' } end |
#headshot_snap_button(label = 'Snap', options = {}) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/app/helpers/headshot_helper.rb', line 2 def (label = 'Snap', = {}) .reverse_merge!({ :onclick => 'headshotHandlers.snap()' }) (label, ) end |