From 8d853a88a377f208c711a0a4c9c9ca89d7db7f12 Mon Sep 17 00:00:00 2001 From: Raphael <raphael@joindiaspora.com> Date: Wed, 1 Dec 2010 14:41:04 -0800 Subject: [PATCH] Remove some old views, clean up routes, clean up. --- app/controllers/photos_controller.rb | 6 ---- app/controllers/requests_controller.rb | 4 --- app/controllers/services_controller.rb | 1 - app/controllers/status_messages_controller.rb | 27 ---------------- app/views/invitations/new.html.haml | 9 ------ app/views/{posts => layouts}/_debug.haml | 0 app/views/photos/new.html.haml | 13 -------- app/views/posts/_post.html.haml | 8 ----- app/views/shared/log.haml | 5 --- config/routes.rb | 31 +++++++++---------- spec/controllers/photos_controller_spec.rb | 6 ---- 11 files changed, 15 insertions(+), 95 deletions(-) delete mode 100644 app/views/invitations/new.html.haml rename app/views/{posts => layouts}/_debug.haml (100%) delete mode 100644 app/views/photos/new.html.haml delete mode 100644 app/views/posts/_post.html.haml delete mode 100644 app/views/shared/log.haml diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index d2a52e4c6e..b75aa24d10 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -9,7 +9,6 @@ class PhotosController < ApplicationController respond_to :json, :only => :show def index - @aspect = :profile @post_type = :photos @person = Person.find_by_id(params[:person_id]) @@ -96,11 +95,6 @@ class PhotosController < ApplicationController end end - def new - @photo = Photo.new - respond_with @photo - end - def destroy photo = current_user.my_posts.where(:_id => params[:id]).first diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index beb0212b2c..d1ae8cc758 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -27,10 +27,6 @@ class RequestsController < ApplicationController end end - def new - @request = Request.new - end - def create aspect = current_user.aspect_by_id(params[:request][:into]) account = params[:request][:to].strip diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index b12848d061..6f4e0fe171 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -11,7 +11,6 @@ class ServicesController < ApplicationController end def create - auth = request.env['omniauth.auth'] provider = auth['provider'] diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 093798cac2..e62c46064f 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -58,33 +58,6 @@ class StatusMessagesController < ApplicationController end end - - def index - @aspect = :profile - @post_type = :status_messages - - @person = Person.find(params[:person_id].to_id) - - if @person - @profile = @person.profile - @contact = current_user.contact_for(@person) - @is_contact = @person != current_user.person && @contact - - if @contact - @aspects_with_person = @contact.aspects - else - @pending_request = current_user.pending_requests.find_by_person_id(@person.id) - end - - @posts = current_user.visible_posts(:_type => 'StatusMessage', :person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC' - render 'people/show' - - else - flash[:error] = I18n.t 'people.show.does_not_exist' - redirect_to people_path - end - end - def destroy @status_message = current_user.my_posts.where(:_id => params[:id]).first if @status_message diff --git a/app/views/invitations/new.html.haml b/app/views/invitations/new.html.haml deleted file mode 100644 index b22e1f0c2b..0000000000 --- a/app/views/invitations/new.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h2 - = t('.send_invitation') -= form_for User.new, :url => invitation_path(User) do |f| - = devise_error_messages! - %p - = f.label :email , t('email') - = f.text_field :email - %p= f.submit t('.send_an_invitation') -/= link_to "Home", after_sign_in_path_for(resource_name) diff --git a/app/views/posts/_debug.haml b/app/views/layouts/_debug.haml similarity index 100% rename from app/views/posts/_debug.haml rename to app/views/layouts/_debug.haml diff --git a/app/views/photos/new.html.haml b/app/views/photos/new.html.haml deleted file mode 100644 index bca1d08847..0000000000 --- a/app/views/photos/new.html.haml +++ /dev/null @@ -1,13 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -- title t('.new_photo') - -= form_for( @photo, :html => {:multipart => true}) do |f| - = f.error_messages - %p - = f.file_field :image - = f.submit t('.post_it'), :class => 'button' - -%p= link_to t('.back_to_list'), photos_path diff --git a/app/views/posts/_post.html.haml b/app/views/posts/_post.html.haml deleted file mode 100644 index 5c306fa363..0000000000 --- a/app/views/posts/_post.html.haml +++ /dev/null @@ -1,8 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -%ul - %h3= link_to post.class, object_path(post) - - for field in object_fields(post) - %li= "#{field}: #{post.attributes[field]}" diff --git a/app/views/shared/log.haml b/app/views/shared/log.haml deleted file mode 100644 index 707507ff8d..0000000000 --- a/app/views/shared/log.haml +++ /dev/null @@ -1,5 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - -= @log.to_s diff --git a/config/routes.rb b/config/routes.rb index a8f0b2e879..f2444bbb02 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,12 +3,11 @@ # the COPYRIGHT file. Diaspora::Application.routes.draw do - resources :status_messages, :only => [:create, :destroy, :show] - resources :comments, :except => [:index] - resources :requests, :except => [:edit, :update] + resources :status_messages, :only => [:create, :destroy, :show] + resources :comments, :only => [:create] + resources :requests, :only => [:destroy, :create] resources :services - resources :people resources :people do resources :status_messages resources :photos @@ -18,24 +17,24 @@ Diaspora::Application.routes.draw do match '/auth/:provider/callback' => 'services#create' match 'photos/make_profile_photo' => 'photos#make_profile_photo' - resources :photos, :except => [:index] + resources :photos, :except => [:index] devise_for :users, :controllers => {:registrations => "registrations", :password => "devise/passwords", :invitations => "invitations"} # added public route to user - match 'public/:username', :to => 'users#public' - match 'getting_started', :to => 'users#getting_started', :as => 'getting_started' - match 'users/export', :to => 'users#export' - match 'users/export_photos', :to => 'users#export_photos' - match 'login', :to => 'users#sign_up' - resources :users, :except => [:create, :new, :show] - - 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 'public/:username', :to => 'users#public' + match 'getting_started', :to => 'users#getting_started', :as => 'getting_started' + match 'users/export', :to => 'users#export' + match 'users/export_photos',:to => 'users#export_photos' + match 'login', :to => 'users#sign_up' + resources :users, :except => [:create, :new, :show] + + 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, :except => [:edit] + match 'aspects/manage', :to => 'aspects#manage' + resources :aspects, :except => [:edit] #public routes match 'webfinger', :to => 'publics#webfinger' diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 939e6ef4a9..4113e7ed95 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -47,12 +47,6 @@ describe PhotosController do assigns[:person].should == user2.person assigns[:posts].should == [] end - - it 'sets the aspect to profile' do - get :index, :person_id => user.person.id.to_s - assigns[:aspect].should == :profile - end - end describe '#show' do -- GitLab