Skip to content
Browse files

moved some assets around and started work on record

  • Loading branch information...
1 parent 1e64533 commit a8791ea63788409a3b4267fb12fcf3fc8ff4ec9b @leemartin leemartin committed
View
4 app/assets/javascripts/application.js
@@ -6,4 +6,8 @@
//
//= require jquery
//= require jquery_ujs
+//= require chosen.jquery.min
+//= require soundmanager2
+//= require jquery.timeago
+//= require jquery.tmpl
//= require_tree .
View
86 app/assets/javascripts/record.js.coffee
@@ -0,0 +1,86 @@
+jQuery ->
+
+ # timecode = (ms) ->
+ # hms = h: Math.floor(ms/(60*60*1000)), m: Math.floor((ms/60000)%60), s: Math.floor((ms/1000)%60)
+ # tc = []
+ # tc.push hms.h if hms.h > 0
+ # tc.push if hms.m < 10 and hms.h > 0 then "0#{hms.m}" else hms.m
+ # tc.push if hms.s < 10 then "0#{hms.s}" else hms.s
+ # tc.join ':'
+
+ $recorder = $('.recorder ')
+ $record = $('.recorder .record')
+ $play = $('.recorder .play')
+ $stop = $('.recorder .stop')
+ $upload = $('.upload')
+
+ Recorder.initialize
+ swfSrc: "/swfs/recorder.swf"
+
+ record = () ->
+ Recorder.record
+ start: ->
+ $record.text "Recording..."
+ progress: (ms) ->
+ console.log ms
+
+ stop = () ->
+ $record.text "Record"
+ $play.text "Play"
+ Recorder.stop()
+
+ play = () ->
+ stop()
+ Recorder.play
+ progress: (ms) ->
+ console.log ms
+
+ upload = () ->
+ $.ajax
+ type: 'get'
+ url: '/record'
+ success: (url) ->
+ $upload.text "Uploading..."
+ Recorder.upload
+ url: url
+ audioParam: "track[asset_data]"
+ params:
+ "track[title]": "Cheer"
+ "track[sharing]": "public"
+ success: (res) ->
+ $upload.text "Saving..."
+ $.ajax
+ type: 'post'
+ url: '/tracks.json'
+ data:
+ track: tid: $.parseJSON(res).id
+ success: (data) ->
+ $upload.text "Redirecting..."
+ setTimeout "window.location='/tracks/#{data.id}'", 7500
+ error: (err) ->
+ console.log "track creation failed"
+ error: (err) ->
+ console.log "upload to soundcloud failed"
+ error: (err) ->
+ console.log "token grab failed"
+
+ # GUI Actions
+
+ $record.click ->
+ if $record.text() == "Record"
+ record()
+ else
+ return false
+
+ $play.click -> play()
+ $stop.click -> stop()
+
+ $upload.click ->
+ if $upload.hasClass('disabled')
+ alert "You must agree to the rules to submit."
+ else
+ if $upload.text() == "Submit"
+ upload()
+ else
+ return false
+ return false
View
2 app/assets/stylesheets/application.css
@@ -3,5 +3,7 @@
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
+ *= require chosen.css.erb
+ *= require skeleton
*= require_tree .
*/
View
24 app/views/application/_record.html.haml
@@ -0,0 +1,24 @@
+/ %p Listen to the clip below, read the lyrics, and then record your cheer!
+/
+/ %p <a href="22654090" class="player"></a>
+/
+/ %p(style="color:grey;font-style:italic")
+/ Cheers to the freaking weekend<br>
+/ I drink to that, yeah yeah<br>
+/ Oh let the Jameson sink in<br>
+/ I drink to that, yeah yeah<br>
+
+%p Use the controls below to record your submission.
+
+%p.recorder
+ %a.button.record(href="#record") Record
+ %a.button.stop(href="#stop") Stop
+ %a.button.play(href="#play") Play
+ /%a.button.upload(href="#upload") Submit
+
+%p
+ %input#track_agreed(name="track[agreed]" type="checkbox" value=0)
+ I agree to the #{link_to "Contest Rules", @competition.rules, :style => "text-decoration:underline", :target => "_blank"}.
+
+%p
+ %a.button.upload.disabled(href="#upload") Submit
View
46 app/views/tracks/new.html.haml
@@ -19,24 +19,40 @@
%h1.remove-top Want to Compete? Here's How.
%hr.large
- %div
- %h2 1. Sign up for SoundCloud
- %p SoundCloud is a platform that puts your sound at the heart of communities, websites and even apps. Watch conversations, connections and social experiences happen, with your sound as the spark.
- %p
- %a.button(href="http://soundcloud.com/signup" target="_blank") SoundCloud Sign-up
- %hr
+ - if !current_user
+
+ %div
+ %h2 1. Sign up for SoundCloud
+ %p SoundCloud is a platform that puts your sound at the heart of communities, websites and even apps. Watch conversations, connections and social experiences happen, with your sound as the spark.
+ %p
+ %a.button(href="http://soundcloud.com/signup" target="_blank") SoundCloud Sign-up
+
+ - else
+
+ %div
+ %h2(style="text-decoration:line-through;color:lightgrey") 1. Sign up for SoundCloud
- %div
- %h2 2. Upload your Track to SoundCloud
- %p Upload your track to your SoundCloud account so it's available to submit once you login here. Be sure to include an artwork image, description, and set it to "Public."
- %p
- %a.button(href="http://soundcloud.com/upload" target="_blank") Upload your Track
%hr
-
+
%div
- %h2 3. Submit Your Track
- %p Once you've created your SoundCloud account and uploaded your track to it, you may login below and select your track from a drop down list to include it in the competition.
+ %h2 2. Record your Submission
- if current_user
- = render "form"
+ = render "record"
- else
+ %p Once you've created your SoundCloud account, you may login below and then record your submission.
%p= link_to "Login to Submit", login_link, :class => "button"
+
+ / %div
+ / %h2 2. Upload your Track to SoundCloud
+ / %p Upload your track to your SoundCloud account so it's available to submit once you login here. Be sure to include an artwork image, description, and set it to "Public."
+ / %p
+ / %a.button(href="http://soundcloud.com/upload" target="_blank") Upload your Track
+ / %hr
+ /
+ / %div
+ / %h2 3. Submit Your Track
+ / %p Once you've created your SoundCloud account and uploaded your track to it, you may login below and select your track from a drop down list to include it in the competition.
+ / - if current_user
+ / = render "form"
+ / - else
+ / %p= link_to "Login to Submit", login_link, :class => "button"
View
0 app/assets/javascripts/chosen.jquery.min.js → ...r/assets/javascripts/chosen.jquery.min.js
File renamed without changes.
View
0 app/assets/javascripts/jquery.timeago.js → vendor/assets/javascripts/jquery.timeago.js
File renamed without changes.
View
0 app/assets/javascripts/jquery.tmpl.js → vendor/assets/javascripts/jquery.tmpl.js
File renamed without changes.
View
0 app/assets/javascripts/soundmanager2.js → vendor/assets/javascripts/soundmanager2.js
File renamed without changes.
View
0 app/assets/stylesheets/chosen.css.erb → vendor/assets/stylesheets/chosen.css.erb
File renamed without changes.
View
0 app/assets/stylesheets/skeleton.css → vendor/assets/stylesheets/skeleton.css
File renamed without changes.

0 comments on commit a8791ea

Please sign in to comment.
Something went wrong with that request. Please try again.