Skip to content

Commit

Permalink
change routes to properly reflect page names (activity/stream).
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrippi committed Feb 14, 2012
1 parent e248733 commit f3f2b8c
Show file tree
Hide file tree
Showing 37 changed files with 64 additions and 62 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def set_locale

def redirect_unless_admin
unless current_user.admin?
redirect_to explore_url, :notice => 'you need to be an admin to do that'
redirect_to stream_url, :notice => 'you need to be an admin to do that'
return
end
end
Expand Down Expand Up @@ -116,7 +116,7 @@ def grammatical_gender
end

def after_sign_in_path_for(resource)
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : explore_path)
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : stream_path)
end

def max_time
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class HomeController < ApplicationController

def show
if current_user
redirect_to explore_path if current_user
redirect_to stream_path if current_user
elsif is_mobile_device?
redirect_to user_session_path
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def index
def read_all
Notification.where(:recipient_id => current_user.id).update_all(:unread => false)
respond_to do |format|
format.html { redirect_to explore_path }
format.html { redirect_to stream_path }
format.xml { render :xml => {}.to_xml }
format.json { render :json => {}.to_json }
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def destroy
respond_to do |format|
format.js {render 'destroy'}
format.json { render :nothing => true, :status => 204 }
format.all {redirect_to explore_path}
format.all {redirect_to stream_path}
end
else
Rails.logger.info "event=post_destroy status=failure user=#{current_user.diaspora_handle} reason='User does not own post'"
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/status_messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def create

respond_to do |format|
format.html { redirect_to :back}
format.mobile{ redirect_to explore_path}
format.mobile{ redirect_to stream_path}
format.json{ render :json => @status_message.as_api_response(:backbone), :status => 201 }
end
else
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/streams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require File.join(Rails.root, "lib", "stream", "likes")
require File.join(Rails.root, "lib", "stream", "mention")
require File.join(Rails.root, "lib", "stream", "followed_tag")
require File.join(Rails.root, "lib", "stream", "participate")
require File.join(Rails.root, "lib", "stream", "activity")


class StreamsController < ApplicationController
Expand All @@ -31,8 +31,8 @@ def public
stream_responder(Stream::Public)
end

def participate
stream_responder(Stream::Participate)
def activity
stream_responder(Stream::Activity)
end

def multi
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tag_followings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ def create_multiple
@tag_following = current_user.tag_followings.create(:tag_id => @tag.id)
end
end
redirect_to explore_path
redirect_to stream_path
end
end
8 changes: 4 additions & 4 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def destroy
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
current_user.close_account!
sign_out current_user
redirect_to(explore_path, :notice => I18n.t('users.destroy.success'))
redirect_to(stream_path, :notice => I18n.t('users.destroy.success'))
else
if params[:user].present? && params[:user][:current_password].present?
flash[:error] = t 'users.destroy.wrong_password'
Expand All @@ -111,7 +111,7 @@ def public
format.any { redirect_to person_path(user.person) }
end
else
redirect_to explore_path, :error => I18n.t('users.public.does_not_exist', :username => params[:username])
redirect_to stream_path, :error => I18n.t('users.public.does_not_exist', :username => params[:username])
end
end

Expand All @@ -127,14 +127,14 @@ def getting_started
def logged_out
@page = :logged_out
if user_signed_in?
redirect_to explore_path
redirect_to stream_path
end
end

def getting_started_completed
user = current_user
user.update_attributes(:getting_started => false)
redirect_to explore_path
redirect_to stream_path
end

def export
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/stream_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def next_page_path(opts ={})
elsif controller.instance_of?(PostsController)
public_stream_path(:max_time => time_for_scroll(@stream))
elsif controller.instance_of?(StreamsController)
explore_path(:max_time => time_for_scroll(@stream))
stream_path(:max_time => time_for_scroll(@stream))
else
raise 'in order to use pagination for this new controller, update next_page_path in stream helper'
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.mobile.haml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
.navbar.navbar-fixed-top
.navbar-inner
.container{:style => "position: relative;"}
= link_to(image_tag('header-logo2x.png', :height => 40, :width => 40, :id => 'header_title'), explore_path)
= link_to(image_tag('header-logo2x.png', :height => 40, :width => 40, :id => 'header_title'), stream_path)
- if user_signed_in?
.right
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/main_stream.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
.section
%ul.left_nav
%li
= link_to t("streams.participate.title"), participate_path, :class => 'home_selector', :rel => 'backbone'
= link_to t("streams.activity.title"), activity_stream_path, :class => 'home_selector', :rel => 'backbone'

