diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 75dc75eb9..bc983571d 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -9,21 +9,26 @@ class AspectsController < ApplicationController before_filter :save_selected_aspects, :only => :index before_filter :ensure_page, :only => :index - respond_to :html, :js - respond_to :json, :only => [:show, :create, :index] + respond_to :html, + :js, + :json def index + @backbone = true + stream_klass = Stream::Aspect aspect_ids = (session[:a_ids] ? session[:a_ids] : []) @stream = Stream::Aspect.new(current_user, aspect_ids, - :max_time => params[:max_time].to_i) + :max_time => params[:max_time].to_i) respond_with do |format| format.html do if params[:only_posts] render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts} + else + render 'aspects/index' end end - format.json{ render :json => @stream.stream_posts.to_json(:include => {:author => {:include => :profile}}) } + format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts } end end diff --git a/public/javascripts/app/collections/stream.js b/public/javascripts/app/collections/stream.js index 49148dfd2..59b2e2ac6 100644 --- a/public/javascripts/app/collections/stream.js +++ b/public/javascripts/app/collections/stream.js @@ -2,8 +2,9 @@ app.collections.Stream = Backbone.Collection.extend({ url: function() { var path = document.location.pathname; - - if(this.models.length) { path += "?max_time=" + _.last(this.models).createdAt(); } + if(this.models.length) { + path += "?max_time=" + _.last(this.models).createdAt(); + } return path; }, diff --git a/public/javascripts/app/router.js b/public/javascripts/app/router.js index f9bd6c9cf..37c540ef5 100644 --- a/public/javascripts/app/router.js +++ b/public/javascripts/app/router.js @@ -1,6 +1,7 @@ app.Router = Backbone.Router.extend({ routes: { "stream": "stream", + "aspects:query": "stream", "comment_stream": "stream", "like_stream": "stream", "mentions": "stream", @@ -11,8 +12,9 @@ app.Router = Backbone.Router.extend({ "posts/:id": "stream" }, - stream: function() { + stream : function() { app.stream = new app.views.Stream().render(); $("#main_stream").html(app.stream.el); } }); + diff --git a/public/javascripts/app/views/publisher_view.js b/public/javascripts/app/views/publisher_view.js index 677128054..8f645214f 100644 --- a/public/javascripts/app/views/publisher_view.js +++ b/public/javascripts/app/views/publisher_view.js @@ -22,7 +22,8 @@ app.views.Publisher = Backbone.View.extend({ "status_message" : { "text" : serializedForm["status_message[text]"] }, - "aspect_ids" : serializedForm["aspect_ids[]"] + "aspect_ids" : serializedForm["aspect_ids[]"], + "photos" : serializedForm["photos[]"] }); // clear state diff --git a/public/javascripts/app/views/stream_object_view.js b/public/javascripts/app/views/stream_object_view.js index 4a9d26913..f22990505 100644 --- a/public/javascripts/app/views/stream_object_view.js +++ b/public/javascripts/app/views/stream_object_view.js @@ -9,6 +9,9 @@ app.views.StreamObject = app.views.Base.extend({ destroyModel: function(evt){ if(evt){ evt.preventDefault(); } this.model.destroy(); - this.remove(); + + $(this.el).slideUp(400, function(){ + this.remove(); + }); } }); diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 84a01b6e0..f919c86b8 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -12,8 +12,6 @@ var Stream = { }, initializeLives: function(){ - Stream.setUpNsfwLinks(); - // reshare button action $(".reshare_button", this.selector).live("click", function(evt) { evt.preventDefault(); diff --git a/public/javascripts/widgets/aspect-navigation.js b/public/javascripts/widgets/aspect-navigation.js index dddd0d0d3..6a1430920 100644 --- a/public/javascripts/widgets/aspect-navigation.js +++ b/public/javascripts/widgets/aspect-navigation.js @@ -86,6 +86,9 @@ }; this.performAjax = function() { + window.location = self.generateURL(); // hella hax + // and fuck all this stuff VVVV + var post = $("#publisher textarea#status_message_fake_text").val(), newURL = self.generateURL(), photos = {};