Permalink
Browse files

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

  • Loading branch information...
1 parent f830768 commit fa5424653a49dd2d871e8f42e907b98019d4a121 @danielgrippi danielgrippi committed Feb 6, 2012
View
@@ -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
@@ -41,6 +41,10 @@ def mentioned_people
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
@@ -27,12 +27,12 @@
{{t "stream.reshares" count=reshares_count}}
{{/if}}
</div>
-
- {{> status-message}}
-
- </div>
{{/with}}
+ {{> status-message}}
+
+ </div>
+
{{else}}
<p>
@@ -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")))
}
})

0 comments on commit fa54246

Please sign in to comment.