Skip to content
Browse files

linking logo to home page

  • Loading branch information...
1 parent 05bae1d commit 8db51b1cfe67e525cc70921914eb021b745f977a @ryanb committed
View
2 app/controllers/stamps_controller.rb
@@ -2,7 +2,7 @@ class StampsController < ApplicationController
before_filter :login_required, :only => [:new, :edit, :edit_goal, :update, :destroy]
def index
- if current_user && current_user.current_stamp
+ if !params[:no_redirect] && current_user && current_user.current_stamp
redirect_to current_user.current_stamp
else
@stamp = Stamp.new
View
2 app/views/layouts/application.html.erb
@@ -33,7 +33,7 @@
</div>
<%- end -%>
</div>
- <%= image_tag "dailystamp_small.png", :size => "221x45", :alt => "Daily Stamp" %>
+ <%= link_to image_tag("dailystamp_small.png", :size => "221x45", :alt => "Daily Stamp"), home_path %>
</div>
</div>
<div id="container">
View
1 config/routes.rb
@@ -4,6 +4,7 @@
map.signup 'signup', :controller => 'users', :action => 'new'
map.logout 'logout', :controller => 'user_sessions', :action => 'destroy'
map.login 'login', :controller => 'user_sessions', :action => 'new'
+ map.home 'home', :controller => 'stamps', :action => 'index', :no_redirect => "true"
map.resources :user_sessions
map.resources :users
View
2 public/stylesheets/home.css
@@ -18,7 +18,7 @@
}
#logo {
- margin: 40px 0;
+ margin: 20px 0;
margin-bottom: 50px;
}
View
7 spec/controllers/stamps_controller_spec.rb
@@ -72,6 +72,13 @@
response.should redirect_to(stamp_url(Stamp.first))
end
+ it "index action should render index when no redirect is specified" do
+ @current_user.current_stamp_id = Stamp.first.id
+ @current_user.save
+ get :index, :no_redirect => "true"
+ response.should render_template(:index)
+ end
+
it "new action should render new template" do
get :new
response.should render_template(:index)

0 comments on commit 8db51b1

Please sign in to comment.
Something went wrong with that request. Please try again.