fix markup display on reshares. DERP. [ci skip]

This commit is contained in:
danielgrippi 2012-02-06 08:02:16 -08:00
parent f83076850b
commit fa5424653a
4 changed files with 18 additions and 28 deletions

View file

@ -35,13 +35,7 @@ class Post < ActiveRecord::Base
t.add :o_embed_cache
t.add :user_like
t.add :mentioned_people
t.add lambda { |post|
if post.respond_to?(:photos)
post.photos
else
[]
end
}, :as => :photos
t.add :photos
end
xml_attr :provider_display_name

View file

@ -41,6 +41,10 @@ class Reshare < Post
self.root ? root.mentioned_people : super
end
def photos
self.root ? root.photos : super
end
def receive(recipient, sender)
local_reshare = Reshare.where(:guid => self.guid).first
if local_reshare && local_reshare.root.author_id == recipient.person.id

View file

@ -27,12 +27,12 @@
{{t "stream.reshares" count=reshares_count}}
{{/if}}
</div>
{{> status-message}}
</div>
{{/with}}
{{> status-message}}
</div>
{{else}}
<p>

View file

@ -1,12 +1,10 @@
app.views.Content = app.views.StreamObject.extend({
presenter : function(model){
var model = model || this.model
presenter : function(){
return _.extend(this.defaultPresenter(), {
text : app.helpers.textFormatter(model),
o_embed_html : embedHTML(model),
largePhoto : this.largePhoto(model),
smallPhotos : this.smallPhotos(model)
text : app.helpers.textFormatter(this.model),
o_embed_html : embedHTML(this.model),
largePhoto : this.largePhoto(),
smallPhotos : this.smallPhotos()
})
function embedHTML(model){
@ -20,22 +18,16 @@ app.views.Content = app.views.StreamObject.extend({
}
},
largePhoto : function(model) {
var photos = model.get("photos")
largePhoto : function() {
var photos = this.model.get("photos")
if(!photos || photos.length == 0) { return }
return photos[0]
},
smallPhotos : function(model) {
var photos = model.get("photos")
smallPhotos : function() {
var photos = this.model.get("photos")
if(!photos || photos.length < 2) { return }
return photos.slice(1,8)
},
// should be a private function in this.presenter()
rootPresenter : function(model) {
if(!model || !model.get("root")) { return }
return this.presenter(new app.models.Post(model.get("root")))
}
})