kill rich-media type with fire

This commit is contained in:
danielgrippi 2012-05-21 12:33:28 -07:00
parent 0960a090fa
commit 777c037e16
16 changed files with 59 additions and 104 deletions

View file

@ -0,0 +1,14 @@
(function(){
app.helpers.oEmbed = {
html : function (o_embed_cache) {
if (!o_embed_cache) { return "" }
var data = o_embed_cache.data;
if (data.type == "photo") {
return '<img src="' + data.url + '" width="' + data.width + '" height="' + data.height + '" />'
} else {
return data.html || ""
}
}
}
})();

View file

@ -63,14 +63,5 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
"Night",
"Wallpaper",
"Newspaper"
],
legacyTemplateNames : [
"status-with-photo-backdrop",
"note",
"rich-media",
"photo-backdrop",
"activity-streams-photo",
"status"
]
});

View file

@ -73,7 +73,7 @@ app.views.framerControls = app.views.Base.extend({
presenter : function() {
var selectedFrame = this.model.get("frame_name")
, templates =_.union(app.models.Post.frameMoods, _.without(app.models.Post.legacyTemplateNames, ["status", "status-with-photo-backdrop", "photo-backdrop", "activity-streams-photo", "note"])) //subtract re-implemented templates
, templates = app.models.Post.frameMoods //subtract re-implemented templates
return _.extend(this.defaultPresenter(), {
templates :_.map(templates, function(template) {
return {

View file

@ -26,7 +26,6 @@ app.views.CanvasFrame = app.views.SmallFrame.extend({
},
presenter : function(){
console.log(this.adjustedImageHeight())
return _.extend(this.smallFramePresenter(), {
adjustedImageHeight : this.adjustedImageHeight()
})

View file

@ -84,26 +84,14 @@ app.views.OEmbed = app.views.Base.extend({
presenter:function () {
return _.extend(this.defaultPresenter(), {
o_embed_html:this.embedHTML()
o_embed_html : app.helpers.oEmbed.html(this.model.get("o_embed_cache"))
})
},
embedHTML:function () {
if (!this.model.get("o_embed_cache")) {
return "";
}
var data = this.model.get("o_embed_cache").data;
if (data.type == "photo") {
return '<img src="' + data.url + '" width="' + data.width + '" height="' + data.height + '" />';
} else {
return data.html || ""
}
},
showOembedContent:function () {
var insertHTML = $(this.embedHTML());
showOembedContent : function () {
var insertHTML = $(app.helpers.oEmbed.html(this.model.get("o_embed_cache")));
var paramSeparator = ( /\?/.test(insertHTML.attr("src")) ) ? "&" : "?";
insertHTML.attr("src", insertHTML.attr("src") + paramSeparator + "autoplay=1");
this.$el.html(insertHTML);
},
}
})

View file

@ -21,7 +21,7 @@ app.views.Post = app.views.StreamObject.extend({
showFactory : function(model) {
var frameName = model.get("frame_name");
//translate obsolete template names to the new Moods, should be removed when template picker comes cliente side.
//translate obsolete template names to the new Moods, should be removed when template picker comes client side.
var map = {
'status-with-photo-backdrop' : 'Wallpaper', //equivalent
'status' : 'Day', //equivalent
@ -31,13 +31,9 @@ app.views.Post = app.views.StreamObject.extend({
frameName = map[frameName] || frameName
if(_.include(app.models.Post.legacyTemplateNames, frameName)){
return legacyShow(model)
} else {
return new app.views.Post[frameName]({
model : model
})
}
return new app.views.Post[frameName]({
model : model
})
function legacyShow(model) {
return new app.views.Post.Legacy({

View file

@ -14,40 +14,6 @@ a { color : rgb(42,156,235) }
.icon-red { background-image: image_url("img/glyphicons-halflings-red.png"); }
.icon-blue { background-image: image_url("img/glyphicons-halflings-blue.png"); }
.rich-media {
background-color: $night-background-color;
p {
@include media-text();
color: #999;
a {
font-weight: normal;
font-size: smaller;
}
}
iframe {
@include box-shadow(0, 3px, 15px, #000);
width: 857px;
height: 480px;
max-width: 100%;
max-height: 100%;
}
}
.rich-media-container {
display: table;
height: 100%;
width: 100%;
}
.rich-media-container2 {
display: table-cell;
vertical-align: middle;
}
.avatar {
&.micro {
height: 20px;
@ -115,9 +81,17 @@ a { color : rgb(42,156,235) }
height: 100%;
width: 100%;
img {
img,
iframe {
@include photo-shadow();
}
iframe {
width: 857px;
height: 480px;
max-width: 100%;
max-height: 100%;
}
}
article { //mood posts

View file

@ -305,11 +305,6 @@
min-height : $two-row-height + px;
}
&.rich-media {
width: auto;
height: auto;
}
&.wallpaper {
.image-container {
background-color: black;

View file

@ -19,6 +19,8 @@
background-color : rgba(0,0,0,0.8);
z-index : 200;
text-align : left;
position : absolute;
left : 0;
top : 0;
@ -36,14 +38,8 @@
margin-top: 5px;
}
legend {
color : #fff;
text-align : left;
border : none;
}
textarea#post_text{
height: 200px;
height: 100px;
padding : 10px;
}

View file

@ -1,5 +1,13 @@
<div class="container">
<section class="photo_viewer"></section>
<!--Temp hacks-->
{{#if o_embed_cache}}
{{#if o_embed_cache.data}}
{{{o_embed_cache.data.html}}}
{{/if}}
{{/if}}
<header>{{{headline}}}</header>
<section class="body">{{{body}}}</section>
</div>

View file

@ -1,13 +1,14 @@
<div class='span5'>
<h3 class="span8">
Make something!
</h3>
<div class="span8 new_picture"/>
<div class='span8'>
<form class="new-post">
<fieldset>
<legend>
Make Something!
</legend>
<textarea name="text" id='post_text' class="text span8" placeholder="Add Text">{{text}}</textarea>
<textarea id="text_with_markup" style="display:none;"/>
</fieldset>
</form>
</div>
<div class="span3 new_picture"/>

View file

@ -0,0 +1,8 @@
class RemoveRichMediaType < ActiveRecord::Migration
def up
execute("UPDATE posts SET frame_name='Night' WHERE frame_name='rich-media'")
end
def down
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120519015723) do
ActiveRecord::Schema.define(:version => 20120521191429) do
create_table "account_deletions", :force => true do |t|
t.string "diaspora_handle"

View file

@ -3,7 +3,6 @@ class TemplatePicker
TEMPLATES = %w{ status_with_photo_backdrop
note
rich_media
photo_backdrop
activity_streams_photo
status
@ -29,10 +28,6 @@ class TemplatePicker
self.status? && post.text(:plain_text => true).length > 200
end
def rich_media?
post.o_embed_cache.present?
end
def photo_backdrop?
post.photos.size == 1
end

View file

@ -215,9 +215,5 @@ FactoryGirl.define do
text SecureRandom.hex(1000)
end
factory(:rich_media, :parent => :status_message) do
association(:o_embed_cache)
end
factory(:status, :parent => :status_message)
end

View file

@ -36,12 +36,6 @@ describe TemplatePicker do
end
end
describe '#rich_media?' do
it 'is true if the post contains an o_embed object' do
TemplatePicker.new(post).should be_rich_media
end
end
describe '#photo_backdrop?' do
it 'is true if the post contains only one photo' do
@post_stubs.merge!(:photos => stub(:size => 1))