diff options
| author | mo khan <mo@mokhan.ca> | 2014-05-21 22:00:04 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-05-21 22:00:04 -0600 |
| commit | 959bd343e0bae6a06bf1a04c41c58401dea8eec3 (patch) | |
| tree | 740d2a9d30c24c6ae147a998339b6919228b7e22 | |
| parent | 802e38c704c8a2534a4d489ff18d14e62460c437 (diff) | |
move dashboard to my/dashboard.
| -rw-r--r-- | app/controllers/dashboard_controller.rb | 8 | ||||
| -rw-r--r-- | app/controllers/my/dashboard_controller.rb | 8 | ||||
| -rw-r--r-- | app/controllers/tutorials_controller.rb | 4 | ||||
| -rw-r--r-- | app/views/layouts/_header.html.erb | 2 | ||||
| -rw-r--r-- | app/views/my/dashboard/_creation.html.erb (renamed from app/views/dashboard/_creation.html.erb) | 0 | ||||
| -rw-r--r-- | app/views/my/dashboard/_tutorial.html.erb (renamed from app/views/dashboard/_tutorial.html.erb) | 0 | ||||
| -rw-r--r-- | app/views/my/dashboard/index.html.erb (renamed from app/views/dashboard/index.html.erb) | 0 | ||||
| -rw-r--r-- | app/views/notification_mailer/notification_email.html.erb | 2 | ||||
| -rw-r--r-- | app/views/notification_mailer/notification_email.text.erb | 2 | ||||
| -rw-r--r-- | app/views/photos/_form.html.erb | 2 | ||||
| -rw-r--r-- | app/views/shared/_account_nav.html.erb | 2 | ||||
| -rw-r--r-- | config/routes.rb | 2 | ||||
| -rw-r--r-- | spec/controllers/my/dashboard_controller_spec.rb (renamed from spec/controllers/dashboard_controller_spec.rb) | 2 | ||||
| -rw-r--r-- | spec/controllers/tutorials_controller_spec.rb | 4 |
14 files changed, 19 insertions, 19 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb deleted file mode 100644 index 4bf4e070..00000000 --- a/app/controllers/dashboard_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class DashboardController < ApplicationController - before_filter :authenticate_user! - - def index - @items = (current_user.creations + current_user.tutorials).sort_by! { |x| x.created_at }.reverse - @activities = current_user.recent_activities - end -end diff --git a/app/controllers/my/dashboard_controller.rb b/app/controllers/my/dashboard_controller.rb new file mode 100644 index 00000000..53d9a378 --- /dev/null +++ b/app/controllers/my/dashboard_controller.rb @@ -0,0 +1,8 @@ +module My + class DashboardController < BaseController + def index + @items = (current_user.creations + current_user.tutorials).sort_by! { |x| x.created_at }.reverse + @activities = current_user.recent_activities + end + end +end diff --git a/app/controllers/tutorials_controller.rb b/app/controllers/tutorials_controller.rb index c133c891..1123b8d0 100644 --- a/app/controllers/tutorials_controller.rb +++ b/app/controllers/tutorials_controller.rb @@ -24,7 +24,7 @@ class TutorialsController < ApplicationController @tutorial = current_user.tutorials.create(tutorial_params) current_user.tag(@tutorial, :with => params[:tutorial_tags], :on => :tags) if @tutorial.save - redirect_to dashboard_path, :notice => t(:tutorial_saved) + redirect_to my_dashboard_path, :notice => t(:tutorial_saved) else flash[:error] = @tutorial.errors.full_messages render :new @@ -44,7 +44,7 @@ class TutorialsController < ApplicationController def destroy @tutorial = current_user.tutorials.find(params[:id]) @tutorial.destroy - redirect_to dashboard_path + redirect_to my_dashboard_path end def tutorial_params diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index e49d92a8..9c8021aa 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -79,7 +79,7 @@ <li class="divider-vertical hidden-phone"></li> <% if user_signed_in? %> <li> - <%= link_to dashboard_path do %> + <%= link_to my_dashboard_path do %> <%= avatar_for(current_user, size: 24) %> <% end %> </li> diff --git a/app/views/dashboard/_creation.html.erb b/app/views/my/dashboard/_creation.html.erb index 0fe9d07f..0fe9d07f 100644 --- a/app/views/dashboard/_creation.html.erb +++ b/app/views/my/dashboard/_creation.html.erb diff --git a/app/views/dashboard/_tutorial.html.erb b/app/views/my/dashboard/_tutorial.html.erb index 5ef6f479..5ef6f479 100644 --- a/app/views/dashboard/_tutorial.html.erb +++ b/app/views/my/dashboard/_tutorial.html.erb diff --git a/app/views/dashboard/index.html.erb b/app/views/my/dashboard/index.html.erb index 42f29a91..42f29a91 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/my/dashboard/index.html.erb diff --git a/app/views/notification_mailer/notification_email.html.erb b/app/views/notification_mailer/notification_email.html.erb index 1269867d..cf48d8f3 100644 --- a/app/views/notification_mailer/notification_email.html.erb +++ b/app/views/notification_mailer/notification_email.html.erb @@ -6,7 +6,7 @@ <body> <h1>Hi <%= @user.name %>,</h1> <p> - You have new notification. Click <%= link_to "here", dashboard_url %> to see. + You have new notification. Click <%= link_to "here", my_dashboard_url %> to see. </p> <p>Have a wonderful day!</p> </body> diff --git a/app/views/notification_mailer/notification_email.text.erb b/app/views/notification_mailer/notification_email.text.erb index 6c872ce7..cba32615 100644 --- a/app/views/notification_mailer/notification_email.text.erb +++ b/app/views/notification_mailer/notification_email.text.erb @@ -1,6 +1,6 @@ Hi <%= @user.name %>, -You have new notification. Click <%= link_to "here", dashboard_url %> to see. +You have new notification. Click <%= link_to "here", my_dashboard_url %> to see. Have a wonderful day! diff --git a/app/views/photos/_form.html.erb b/app/views/photos/_form.html.erb index d779a2dc..f257af3c 100644 --- a/app/views/photos/_form.html.erb +++ b/app/views/photos/_form.html.erb @@ -19,7 +19,7 @@ <div class="span10"> </div> <div class="span2"> <span class="btn btn-success fileinput-button"><i class="icon-plus icon-white"></i><span> Browse... </span><%= f.file_field :image %></span> - <%= link_to "NEXT", dashboard_path, :class => "btn btn-primary" %> + <%= link_to "NEXT", my_dashboard_path, :class => "btn btn-primary" %> </div> </div> <div class="fileupload-loading"></div> diff --git a/app/views/shared/_account_nav.html.erb b/app/views/shared/_account_nav.html.erb index 06b41cfa..3f59283c 100644 --- a/app/views/shared/_account_nav.html.erb +++ b/app/views/shared/_account_nav.html.erb @@ -1,7 +1,7 @@ <div class="row"> <div class="span12"> <ul class="nav nav-tabs"> - <li class="<%= selected == :dashboard ? "active" : "" %>"><%= link_to "Dashboard", dashboard_path %></li> + <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 == :basic_info ? "active" : "" %>"><%= link_to "Settings", settings_path %></li> diff --git a/config/routes.rb b/config/routes.rb index 24709849..c330d7f2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,6 @@ Cake::Application.routes.draw do get "about_us" => "home#about_us" get "why_cakeside" => "home#why_cakeside" - get 'dashboard', to: 'dashboard#index' post 'comments', to: 'comments#create' resources :tutorials do @@ -68,6 +67,7 @@ Cake::Application.routes.draw do end namespace :my do + get 'dashboard', to: 'dashboard#index' resources :cakes do end end diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/my/dashboard_controller_spec.rb index 6ccfc099..4a8aa5a1 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/my/dashboard_controller_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe DashboardController do +describe My::DashboardController do context "#index" do let(:user) { create(:user) } let!(:activity) { create(:activity, user: user) } diff --git a/spec/controllers/tutorials_controller_spec.rb b/spec/controllers/tutorials_controller_spec.rb index abe32db5..3bf1a779 100644 --- a/spec/controllers/tutorials_controller_spec.rb +++ b/spec/controllers/tutorials_controller_spec.rb @@ -72,7 +72,7 @@ describe TutorialsController do end it "redirects to the created tutorial" do - response.should redirect_to(dashboard_path) + response.should redirect_to(my_dashboard_path) end end @@ -147,7 +147,7 @@ describe TutorialsController do end it "redirects to the tutorials list" do - response.should redirect_to(dashboard_path) + response.should redirect_to(my_dashboard_path) end end end |
