Skip to content

Commit

Permalink
testing branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmcgary committed Feb 7, 2012
1 parent 18a411a commit 9ad2540
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
7 changes: 5 additions & 2 deletions app/controllers/lanyards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ def embed

# maybe change to find by or create? How about I use a single query in the recording.model?
# maybe use whole url for "remoteurl" and then prevent duplicates?

if !params[:callback].nil?
@reply = render_to_string(:partial => '/shared/recording.html.erb', :collection => @remoteurl.recordings, :locals => {:v => "1"})
render :json => @reply.to_json, :callback => params[:callback], :content_type => 'application/json'
else
render :partial => "embed.js.erb", :content_type => 'application/javascript'

end


#@site = Site.find_by_permalink(params[:site_id])
Expand Down
50 changes: 40 additions & 10 deletions app/views/lanyards/_embed.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,47 @@ if (remoteurl_id == undefined) {

jQuery(document).ready(function($) {

$.fn.reverseChildren = function() {
return this.each(function(){
var $this = $(this);
$this.children().each(function(){
$this.prepend(this);
});
});
};
// $.fn.reverseChildren = function() {
// return this.each(function(){
// var $this = $(this);
// $this.children().each(function(){
// $this.prepend(this);
// });
// });
// };
// $('.toggle-synopsis').click(function() {
// $('.comments').reverseChildren();
// $(this).text($(this).text() == 'newest first' ? 'oldest first' : 'newest first');
// });



$('.toggle-synopsis').click(function() {
$('.comments').reverseChildren();
$(this).text($(this).text() == 'newest first' ? 'oldest first' : 'newest first');
$.getJSON("http://localhost:3000/sites/" + site_id +"/lanyard/embed?callback=?", function(json) {
// render html
$('.comments').html(json);
// create audiojs
var as = audiojs.createAll();
// rezise
$('.audiojs').width(widget_width - 78);
$('.audiojs .loaded').width(widget_width - 232);
$('.audiojs .scrubber').width(widget_width - 232);
$('.comments .comments-header').width(widget_width);
$('.comments .review-each').width(widget_width - 78);
// popup links
var profiles = {window100:{center:1,status:1}};
$(function(){$(".auth_popup").popupwindow(profiles);});
// synopsis toggle
$('.bold').click(function() {
$('.review-each div:hover .bold').toggleClass('toggle');
$('.comments-each div:hover .trans').slideToggle('fast');
return false;
});
console.log(json);
})
.success(function() { console.log("second success"); })
.error(function() { console.log("error"); })
.complete(function() { console.log("complete"); });
});


Expand Down

0 comments on commit 9ad2540

Please sign in to comment.