some more refactoring to routes.rb

This commit is contained in:
MrZYX 2011-03-26 17:11:25 +01:00
parent 6855447204
commit 985d79acb5
12 changed files with 126 additions and 98 deletions

View file

@ -10,7 +10,7 @@ module RequestsHelper
def new_request_link(request_count)
if request_count > 0
link_to t('requests.helper.new_requests', :count => @request_count), aspects_manage_path
link_to t('requests.helper.new_requests', :count => @request_count), manage_aspects_path
end
end
end

View file

@ -6,7 +6,7 @@
%h4
.right
= link_to t('contacts', :count => @contact_count), aspects_manage_path, :title => t('aspects.manage.manage_aspects')
= link_to t('contacts', :count => @contact_count), manage_aspects_path, :title => t('aspects.manage.manage_aspects')
= t('aspects', :count => aspects.count)

View file

@ -11,7 +11,7 @@
.conversation_controls
= link_to (image_tag('reply.png', :height => 14, :width => 14) + ' ' + t('.reply')), '#', :id => 'reply_to_conversation'
= link_to (image_tag('deletelabel.png') + ' ' + t('.delete').downcase), conversation_conversation_visibility_path(conversation), :method => 'delete', :confirm => t('are_you_sure')
= link_to (image_tag('deletelabel.png') + ' ' + t('.delete').downcase), conversation_visibility_path(conversation), :method => 'delete', :confirm => t('are_you_sure')
.span-6.avatars.last
- for participant in conversation.participants

View file

@ -34,7 +34,7 @@
%h2
= t('.notifications')
.span-13.last.left
= link_to t('.mark_all_as_read'), notifications_read_all_path, :class => 'button'
= link_to t('.mark_all_as_read'), read_all_notifications_path, :class => 'button'
.span-24.last
%ul.stream.notifications

View file

@ -29,7 +29,7 @@
- if @ownership
.photo_options{:data=>{:actor=>"#{@photo.author.owner.id}", :actor_person => "#{@photo.author.id}", :image_url => "#{@photo.url(:thumb_large)}"}}
= link_to t('.make_profile_photo'), {:controller => "photos", :action => "make_profile_photo", :photo_id => @photo.id}, :remote => true, :class => 'make_profile_photo'
= link_to t('.make_profile_photo'), {:controller => "photos", :action => "make_profile_photo", :photo_id => @photo.id}, :class => 'make_profile_photo'
|
= link_to t('.edit'), '#', :id => "edit_photo_toggle"
%br

View file

@ -117,9 +117,9 @@
#account_data.span-5.append-2
%h3
= t('.export_data')
= link_to t('.download_xml'), users_export_path, :class => "button"
= link_to t('.download_xml'), export_user_path, :class => "button"
%br
= link_to t('.download_photos'), users_export_photos_path, :class => "button"
= link_to t('.download_photos'), export_photos_user_path, :class => "button"
.span-5.last
%h3

View file

