extracted oembed thumb stuff from #2941, also fixes oembed cukes
This commit is contained in:
parent
9e249bb7ef
commit
98d1e29055
5 changed files with 48 additions and 2 deletions
|
|
@ -17,6 +17,8 @@ Feature: oembed
|
|||
|
||||
And I follow "My Aspects"
|
||||
Then I should see a video player
|
||||
And I should see a ".oembed" within ".post-content"
|
||||
And I should see a "img" within ".oembed"
|
||||
|
||||
Scenario: Post an unsecure video link
|
||||
Given I expand the publisher
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ Given /^I have several oEmbed data in cache$/ do
|
|||
type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"
|
||||
allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>
|
||||
</object>",
|
||||
"thumbnail_url" => "http://i2.ytimg.com/vi/M3r2XDceM6A/hqdefault.jpg",
|
||||
"thumbnail_height" => 360,
|
||||
"thumbnail_width" => 480,
|
||||
},
|
||||
"link_url" => "http://youtube.com/watch?v=M3r2XDceM6A&format=json",
|
||||
"oembed_get_request" => "http://www.youtube.com/oembed?format=json&frame=1&iframe=1&maxheight=420&maxwidth=420&url=http://youtube.com/watch?v=M3r2XDceM6A",
|
||||
|
|
@ -54,6 +57,9 @@ Given /^I have several oEmbed data in cache$/ do
|
|||
type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"
|
||||
allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>
|
||||
</object>",
|
||||
"thumbnail_url" => "http://i2.ytimg.com/vi/M3r2XDceM6A/hqdefault.jpg",
|
||||
"thumbnail_height" => 360,
|
||||
"thumbnail_width" => 480,
|
||||
},
|
||||
"link_url" => "http://myrichtube.com/watch?v=M3r2XDceM6A&format=json",
|
||||
"discovery_data" => '<link rel="alternate" type="application/json+oembed" href="http://www.mytube.com/oembed?format=json&frame=1&iframe=1&maxheight=420&maxwidth=420&url=http://mytube.com/watch?v=M3r2XDceM6A" />',
|
||||
|
|
@ -75,6 +81,9 @@ Given /^I have several oEmbed data in cache$/ do
|
|||
type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"
|
||||
allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>
|
||||
</object>",
|
||||
"thumbnail_url" => "http://i2.ytimg.com/vi/M3r2XDceM6A/hqdefault.jpg",
|
||||
"thumbnail_height" => 360,
|
||||
"thumbnail_width" => 480,
|
||||
},
|
||||
"link_url" => "http://yourichtube.com/watch?v=M3r2XDceM6A&format=json",
|
||||
"oembed_get_request" => "http://www.youtube.com/oembed?format=json&frame=1&iframe=1&maxheight=420&maxwidth=420&url=http://youtube.com/watch?v=M3r2XDceM6A",
|
||||
|
|
@ -93,6 +102,9 @@ Given /^I have several oEmbed data in cache$/ do
|
|||
type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\"
|
||||
allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>
|
||||
</object>",
|
||||
"thumbnail_url" => "http://i2.ytimg.com/vi/M3r2XDceM6A/hqdefault.jpg",
|
||||
"thumbnail_height" => 360,
|
||||
"thumbnail_width" => 480,
|
||||
},
|
||||
"link_url" => "http://mytube.com/watch?v=M3r2XDceM6A&format=json",
|
||||
"discovery_data" => '<link rel="alternate" type="application/json+oembed" href="http://www.mytube.com/oembed?format=json&frame=1&iframe=1&maxheight=420&maxwidth=420&url=http://mytube.com/watch?v=M3r2XDceM6A" />',
|
||||
|
|
@ -103,7 +115,9 @@ Given /^I have several oEmbed data in cache$/ do
|
|||
unless type=='unsupported'
|
||||
url = data['oembed_get_request'].split('?')[0]
|
||||
store_data = data['oembed_data'].merge('trusted_endpoint_url' => url)
|
||||
OEmbedCache.new(:url => data['link_url'], :data => store_data.to_json);
|
||||
oembed = OEmbedCache.new(:url => data['link_url']);
|
||||
oembed.data = store_data
|
||||
oembed.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,5 +16,12 @@
|
|||
|
||||
<div class="collapsible">
|
||||
{{{text}}}
|
||||
{{{o_embed_html}}}
|
||||
{{#if o_embed_cache}}
|
||||
<div class="oembed">
|
||||
{{#if o_embed_cache.data.thumbnail_url}}
|
||||
<img src="{{o_embed_cache.data.thumbnail_url}}" class="thumb" />
|
||||
{{/if}}
|
||||
{{{o_embed_html}}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ app.views.Stream = Backbone.View.extend({
|
|||
|
||||
setupEvents : function(){
|
||||
this.stream.bind("fetched", this.removeLoader, this)
|
||||
this.stream.bind("fetched", this.postRender, this)
|
||||
this.stream.bind("allPostsLoaded", this.unbindInfScroll, this)
|
||||
this.collection.bind("add", this.addPost, this);
|
||||
if(window.app.user()) {
|
||||
|
|
@ -53,6 +54,23 @@ app.views.Stream = Backbone.View.extend({
|
|||
return this;
|
||||
},
|
||||
|
||||
postRender: function() {
|
||||
var collElem = $(this.el).find('.collapsible');
|
||||
_.each(collElem, function(elem) {
|
||||
var elem = $(elem),
|
||||
oembed = elem.find('.oembed'),
|
||||
thumb = oembed.find('.thumb');
|
||||
|
||||
if( thumb.length > 0 && oembed.is(':visible') ) {
|
||||
thumb.click(function(){
|
||||
oembed.find('*').toggle();
|
||||
$(this).hide();
|
||||
});
|
||||
oembed.find('*').toggle();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
appendLoader: function(){
|
||||
$("#paginate").html($("<img>", {
|
||||
src : "/images/static-loader.png",
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,11 @@ ul#press_logos
|
|||
:size 12px
|
||||
:color #777
|
||||
|
||||
.collapsible
|
||||
.oembed .thumb
|
||||
:display none
|
||||
:cursor pointer
|
||||
|
||||
.conversation_participants
|
||||
:z-index 3
|
||||
:background
|
||||
|
|
|
|||
Loading…
Reference in a new issue