diff --git a/app/views/templates/_templates.haml b/app/views/templates/_templates.haml index dc4ce6110..6dd5ea81b 100644 --- a/app/views/templates/_templates.haml +++ b/app/views/templates/_templates.haml @@ -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") diff --git a/app/views/templates/activity-streams-photo.ujs b/app/views/templates/activity-streams-photo.ujs new file mode 100644 index 000000000..2d5fa3954 --- /dev/null +++ b/app/views/templates/activity-streams-photo.ujs @@ -0,0 +1 @@ + diff --git a/public/javascripts/app/views/post_content_view.js b/public/javascripts/app/views/post_content_view.js index 6a1ded2e1..356720911 100644 --- a/public/javascripts/app/views/post_content_view.js +++ b/public/javascripts/app/views/post_content_view.js @@ -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" +}); diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js index 1d9a9005c..85efad21e 100644 --- a/public/javascripts/app/views/post_view.js +++ b/public/javascripts/app/views/post_view.js @@ -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); diff --git a/public/javascripts/app/views/reshare_view.js b/public/javascripts/app/views/reshare_view.js new file mode 100644 index 000000000..5fc31672a --- /dev/null +++ b/public/javascripts/app/views/reshare_view.js @@ -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; + } +});