From 794247d07b7d78403ab23f483330b67e494ac48e Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Fri, 21 Oct 2011 14:37:54 -0700 Subject: [PATCH] MS DG; rename soup to stream; fix a bunch of translations --- app/controllers/home_controller.rb | 2 +- app/controllers/multis_controller.rb | 7 ++++ app/controllers/soups_controller.rb | 9 ----- app/controllers/users_controller.rb | 2 +- .../interim_stream_hackiness_helper.rb | 6 +-- app/helpers/stream_helper.rb | 4 +- app/views/aspects/_aspect_stream.haml | 6 +-- app/views/aspects/index.html.haml | 6 +-- app/views/shared/_stream_element.html.haml | 2 +- app/views/tags/_followed_tags_listings.haml | 2 +- config/locales/diaspora/en.yml | 38 ++++++++++++------- config/routes.rb | 2 +- db/schema.rb | 24 +++++------- lib/stream/aspect.rb | 2 +- lib/stream/base.rb | 2 +- lib/stream/followed_tag.rb | 6 +-- lib/stream/{soup.rb => multi.rb} | 10 ++--- .../pages/{soups-index.js => multis-index.js} | 2 +- public/stylesheets/sass/application.sass | 8 ++-- spec/controllers/home_controller_spec.rb | 14 +------ .../stream/{soups_spec.rb => multi_spec.rb} | 4 +- 21 files changed, 75 insertions(+), 83 deletions(-) create mode 100644 app/controllers/multis_controller.rb delete mode 100644 app/controllers/soups_controller.rb rename lib/stream/{soup.rb => multi.rb} (90%) rename public/javascripts/pages/{soups-index.js => multis-index.js} (90%) rename spec/lib/stream/{soups_spec.rb => multi_spec.rb} (61%) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c7d7d21c0..2b677fdac 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -6,7 +6,7 @@ class HomeController < ApplicationController def show if current_user - redirect_to :controller => 'aspects', :action => 'index' + redirect_to multi_path elsif is_mobile_device? redirect_to user_session_path else diff --git a/app/controllers/multis_controller.rb b/app/controllers/multis_controller.rb new file mode 100644 index 000000000..c071d8bb2 --- /dev/null +++ b/app/controllers/multis_controller.rb @@ -0,0 +1,7 @@ +require File.join(Rails.root, 'lib', 'stream', 'multi') + +class MultisController < ApplicationController + def index + default_stream_action(Stream::Multi) + end +end diff --git a/app/controllers/soups_controller.rb b/app/controllers/soups_controller.rb deleted file mode 100644 index c44b7f3be..000000000 --- a/app/controllers/soups_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -require File.join(Rails.root, 'lib', 'stream', 'soup') - -class SoupsController < ApplicationController - #before_filter :redirect_unless_admin - - def index - default_stream_action(Stream::Soup) - end -end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b3c35c92b..b3d2e383f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -44,7 +44,7 @@ class UsersController < ApplicationController elsif u[:show_community_spotlight_in_stream] if @user.update_attributes(u) flash[:notice] = I18n.t 'users.update.settings_updated' - redirect_to soup_path + redirect_to multi_path return else flash[:notice] = I18n.t 'users.update.settings_not_updated' diff --git a/app/helpers/interim_stream_hackiness_helper.rb b/app/helpers/interim_stream_hackiness_helper.rb index 0a6f2e853..20e2a5b7a 100644 --- a/app/helpers/interim_stream_hackiness_helper.rb +++ b/app/helpers/interim_stream_hackiness_helper.rb @@ -21,15 +21,15 @@ module InterimStreamHackinessHelper end def from_group(post) - if defined?(@stream) && params[:controller]== 'soups' + if defined?(@stream) && params[:controller] == 'multis' @stream.post_from_group(post) else [] end end - def what_soup_sentence(post) - from_group(post).map{|x| x.to_s.gsub("_soup", '').gsub('_',' ').titleize}.to_sentence + def what_stream_sentence(post) + from_group(post).map{|x| I18n.t("streams.#{x.to_s}")}.to_sentence end def stream_settings_link(post) diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index 32acba7d1..d0d7d0395 100644 --- a/app/helpers/stream_helper.rb +++ b/app/helpers/stream_helper.rb @@ -16,8 +16,8 @@ module StreamHelper spotlight_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) elsif controller.instance_of?(MentionsController) mentions_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) - elsif controller.instance_of?(SoupsController) - soup_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) + elsif controller.instance_of?(MultisController) + multi_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) elsif controller.instance_of?(PostsController) public_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order]) elsif controller.instance_of?(AspectsController) diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index 7bc16bed8..0931b5bdc 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -4,11 +4,11 @@ #aspect_stream_header #sort_by - = t('.recently') + = t('streams.recently') %span.controls - = link_to_if(session[:sort_order] == 'created_at', t('.commented_on'), stream.link(:sort_order => 'updated_at')) + = 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('.posted'), stream.link(:sort_order => 'created_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/aspects/index.html.haml b/app/views/aspects/index.html.haml index 50a1903f7..70f65e198 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -16,13 +16,13 @@ .section %ul.left_nav %li - = link_to "Welcome", getting_started_path, :class => "home_selector" + = link_to t(".welcome"), getting_started_path, :class => "home_selector" .section %ul.left_nav %li %b - = link_to "Soup", soup_path, :class => 'home_selector' + = link_to t("streams.multi.title"), multi_path, :class => 'home_selector' .section = render 'aspects/aspect_listings', :stream => @stream @@ -31,7 +31,7 @@ %ul.left_nav %li %b - = link_to t('.mentions'), mentions_path, :class => 'home_selector' + = link_to t('streams.mentions.title'), mentions_path, :class => 'home_selector' .section#followed_tags_listing = render 'tags/followed_tags_listings' diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index 8fd23006c..86961fc31 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -18,7 +18,7 @@ = t('share_visibilites.update.see_it_on_their_profile', :name => person_link(post.author)).html_safe = link_to t('undo'), share_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true - .indicator{:title => "from #{what_soup_sentence(post)}"} + .indicator{:title => "#{what_stream_sentence(post)}"} = stream_settings_link(post) .sm_body diff --git a/app/views/tags/_followed_tags_listings.haml b/app/views/tags/_followed_tags_listings.haml index 7bd2e56e9..380cb25d8 100644 --- a/app/views/tags/_followed_tags_listings.haml +++ b/app/views/tags/_followed_tags_listings.haml @@ -5,7 +5,7 @@ - if user_signed_in? %ul.left_nav %li - %b=link_to t('aspects.index.tags_following'), tag_followings_path, :class => 'home_selector' + %b=link_to t('streams.followed_tag.title'), tag_followings_path, :class => 'home_selector' %ul.sub_nav - if tags.size > 0 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 7b041a69a..4c87c6fba 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -104,12 +104,6 @@ en: updating: "updating" aspect_contacts: done_editing: "done editing" - aspect_stream: - stream: "Stream" - mentions: "Mentions" - recently: "recently:" - commented_on: "commented on" - posted: "posted" show: edit_aspect: "edit aspect" no_posts_message: @@ -129,7 +123,6 @@ en: view_all_contacts: "View all contacts" no_contacts: "You don't have any contacts here yet." manage_your_aspects: "Manage your aspects." - new: name: "Name (only visible to you)" create: "Create" @@ -159,13 +152,12 @@ en: acquaintances: "Acquaintances" friends: "Friends" index: - mentions: "Mentions" + welcome: "Welcome" community_spotlight: "Community Spotlight" see_more_from_us: "See more of the D* community." donate: "Donate" keep_us_running: "Keep %{pod} running fast and buy servers their coffee fix with a monthly donation!" your_aspects: "Your Aspects" - tags_following: "Followed Tags" no_tags: "+ Find a tag to follow" unfollow_tag: "Stop following #%{tag}" handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you." @@ -833,18 +825,36 @@ 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" + followed_tags_stream: "#Followed Tags" + mentions: - title: "Your Mentions" + title: "@Mentions" contacts_title: "People who mentioned you" + + followed_tag: + title: "#Followed Tags" + contacts_title: "People who dig these tags" + tags: title: "Posts tagged: %{tags}" - contacts_title: "People who dig these tags" + contacts_title: "People who dig this tag" + public: title: "Public Activity" contacts_title: "Recent Posters" - soup: - title: "The Soup" - contacts_title: "People in your Soup" + + multi: + title: "Stream" + contacts_title: "People in your Stream" + + aspects: + title: "Your Aspects" users: logged_out: diff --git a/config/routes.rb b/config/routes.rb index a2769e779..b99f16108 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,7 +113,7 @@ Diaspora::Application.routes.draw do get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight' - get 'soup' => "soups#index", :as => 'soup' + get 'stream' => "multis#index", :as => 'multi' resources :people, :except => [:edit, :update] do resources :status_messages diff --git a/db/schema.rb b/db/schema.rb index d2242be60..510b9b755 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -32,10 +32,8 @@ ActiveRecord::Schema.define(:version => 20111021184041) do end add_index "aspect_visibilities", ["aspect_id"], :name => "index_aspect_visibilities_on_aspect_id" - add_index "aspect_visibilities", ["shareable_id", "aspect_id"], :name => "index_aspect_visibilities_on_post_id_and_aspect_id", :unique => true add_index "aspect_visibilities", ["shareable_id", "shareable_type", "aspect_id"], :name => "shareable_and_aspect_id" add_index "aspect_visibilities", ["shareable_id", "shareable_type"], :name => "index_aspect_visibilities_on_shareable_id_and_shareable_type" - add_index "aspect_visibilities", ["shareable_id"], :name => "index_aspect_visibilities_on_post_id" create_table "aspects", :force => true do |t| t.string "name", :null => false @@ -50,17 +48,17 @@ ActiveRecord::Schema.define(:version => 20111021184041) do add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id" create_table "comments", :force => true do |t| - t.text "text", :null => false - t.integer "commentable_id", :null => false - t.integer "author_id", :null => false - t.string "guid", :null => false + t.text "text", :null => false + t.integer "commentable_id", :null => false + t.integer "author_id", :null => false + t.string "guid", :null => false t.text "author_signature" t.text "parent_author_signature" t.text "youtube_titles" t.datetime "created_at" t.datetime "updated_at" - t.integer "likes_count", :default => 0, :null => false - t.string "commentable_type", :default => "Post", :null => false + t.integer "likes_count", :default => 0, :null => false + t.string "commentable_type", :limit => 60, :default => "Post", :null => false end add_index "comments", ["author_id"], :name => "index_comments_on_person_id" @@ -366,17 +364,15 @@ ActiveRecord::Schema.define(:version => 20111021184041) do add_index "services", ["user_id"], :name => "index_services_on_user_id" create_table "share_visibilities", :force => true do |t| - t.integer "shareable_id", :null => false + t.integer "shareable_id", :null => false t.datetime "created_at" t.datetime "updated_at" - t.boolean "hidden", :default => false, :null => false - t.integer "contact_id", :null => false - t.string "shareable_type", :default => "Post", :null => false + t.boolean "hidden", :default => false, :null => false + t.integer "contact_id", :null => false + t.string "shareable_type", :limit => 60, :default => "Post", :null => false end - add_index "share_visibilities", ["contact_id", "shareable_id"], :name => "index_post_visibilities_on_contact_id_and_post_id", :unique => true add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id" - add_index "share_visibilities", ["shareable_id", "hidden", "contact_id"], :name => "index_post_visibilities_on_post_id_and_hidden_and_contact_id", :unique => true add_index "share_visibilities", ["shareable_id", "shareable_type", "contact_id"], :name => "shareable_and_contact_id" add_index "share_visibilities", ["shareable_id", "shareable_type", "hidden", "contact_id"], :name => "shareable_and_hidden_and_contact_id" add_index "share_visibilities", ["shareable_id"], :name => "index_post_visibilities_on_post_id" diff --git a/lib/stream/aspect.rb b/lib/stream/aspect.rb index eaaadddb7..0cf4ce668 100644 --- a/lib/stream/aspect.rb +++ b/lib/stream/aspect.rb @@ -81,7 +81,7 @@ class Stream::Aspect < Stream::Base # @return [String] def title if self.for_all_aspects? - I18n.t('aspects.aspect_stream.stream') + I18n.t('streams.aspects.title') else self.aspects.to_sentence end diff --git a/lib/stream/base.rb b/lib/stream/base.rb index adff88592..036a0315e 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -5,7 +5,7 @@ class Stream::Base def initialize(user, opts={}) self.user = user self.max_time = opts[:max_time] - self.order = opts[:order] + self.order = opts[:order] end # @return [Person] diff --git a/lib/stream/followed_tag.rb b/lib/stream/followed_tag.rb index 40a69b817..ab983f24a 100644 --- a/lib/stream/followed_tag.rb +++ b/lib/stream/followed_tag.rb @@ -9,7 +9,7 @@ class Stream::FollowedTag < Stream::Base end def title - I18n.t('aspects.index.tags_following') + I18n.t('streams.followed_tag.title') end # @return [ActiveRecord::Association] AR association of posts @@ -19,11 +19,9 @@ class Stream::FollowedTag < Stream::Base end def contacts_title - I18n.translate('streams.tags.contacts_title') + I18n.translate('streams.followed_tag.contacts_title') end - - private def tag_string diff --git a/lib/stream/soup.rb b/lib/stream/multi.rb similarity index 90% rename from lib/stream/soup.rb rename to lib/stream/multi.rb index e2b301f44..406ca07ed 100644 --- a/lib/stream/soup.rb +++ b/lib/stream/multi.rb @@ -1,14 +1,14 @@ -class Stream::Soup < Stream::Base +class Stream::Multi < Stream::Base def link(opts) - Rails.application.routes.url_helpers.soup_path + Rails.application.routes.url_helpers.multi_path end def title - I18n.t('streams.soup.title') + I18n.t('streams.multi.title') end def contacts_title - I18n.t('streams.soup.contacts_title') + I18n.t('streams.multi.contacts_title') end def posts @@ -35,7 +35,7 @@ class Stream::Soup < Stream::Base def is_in?(sym, post) if self.send("#{sym.to_s}_post_ids").find{|x| x == post.id} - "#{sym.to_s}_soup".to_sym + "#{sym.to_s}_stream".to_sym end end diff --git a/public/javascripts/pages/soups-index.js b/public/javascripts/pages/multis-index.js similarity index 90% rename from public/javascripts/pages/soups-index.js rename to public/javascripts/pages/multis-index.js index 1b3845af8..b583f5668 100644 --- a/public/javascripts/pages/soups-index.js +++ b/public/javascripts/pages/multis-index.js @@ -1,4 +1,4 @@ -Diaspora.Pages.SoupsIndex = function() { +Diaspora.Pages.MultisIndex = function() { var self = this; this.subscribe("page/ready", function(evt, document) { diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index c5cc8d060..0e0060389 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -3507,15 +3507,15 @@ ul#getting_started :padding 0 :margin 0 -.community_spotlight_soup +.community_spotlight_stream .indicator :background-color #DE5099 -.followed_tags_soup +.followed_tags_stream .indicator :background-color $blue -.aspects_soup +.aspects_stream .indicator :background-color $green -.mentioned_soup +.mentioned_stream .indicator :background-color #E3E856 diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index aa9560e9d..789f57205 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -12,20 +12,10 @@ describe HomeController do response.should_not be_redirect end - it 'redirects to aspects index if user is logged in' do + it 'redirects to multis index if user is logged in' do sign_in alice get :show, :home => true - response.should redirect_to( :controller => 'aspects', :action => 'index') - end - - it 'redirects to aspects index with stored aspects' do - sign_in alice - @aspect0 = alice.aspects.all[0] - @aspect1 = alice.aspects.create(:name => "Yeaaaah!") - @index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]} - alice.save - get :show - response.should redirect_to( :controller => 'aspects', :action => 'index') + response.should redirect_to(multi_path) end describe "custom logging on success" do diff --git a/spec/lib/stream/soups_spec.rb b/spec/lib/stream/multi_spec.rb similarity index 61% rename from spec/lib/stream/soups_spec.rb rename to spec/lib/stream/multi_spec.rb index ad92f9110..b5bbcb9d5 100644 --- a/spec/lib/stream/soups_spec.rb +++ b/spec/lib/stream/multi_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream') -describe Stream::Soup do +describe Stream::Multi do before do - @stream = Stream::Soup.new(Factory(:user), :max_time => Time.now, :order => 'updated_at') + @stream = Stream::Multi.new(Factory(:user), :max_time => Time.now, :order => 'updated_at') end describe 'shared behaviors' do -- GitLab