Commit 8d887d7b
Changed files (8)
app
controllers
views
layouts
my
config
spec
controllers
app/controllers/registrations_controller.rb
@@ -1,6 +1,6 @@
class RegistrationsController < Devise::RegistrationsController
def after_sign_in_path_for(resource)
- my_dashboard_path(anchor: 'cakes')
+ my_root_path(anchor: 'cakes')
end
def sign_up_params
app/controllers/sessions_controller.rb
@@ -1,13 +1,13 @@
class SessionsController < ApplicationController
def new
- redirect_to my_dashboard_path(anchor: 'cakes') if user_signed_in?
+ redirect_to my_root_path if user_signed_in?
@session = UserSession.new
end
def create
if @session = User.login(session_params[:username], session_params[:password])
cookies.signed[:raphael] = @session.access(request)
- redirect_to my_dashboard_path
+ redirect_to my_root_path
else
flash[:error] = "Ooops... invalid email or password."
redirect_to login_path
app/views/layouts/_header.html.erb
@@ -10,8 +10,8 @@
<div class="nav-collapse collapse">
<p class="navbar-text pull-right">
<% if user_signed_in? %>
- <%= link_to current_user.name, my_dashboard_path, class: 'navbar-link' %>
- <%= link_to my_dashboard_path, class: 'navbar-link' do %>
+ <%= link_to current_user.name, my_root_path, class: 'navbar-link' %>
+ <%= link_to my_root_path, class: 'navbar-link' do %>
<%= avatar_for(current_user, size: 24) %>
<% end %>
<% else %>
app/views/my/dashboard/index.html.erb
@@ -1,20 +1,42 @@
<% provide(:title, "Dashboard") -%>
+<%= content_for :javascript do -%>
+ <%= javascript_tag do %>
+ var ALL_TAGS = [ <% ActsAsTaggableOn::Tag.pluck(:name).sort!.each { |item| %> '<%= item %>', <% } %> ];
+ var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>';
+ var disqus_identifier = 'u-<%= current_user.id %>';
+ var disqus_config = function(){
+ this.page.remote_auth_s3 = '<%= disqus_auth %>';
+ this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>';
+ };
+ CakeSide.initialize({
+ access_token: '<%= current_user.authentication_token %>',
+ disqus_shortname: disqus_shortname,
+ });
+ <% end %>
+<% end -%>
+
<div class="row-fluid">
<div class="span2">
<%= render partial: "my/shared/my_nav" %>
</div>
- <div class="span5">
- <% @items.each do |item| %>
- <%= render item.class.to_s.downcase, item: item %>
- <% end %>
- </div>
- <div class="span5">
- <% if @activities.empty? %>
- <p>No new activity to report.</p>
- <% else %>
- <% @activities.each do |activity| %>
- <%= render "activities/#{activity.subject.class.to_s.downcase}", subject: activity.subject %>
- <% end %>
- <% end %>
+ <div class="span10">
+ <div id="backbone-content">
+ <div class="span5">
+ <% @items.each do |item| %>
+ <%= render item.class.to_s.downcase, item: item %>
+ <% end %>
+ </div>
+ <div class="span5">
+ <% if @activities.empty? %>
+ <p>No new activity to report.</p>
+ <% else %>
+ <% @activities.each do |activity| %>
+ <%= render "activities/#{activity.subject.class.to_s.downcase}", subject: activity.subject %>
+ <% end %>
+ <% end %>
+ </div>
+ </div>
+ <div id="disqus_thread"></div>
</div>
</div>
+<div id="modal" class="modal hide fade"></div>
app/views/my/home/index.html.erb
@@ -1,26 +1,7 @@
-<%= content_for :javascript do -%>
- <%= javascript_tag do %>
- var ALL_TAGS = [ <% ActsAsTaggableOn::Tag.pluck(:name).sort!.each { |item| %> '<%= item %>', <% } %> ];
- var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>';
- var disqus_identifier = 'u-<%= current_user.id %>';
- var disqus_config = function(){
- this.page.remote_auth_s3 = '<%= disqus_auth %>';
- this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>';
- };
- CakeSide.initialize({
- access_token: '<%= current_user.authentication_token %>',
- disqus_shortname: disqus_shortname,
- });
- <% end %>
-<% end -%>
-
<div class="row-fluid">
<div class="span2">
<%= render partial: "my/shared/my_nav" %>
</div>
<div class="span10">
- <div id="backbone-content"></div>
- <div id="disqus_thread"></div>
</div>
</div>
-<div id="modal" class="modal hide fade"></div>
config/routes.rb
@@ -76,6 +76,7 @@ Cake::Application.routes.draw do
resources :settings, only: [:index, :update]
resources :passwords, only: [:index, :update]
resources :avatars, only: [:edit, :update]
- root to: "home#index"
+ #root to: "home#index"
+ root to: "dashboard#index"
end
end
spec/controllers/sessions_controller_spec.rb
@@ -17,7 +17,7 @@ describe SessionsController do
it "redirects to the dashboard" do
get :new
- expect(response).to redirect_to(my_dashboard_path(anchor: 'cakes'))
+ expect(response).to redirect_to(my_root_path(anchor: 'cakes'))
end
end
end
@@ -39,7 +39,7 @@ describe SessionsController do
end
it "redirects to the dashboard" do
- expect(response).to redirect_to(my_dashboard_path)
+ expect(response).to redirect_to(my_root_path)
end
end