diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e533c4f475f1f606966aa3dd42f33697eb889f5f..887e78df31e4676488e55881dc295258c091e5f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -135,16 +135,6 @@ class ApplicationController < ActionController::Base @tags ||= current_user.followed_tags end - def save_sort_order - if params[:sort_order].present? - session[:sort_order] = (params[:sort_order] == 'created_at') ? 'created_at' : 'updated_at' - elsif session[:sort_order].blank? - session[:sort_order] = 'created_at' - else - session[:sort_order] = (session[:sort_order] == 'created_at') ? 'created_at' : 'updated_at' - end - end - # @param stream_klass [Constant] # @return [String] JSON representation of posts given a [Stream] constant. def stream_json(stream_klass) @@ -153,9 +143,7 @@ class ApplicationController < ActionController::Base def stream(stream_klass) authenticate_user! - save_sort_order - - stream_klass.new(current_user, :max_time => max_time, :order => sort_order) + stream_klass.new(current_user, :max_time => max_time) end def default_stream_action(stream_klass) @@ -168,10 +156,6 @@ class ApplicationController < ActionController::Base end end - def sort_order - is_mobile_device? ? 'created_at' : session[:sort_order] - end - def max_time params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now end diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 27967bf3915b57121746328285dce4f8522c0fc4..75dc75eb922cea9c5e3e1ff286362c4ed695176a 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -6,7 +6,6 @@ require File.join(Rails.root, "lib", 'stream', "aspect") class AspectsController < ApplicationController before_filter :authenticate_user! - before_filter :save_sort_order, :only => :index before_filter :save_selected_aspects, :only => :index before_filter :ensure_page, :only => :index @@ -14,11 +13,8 @@ class AspectsController < ApplicationController respond_to :json, :only => [:show, :create, :index] def index - #@backbone = true - aspect_ids = (session[:a_ids] ? session[:a_ids] : []) @stream = Stream::Aspect.new(current_user, aspect_ids, - :order => sort_order, :max_time => params[:max_time].to_i) respond_with do |format| diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index 83561dfb6a791d4288fcf6f4acb51a3e7815243e..0440f60a2b927157053c5166ab6c118ab886e423 100644 --- a/app/helpers/stream_helper.rb +++ b/app/helpers/stream_helper.rb @@ -11,21 +11,21 @@ module StreamHelper elsif controller.instance_of?(PeopleController) local_or_remote_person_path(@person, :max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(TagFollowingsController) - tag_followings_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + tag_followings_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(CommunitySpotlightController) - spotlight_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + spotlight_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(MentionsController) - mentions_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + mentions_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(MultisController) - multi_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + multi_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(PostsController) - public_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + public_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(AspectsController) - aspects_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :a_ids => @stream.aspect_ids, :sort_order => session[:sort_order]) + aspects_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :a_ids => @stream.aspect_ids) elsif controller.instance_of?(LikeStreamController) - like_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + like_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) elsif controller.instance_of?(CommentStreamController) - comment_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + comment_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream)) else raise 'in order to use pagination for this new controller, update next_page_path in stream helper' end @@ -40,11 +40,7 @@ module StreamHelper end def time_for_sort(post) - if controller.instance_of?(AspectsController) - post.send(session[:sort_order].to_sym) - else - post.created_at - end + post.created_at end def comments_expanded diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index bfd2cc43d2db491488822f81b8272a515b0d0215..3d645cf1c03482f451934f2e88050750514b49ef 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -6,16 +6,17 @@ %li.all_aspects .root_element= link_to t('aspects.index.your_aspects'), aspects_path - %ul.sub_nav - - if defined?(stream) - %a.toggle_selector{:href => '#'} - = stream.for_all_aspects? ? t('.deselect_all') : t('.select_all') - - for aspect in all_aspects - %li{:data => {:aspect_id => aspect.id}, :class => ("active" if defined?(stream) && stream.aspect_ids.include?(aspect.id))} - .edit - = link_to image_tag("icons/pencil.png", :title => t('.edit_aspect', :name => aspect.name)), edit_aspect_path(aspect), :rel => "facebox" - %a.aspect_selector{:href => aspects_path("a_ids[]" => aspect.id), :class => "name", 'data-guid' => aspect.id} - = aspect + - if @stream.is_a?(Stream::Aspect) + %ul.sub_nav + - if defined?(stream) + %a.toggle_selector{:href => '#'} + = stream.for_all_aspects? ? t('.deselect_all') : t('.select_all') + - for aspect in all_aspects + %li{:data => {:aspect_id => aspect.id}, :class => ("active" if defined?(stream) && stream.aspect_ids.include?(aspect.id))} + .edit + = link_to image_tag("icons/pencil.png", :title => t('.edit_aspect', :name => aspect.name)), edit_aspect_path(aspect), :rel => "facebox" + %a.aspect_selector{:href => aspects_path("a_ids[]" => aspect.id), :class => "name", 'data-guid' => aspect.id} + = aspect - %li - = link_to t('.add_an_aspect'), new_aspect_path, :class => "new_aspect", :rel => "facebox" + %li + = link_to t('.add_an_aspect'), new_aspect_path, :class => "new_aspect", :rel => "facebox" diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index 2fd6627935a98d49c2e7c9be143078f6c24d67f8..5ac91a4ff2d6a279951877a42296443b26a05717 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -3,13 +3,6 @@ -# the COPYRIGHT file. #aspect_stream_header - #sort_by - = t('streams.recently') - %span.controls - = link_to_if(session[:sort_order] == 'created_at', t('streams.commented_on'), stream.link(:sort_order => 'updated_at')) - · - = link_to_if(session[:sort_order] == 'updated_at', t('streams.posted'), stream.link(:sort_order => 'created_at' )) - %h3 = stream.title diff --git a/app/views/tags/_followed_tags_listings.haml b/app/views/tags/_followed_tags_listings.haml index ff19f21d94017a3ce5fc4273e4e09d3e6b5664de..30bed3e9feec8cd240ec24f02b3a9d9f51f1cd02 100644 --- a/app/views/tags/_followed_tags_listings.haml +++ b/app/views/tags/_followed_tags_listings.haml @@ -7,14 +7,15 @@ %li %b=link_to t('streams.followed_tag.title'), tag_followings_path, :class => 'home_selector' - %ul.sub_nav - - if tags.size > 0 - - for tg in tags - %li.unfollow{:id => "tag-following-#{tg.name}"} - .unfollow_icon.hidden - = link_to image_tag("icons/monotone_close_exit_delete.png", :height => 16, :title => t('aspects.index.unfollow_tag', :tag => tg.name)), tag_tag_followings_path(:name => tg.name, :remote => true), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :id => "unfollow_" + tg.name - = link_to "##{tg.name}", tag_path(:name => tg.name), :class => "tag_selector" - %li - = form_for TagFollowing.new do |tg| - = text_field_tag :name, "", :class => "tag_input", :placeholder => t('streams.followed_tag.add_a_tag') - = tg.submit t('streams.followed_tag.follow'), :class => "button hidden" + - if @stream.is_a?(Stream::FollowedTag) + %ul.sub_nav + - if tags.size > 0 + - for tg in tags + %li.unfollow{:id => "tag-following-#{tg.name}"} + .unfollow_icon.hidden + = link_to image_tag("icons/monotone_close_exit_delete.png", :height => 16, :title => t('aspects.index.unfollow_tag', :tag => tg.name)), tag_tag_followings_path(:name => tg.name, :remote => true), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :id => "unfollow_" + tg.name + = link_to "##{tg.name}", tag_path(:name => tg.name), :class => "tag_selector" + %li + = form_for TagFollowing.new do |tg| + = text_field_tag :name, "", :class => "tag_input", :placeholder => t('streams.followed_tag.add_a_tag') + = tg.submit t('streams.followed_tag.follow'), :class => "button hidden" diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 2512a3dd1660802ab7e5c34c26e8e0967db37ec8..8c22e3ae126424d0276b6744b886c6a479f4c65a 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -881,9 +881,6 @@ en: no_applications: "You haven't registered any applications yet." streams: - recently: "recently:" - commented_on: "commented on" - posted: "posted" community_spotlight_stream: "Community Spotlight" aspects_stream: "Aspects" mentioned_stream: "@Mentions" diff --git a/lib/stream/base.rb b/lib/stream/base.rb index 9631521b8a00e7b1fc64c24da2a9239874ea6e07..6332915b28ba0155dd44eb3976078a56e75fa536 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -86,7 +86,7 @@ class Stream::Base true end - #NOTE: MBS bad bad methods the fact we need these means our views are foobared. please kill them and make them + #NOTE: MBS bad bad methods the fact we need these means our views are foobared. please kill them and make them #private methods on the streams that need them def aspects user.aspects @@ -98,7 +98,7 @@ class Stream::Base end def aspect_ids - aspects.map{|x| x.id} + aspects.map{|x| x.id} end def max_time=(time_string) diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index e1870ccf5c0e25e9da003c8da6f20df66128a622..5d5581efa2996e7ea3fa851e7de1388fddf5e24d 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -2414,17 +2414,6 @@ ul.show_comments, :color #eee :border 1px solid #ccc -#sort_by - :float right - :color #777 - .controls - :font - :weight 700 - a - :font - :weight normal - - #remember_me input[type='checkbox'] :display inline diff --git a/spec/helpers/stream_helper_spec.rb b/spec/helpers/stream_helper_spec.rb index 2c794a0b43e870cf08f315b64f6cb28aaf2b9a34..8cefe4fdebbec8f86a6ed2456e2d6d614ec82a69 100644 --- a/spec/helpers/stream_helper_spec.rb +++ b/spec/helpers/stream_helper_spec.rb @@ -8,15 +8,9 @@ describe StreamHelper do before do @post = Factory(:status_message) end + describe "#time_for_sort" do - it "returns sort_order for an aspectscontroller" do - sort_order = :stored_in_session - stub!(:controller).and_return(AspectsController.new) - stub!(:session).and_return({:sort_order => sort_order}) - @post.should_receive(sort_order) - time_for_sort(@post) - end - it "returns post.created_at otherwise" do + it "returns post.created_at" do stub!(:controller).and_return(mock()) time_for_sort(@post).should == @post.created_at end