@ -3,101 +3,129 @@
# the COPYRIGHT file.
Diaspora::Application.routes.draw do
# Posting and Reading
resources :aspects do
collection do
match 'move_contact' => :move_contact
match 'add_to_aspect' => :add_to_aspect
match 'remove_from_aspect' => :remove_from_aspect
match 'manage' => :manage
end
match 'toggle_contact_visibility' => :toggle_contact_visibility
end
resources :status_messages, :only => [:new, :create, :destroy, :show]
resources :comments, :only => [:create, :destroy]
resources :requests, :only => [:destroy, :create]
resource :likes, :only => [:create]
match 'tags/:name' => 'tags#show'
resources :tags, :only => [:show]
resource :profile
match 'services/inviter/:provider' => 'services#inviter', :as => 'service_inviter'
match 'services/finder/:provider' => 'services#finder', :as => 'friend_finder'
resources :services
match 'admins/user_search' => 'admins#user_search'
match 'admins/admin_inviter' => 'admins#admin_inviter'
match 'notifications/read_all' => 'notifications#read_all'
resources :notifications, :only => [:index, :update]
resources :posts, :only => [:show], :path => '/p/'
resources :contacts
resources :aspect_memberships, :only => [:destroy, :create]
resources :conversations do
resources :messages, :only => [:create, :show]
resource :conversation_visibility, :only => [:destroy], :path => '/visibility/'
end
resources :people, :except => [:edit, :update] do
resources :status_messages
resources :photos
end
match '/people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
match '/auth/:provider/callback' => 'services#create'
match '/auth/failure' => 'services#failure'
get 'p/:id' => 'posts#show', :as => 'post'
match 'photos/make_profile_photo' => 'photos#make_profile_photo'
resources :photos, :except => [:index]
resource :user, :only => [:edit, :update, :destroy]
resources :comments, :only => [:create, :destroy]
get 'tags/:name' => 'tags#show', :as => 'tag'
resource :like, :only => [:create]
resources :conversations do
resources :messages, :only => [:create, :show]
delete 'visibility' => 'conversation_visibilities#destroy'
end
resources :notifications, :only => [:index, :update] do
get 'read_all' => :read_all, :on => :collection
end
# Users and people
resource :user, :only => [:edit, :update, :destroy], :shallow => true do
get :export
get :export_photos
end
controller :users do
get 'public/:username' => :public, :as => 'users_public'
match 'getting_started' => :getting_started, :as => 'getting_started'
get 'getting_started_completed' => :getting_started_completed
end
# This is a hack to overide a route created by devise.
# I couldn't find anything in devise to skip that route, see Bug #961
match '/users/edit' => redirect('/user/edit')
match 'users/edit' => redirect('/user/edit')
devise_for :users, :controllers => {:registrations => "registrations",
:password => "devise/passwords",
:sessions => "sessions",
:invitations => "invitations"} do
get 'invitations/resend/:id' => 'invitations#resend', :as => 'invitation_resend'
end
get 'login' => redirect('/users/sign_in')
# added public route to user
match 'public/:username', :to => 'users#public', :as => 'users_public'
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
match 'getting_started_completed', :to => 'users#getting_started_completed'
match 'users/export', :to => 'users#export'
match 'users/export_photos', :to => 'users#export_photos'
match 'login' => redirect('/users/sign_in')
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
match 'aspects/remove_from_aspect',:to => 'aspects#remove_from_aspect', :as => 'remove_from_aspect'
match 'aspects/manage', :to => 'aspects#manage'
resources :aspects do
match '/toggle_contact_visibility', :to => 'aspects#toggle_contact_visibility'
scope 'admins' do
match 'user_search' => 'admins#user_search'
match 'admin_inviter' => 'admins#admin_inviter'
end
#public routes
match 'webfinger', :to => 'publics#webfinger'
match 'hcard/users/:guid', :to => 'publics#hcard'
match '.well-known/host-meta',:to => 'publics#host_meta'
match 'receive/users/:guid', :to => 'publics#receive'
match 'hub', :to => 'publics#hub'
resource :profile
scope '/api/v0' do
match '/statuses/public_timeline', :to => 'apis#public_timeline'
match '/statuses/home_timeline', :to => 'apis#home_timeline'
match '/statuses/show/:guid', :to => 'apis#statuses'
match '/statuses/user_timeline', :to => 'apis#user_timeline'
resources :requests, :only => [:destroy, :create]
match '/users/show', :to => 'apis#users'
match '/users/search', :to => 'apis#users_search'
match '/users/profile_image', :to => 'apis#users_profile_image'
resources :contacts, :except => [:index, :update]
resources :aspect_memberships, :only => [:destroy, :create]
match '/tags_posts/:tag', :to => 'apis#tag_posts'
match '/tags_people/:tag', :to => 'apis#tag_people'
resources :people, :except => [:edit, :update] do
resources :status_messages
resources :photos
end
match 'people/by_handle' => 'people#retrieve_remote', :as => 'person_by_handle'
# Federation
controller :publics do
get 'webfinger' => :webfinger
get 'hcard/users/:guid' => :hcard
get '.well-known/host-meta' => :host_meta
get 'receive/users/:guid' => :receive
get 'hub' => :hub
end
match'localize', :to => "localize#show"
# External
resources :services, :only => [:index, :destroy]
controller :services do
match '/auth/:provider/callback' => :create
match '/auth/failure' => :failure
scope 'services' do
match 'inviter/:provider' => :inviter, :as => 'service_inviter'
match 'finder/:provider' => :finder, :as => 'friend_finder'
end
end
scope 'api/v0', :controller => :apis do
match 'statuses/public_timeline' => :public_timeline
match 'statuses/home_timeline' => :home_timeline
match 'statuses/show/:guid' => :statuses
match 'statuses/user_timeline' => :user_timeline
match 'users/show' => :users
match 'users/search' => :users_search
match 'users/profile_image' => :users_profile_image
match 'tags_posts/:tag' => :tag_posts
match 'tags_people/:tag' => :tag_people
end
# Mobile site
match 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
#root
# Startpage
root :to => 'home#show'
end