This comment has been minimized.

Copy link
@dmorley

dmorley Feb 15, 2012

Contributor

getting a ActionView::Template::Error (undefined local variable or method `activity_stream_path' for #<#Class:0x00000008851918:0x00000008d3a358>): on this activity_stream_path

%ul.left_nav.sub
%li
Expand All @@ -41,7 +41,7 @@

%ul.left_nav
%li
= link_to t("streams.multi.title"), explore_path, :class => 'home_selector', :rel => 'backbone'
= link_to t("streams.multi.title"), stream_path, :class => 'home_selector', :rel => 'backbone'

= render 'aspects/aspect_listings', :stream => @stream

Expand Down
2 changes: 1 addition & 1 deletion app/views/users/logged_out.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%h4
= t('.simply_visit')
%strong
= link_to AppConfig[:pod_url], explore_path
= link_to AppConfig[:pod_url], stream_path
= t('.on_your_mobile_device')

%p.dull
Expand Down
5 changes: 2 additions & 3 deletions config/locales/diaspora/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -927,14 +927,13 @@ en:

multi:
title: "Stream"
contacts_title: "People in your Explore Stream"
contacts_title: "People in your Stream"

aspects:
title: "My Aspects"

participate:
activity:
title: "My Activity"

users:
logged_out:
signed_out: "You've signed out of Diaspora*"
Expand Down
7 changes: 5 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
end

# Streams
get "participate" => "streams#participate", :as => "participate"
get "explore" => "streams#multi", :as => "explore"
get "participate" => "streams#activity", :as => "activity_stream" # legacy
get "explore" => "streams#multi", :as => "stream" # legacy

get "activity" => "streams#activity", :as => "activity_stream"
get "stream" => "streams#multi", :as => "stream"
get "public" => "streams#public", :as => "public_stream"
get "followed_tags" => "streams#followed_tags", :as => "followed_tags_stream"
get "mentions" => "streams#mentioned", :as => "mentioned_stream"
Expand Down
4 changes: 2 additions & 2 deletions features/accepts_invitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: invitation acceptance

And I preemptively confirm the alert
And I follow "awesome_button"
Then I should be on the explore page
Then I should be on the stream page

Scenario: accept invitation from user
Given I have been invited by a user
Expand All @@ -34,7 +34,7 @@ Feature: invitation acceptance

And I preemptively confirm the alert
And I follow "awesome_button"
Then I should be on the explore page
Then I should be on the stream page

Scenario: sends an invitation
Given a user with email "bob@bob.bob"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@javascript
Feature: The participate stream
Feature: The activity stream
Scenario: Sorting
Given a user with username "bob"
When I sign in as "bob@bob.bob"
Expand All @@ -8,7 +8,7 @@ Feature: The participate stream
And I post "B- barack obama is your new bicycle"
And I post "C- barack obama is a square"

When I go to the participate page
When I go to the activity stream page
Then "C- barack obama is a square" should be post 1
And "B- barack obama is your new bicycle" should be post 2
And "A- I like turtles" should be post 3
Expand All @@ -20,7 +20,7 @@ Feature: The participate stream
And I like the post "B- barack obama is your new bicycle"
And I wait for 1 second

When I go to the participate page
When I go to the activity stream page
Then "B- barack obama is your new bicycle" should be post 1
And "C- barack obama is a square" should be post 2
And "A- I like turtles" should be post 3
2 changes: 1 addition & 1 deletion features/change_password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Change password
Then I should see "Password changed"
Then I should be on the new user session page
When I sign in with password "newsecret"
Then I should be on the explore page
Then I should be on the stream page

Scenario: Reset my password
Given a user with email "forgetful@users.net"
Expand Down
4 changes: 2 additions & 2 deletions features/logs_in_and_out.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: user authentication
And I fill in "Username" with "ohai"
And I fill in "Password" with "secret"
And I press "Sign in"
Then I should be on the explore page
Then I should be on the stream page

@javascript
Scenario: user logs out
Expand All @@ -19,5 +19,5 @@ Feature: user authentication
Scenario: user uses token auth
Given a user with username "ohai" and password "secret"
When I post a photo with a token
And I go to the explore page
And I go to the stream page
Then I should be on the new user session page
6 changes: 3 additions & 3 deletions features/signs_up.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ Feature: new user registration
And I preemptively confirm the alert
And I follow "awesome_button"

Then I should be on the explore page
Then I should be on the stream page
And I should not see "awesome_button"

Scenario: new user skips the setup wizard
When I preemptively confirm the alert
And I follow "awesome_button"
Then I should be on the explore page
Then I should be on the stream page

Scenario: closing a popover clears getting started
When I preemptively confirm the alert
And I follow "awesome_button"
Then I should be on the explore page
Then I should be on the stream page
And I have turned off jQuery effects
And I wait for the popovers to appear
And I click close on all the popovers
Expand Down
2 changes: 1 addition & 1 deletion features/support/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module NavigationHelpers
def path_to(page_name)
case page_name
when /^the home(?: )?page$/
explore_path
stream_path
when /^step (\d)$/
if $1.to_i == 1
getting_started_path
Expand Down
6 changes: 3 additions & 3 deletions lib/stream/participate.rb → lib/stream/activity.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class Stream::Participate < Stream::Base
class Stream::Activity < Stream::Base
def link(opts={})
Rails.application.routes.url_helpers.participate_path(opts)
Rails.application.routes.url_helpers.activity_streams_path(opts)
end

def order
"interacted_at"
end

def title
I18n.translate("streams.participate.title")
I18n.translate("streams.activity.title")
end

# @return [ActiveRecord::Association<Post>] AR association of posts
Expand Down
2 changes: 1 addition & 1 deletion lib/stream/multi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Stream::Multi < Stream::Base

# @return [String] URL
def link(opts)
Rails.application.routes.url_helpers.explore_path(opts)
Rails.application.routes.url_helpers.stream_path(opts)
end

# @return [String]
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/app/models/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ app.models.Stream = Backbone.Collection.extend({
},

sortOrder : function() {
return this.basePath().match(/participate/) ? "interactedAt" : "createdAt"
return this.basePath().match(/activity/) ? "interactedAt" : "createdAt"
},

add : function(models){
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/app/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app.Router = Backbone.Router.extend({
routes: {
"participate": "stream",
"explore": "stream",
"activity": "stream",
"stream": "stream",
"aspects:query": "stream",
"commented": "stream",
"liked": "stream",
Expand Down
6 changes: 3 additions & 3 deletions public/javascripts/app/templates/header.handlebars
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div class="container" style="position:relative;">

<a href="/explore">
<a href="/stream">
<img alt="Logo_small" class="diaspora_header_logo" height="38px" width="65px" src="{{imageUrl "/images/header-logo.png"}}" />
</a>

<span class="header-nav">
<span>
<a href="/explore">
<a href="/stream">
{{t "my_stream"}}
</a>
</span>

<span>
<a href="/participate">
<a href="/activity">
{{t "my_activity"}}
</a>
</span>
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/admins_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
context 'admin not signed in' do
it 'is behind redirect_unless_admin' do
get :user_search
response.should redirect_to explore_path
response.should redirect_to stream_path
end
end

Expand Down Expand Up @@ -64,7 +64,7 @@
context 'admin not signed in' do
it 'is behind redirect_unless_admin' do
get :admin_inviter
response.should redirect_to explore_path
response.should redirect_to stream_path
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/home_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
it 'redirects to multis index if user is logged in' do
sign_in alice
get :show, :home => true
response.should redirect_to(explore_path)
response.should redirect_to(stream_path)
end
end
end
Loading

0 comments on commit f3f2b8c

Please sign in to comment.