diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 15f6f33117f22d22070f54ef8ad0da8ae5c22ea7..35b2c4f2dc4c1efc34b036882978d9982ce7b2ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -138,8 +138,19 @@ 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 + def default_stream_action(stream_klass) authenticate_user! + save_sort_order @stream = stream_klass.new(current_user, :max_time => max_time, :order => sort_order) if params[:only_posts] diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 86d2ebc7126a36bd7880d8f89156186d6c1773cf..5ca11fa677cdef6f407155a2600f3616f8c4a2be 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -6,6 +6,7 @@ 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 diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index 8f3788f54f1866cb4c0944de19426f7cca076802..5ef3067a7d7cfbdf35aebac1d5bb7929335f8521 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -3,6 +3,13 @@ -# 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/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 3abf5a868c1296827c3ef6667fb40662a2cedd82..3d3728fef3d4f5f89fbe622835e11a9137561611 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -845,7 +845,10 @@ en: no_applications: "You haven't registered any applications yet." streams: - community_spotlight_stream: "Community Spotlight" + recently: "recently:" + commented_on: "commented on" + posted: "posted" + community_spotlight_stream: "Community Spotlight" aspects_stream: "Aspects" mentioned_stream: "@Mentions" followed_tags_stream: "#Followed Tags"