View file

@ -44,7 +44,7 @@ Feature: invitation acceptance
And I wait for the ajax to finish
When I go to the home page
Then I go to the aspects manage page
Then I go to the manage aspects page
Then I should see 1 contact in "Family"

View file

@ -12,19 +12,19 @@ Feature: sending and receiving requests
Scenario: accepting a contact request
When I sign in as "alice@alice.alice"
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact request
When I drag the contact request to the "Besties" aspect
And I wait for the ajax to finish
Then I should see 1 contact in "Besties"
When I go to the home page
Then I go to the aspects manage page
Then I go to the manage aspects page
Then I should see 1 contact in "Besties"
Then I go to the destroy user session page
When I sign in as "bob@bob.bob"
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact in "Besties"
Scenario: accepting a contact request to multiple aspects
@ -37,14 +37,14 @@ Feature: sending and receiving requests
And I wait for the ajax to finish
When I go to the home page
Then I go to the aspects manage page
Then I go to the manage aspects page
Then I should see 1 contact in "Unicorns"
Then I should see 1 contact in "Besties"
Then I go to the destroy user session page
When I sign in as "bob@bob.bob"
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact in "Besties"
@ -58,11 +58,11 @@ Feature: sending and receiving requests
And I wait for the ajax to finish
When I go to the home page
Then I go to the aspects manage page
Then I go to the manage aspects page
Then I should see 1 contact in "Super People"
Then I go to the destroy user session page
When I sign in as "bob@bob.bob"
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact in "Besties"

View file

@ -9,7 +9,7 @@ Feature: disconnecting users
And a user with email "alice@alice.alice"
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
When I sign in as "bob@bob.bob"
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact in "Besties"
@ -20,7 +20,7 @@ Feature: disconnecting users
And I follow "remove contact" in the modal window
And I wait for the ajax to finish
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see <contacts> in "Besties"
Examples:
@ -35,7 +35,7 @@ Feature: disconnecting users
And I press the first ".added" within "#facebox #aspects_list ul > li:first-child"
And I wait for the ajax to finish
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see <contacts> in "Besties"
Examples:
@ -52,7 +52,7 @@ Feature: disconnecting users
And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
And I wait for the ajax to finish
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see no contacts in "Besties"
Scenario: cancel removing contact from the contact show page
@ -64,6 +64,6 @@ Feature: disconnecting users
And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
And I wait for the ajax to finish
And I am on the aspects manage page
And I am on the manage aspects page
Then I should see 1 contact in "Besties"

View file

@ -14,7 +14,7 @@ Feature: managing contact requests
@javascript
Scenario: viewing a requests profile
When I am on the aspects manage page
When I am on the manage aspects page
When I click on the contact request
And I wait for "the requestors profile" to load
Then I should be on the requestors profile

View file

@ -42,21 +42,21 @@ describe ServicesController do
it 'creates a new OmniauthService' do
request.env['omniauth.auth'] = omniauth_auth
lambda{
post :create
post :create, :provider => 'twitter'
}.should change(@user.services, :count).by(1)
end
it 'redirects to getting started if the user is getting started' do
@user.getting_started = true
request.env['omniauth.auth'] = omniauth_auth
post :create
post :create, :provider => 'twitter'
response.should redirect_to getting_started_path(:step => 3)
end
it 'redirects to services url' do
@user.getting_started = false
request.env['omniauth.auth'] = omniauth_auth
post :create
post :create, :provider => 'twitter'
response.should redirect_to services_url
end
@ -65,7 +65,7 @@ describe ServicesController do
Service.delete_all
@user.getting_started = false
request.env['omniauth.auth'] = omniauth_auth
post :create
post :create, :provider => 'twitter'
@user.reload.services.first.class.name.should == "Services::Twitter"
end
end