diff options
| author | mo khan <mo@mokhan.ca> | 2014-05-21 22:09:46 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-05-21 22:09:46 -0600 |
| commit | 5ab3e5c158fcddda38727892708b488b9c423709 (patch) | |
| tree | aaf3df59dd0043bacad63dd32eba4478e32c4787 | |
| parent | 959bd343e0bae6a06bf1a04c41c58401dea8eec3 (diff) | |
move favorites to my/favorites.
| -rw-r--r-- | app/controllers/my/favorites_controller.rb | 9 | ||||
| -rw-r--r-- | app/controllers/profiles_controller.rb | 6 | ||||
| -rw-r--r-- | app/views/my/favorites/index.html.erb (renamed from app/views/profiles/favorites.html.erb) | 0 | ||||
| -rw-r--r-- | app/views/shared/_account_nav.html.erb | 2 | ||||
| -rw-r--r-- | config/routes.rb | 6 | ||||
| -rw-r--r-- | spec/routing/my/favorites_routing_spec.rb | 9 | ||||
| -rw-r--r-- | spec/routing/profiles_routing_spec.rb | 5 |
7 files changed, 23 insertions, 14 deletions
diff --git a/app/controllers/my/favorites_controller.rb b/app/controllers/my/favorites_controller.rb new file mode 100644 index 00000000..007775c4 --- /dev/null +++ b/app/controllers/my/favorites_controller.rb @@ -0,0 +1,9 @@ +module My + class FavoritesController < BaseController + def index + @user = current_user + @favorites = current_user.favorites.includes(:creation) + @creations = @favorites.map {|f| f.creation } + end + end +end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 0c160063..75f3d388 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -12,10 +12,4 @@ class ProfilesController < ApplicationController @nearby_users = @user.nearbys(50) || [] expires_in(1.hour) end - - def favorites - @user = current_user - @favorites = current_user.favorites.includes(:creation) - @creations = @favorites.map {|f| f.creation } - end end diff --git a/app/views/profiles/favorites.html.erb b/app/views/my/favorites/index.html.erb index 06f9a77e..06f9a77e 100644 --- a/app/views/profiles/favorites.html.erb +++ b/app/views/my/favorites/index.html.erb diff --git a/app/views/shared/_account_nav.html.erb b/app/views/shared/_account_nav.html.erb index 3f59283c..dc826254 100644 --- a/app/views/shared/_account_nav.html.erb +++ b/app/views/shared/_account_nav.html.erb @@ -3,7 +3,7 @@ <ul class="nav nav-tabs"> <li class="<%= selected == :dashboard ? "active" : "" %>"><%= link_to "Dashboard", my_dashboard_path %></li> <li class="<%= selected == :creations ? "active" : "" %>"><%= link_to "Creations", my_cakes_path %></li> - <li class="<%= selected == :favorites ? "active" : "" %>"><%= link_to "Favorites", profiles_favorites_path %></li> + <li class="<%= selected == :favorites ? "active" : "" %>"><%= link_to "Favorites", my_favorites_path %></li> <li class="<%= selected == :basic_info ? "active" : "" %>"><%= link_to "Settings", settings_path %></li> <li class="<%= selected == :password ? "active" : "" %>"><%= link_to "Password", pwd_path %></li> <li class="<%= selected == :picture ? "active" : "" %>"><%= link_to "Picture", edit_avatar_path(current_user) %></li> diff --git a/config/routes.rb b/config/routes.rb index c330d7f2..3a46f05b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,7 +22,7 @@ Cake::Application.routes.draw do resources :profiles, :only => [:index, :show] do get 'page/:page', :action => :index, :on => :collection end - get 'favorites' => 'profiles#favorites', :as => 'profiles_favorites' + #get 'favorites' => 'profiles#favorites', :as => 'profiles_favorites' # /categories get 'categories/:slug' => "categories#show", :as => :category @@ -68,7 +68,7 @@ Cake::Application.routes.draw do namespace :my do get 'dashboard', to: 'dashboard#index' - resources :cakes do - end + resources :cakes, only: [:index] + resources :favorites, only: [:index] end end diff --git a/spec/routing/my/favorites_routing_spec.rb b/spec/routing/my/favorites_routing_spec.rb new file mode 100644 index 00000000..b3540182 --- /dev/null +++ b/spec/routing/my/favorites_routing_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe My::FavoritesController do + describe "routing" do + it "routes to my favorites" do + get("/my/favorites").should route_to("my/favorites#index") + end + end +end diff --git a/spec/routing/profiles_routing_spec.rb b/spec/routing/profiles_routing_spec.rb index b198dd8e..c44d7b87 100644 --- a/spec/routing/profiles_routing_spec.rb +++ b/spec/routing/profiles_routing_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' + describe ProfilesController do describe "routing" do it "routes to index" do @@ -8,9 +9,5 @@ describe ProfilesController do it "routes to #show" do get("/profiles/1").should route_to("profiles#show", :id => "1") end - - it "routes to my favorites" do - get("/favorites").should route_to("profiles#favorites") - end end end |
