added as::photo view
This commit is contained in:
parent
34e3403e2e
commit
e6d4ec2dc8
5 changed files with 25 additions and 1 deletions
|
|
@ -16,3 +16,6 @@
|
|||
|
||||
%script{:id => "reshare-template", :type => 'text/template'}
|
||||
!= File.read("#{Rails.root}/app/views/templates/reshare.ujs")
|
||||
|
||||
%script{:id => "activity-streams-photo-template", :type => 'text/template'}
|
||||
!= File.read("#{Rails.root}/app/views/templates/activity-streams-photo.ujs")
|
||||
|
|
|
|||
1
app/views/templates/activity-streams-photo.ujs
Normal file
1
app/views/templates/activity-streams-photo.ujs
Normal file
|
|
@ -0,0 +1 @@
|
|||
<img src="<%= image_url %>" />
|
||||
|
|
@ -22,3 +22,7 @@ App.Views.StatusMessage = App.Views.PostContent.extend({
|
|||
App.Views.Reshare = App.Views.PostContent.extend({
|
||||
template_name : "#reshare-template"
|
||||
});
|
||||
|
||||
App.Views.ActivityStreams__Photo = App.Views.PostContent.extend({
|
||||
template_name : "#activity-streams-photo-template"
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ App.Views.Post = Backbone.View.extend({
|
|||
},
|
||||
|
||||
renderPostContent: function(){
|
||||
var postClass = App.Views[this.model.get("post_type")] || App.Views.StatusMessage;
|
||||
var normalizedClass = this.model.get("post_type").replace(/::/, "__");
|
||||
var postClass = App.Views[normalizedClass] || App.Views.StatusMessage;
|
||||
var postView = new postClass({ model : this.model });
|
||||
|
||||
this.$(".post-content").html(postView.render().el);
|
||||
|
|
|
|||
15
public/javascripts/app/views/reshare_view.js
Normal file
15
public/javascripts/app/views/reshare_view.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
App.Views.Reshare = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.model = options.model;
|
||||
this.template = _.template($("#reshare-template").html());
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.el = $(this.template($.extend(
|
||||
this.model.toJSON(),
|
||||
App.user()
|
||||
)));
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
Loading…
Reference in a new issue