Permalink
Browse files

Minor Adjustments in Layouts

  • Loading branch information...
1 parent 7a1e787 commit 20a7030b52f98d79c6c51f137b790caa1ff3bc33 @andey committed Feb 10, 2013
@@ -7,10 +7,16 @@ class UsersController < ApplicationController
# Link to reddit.com user can be found on this page as well.
def show
@user = User.find_by_username(params[:username])
- @amas = @user.amas.order(:date).reverse_order
respond_to do |format|
- format.html
+ if @user && @user.entities.count == 1
+ format.html { redirect_to entity_path(@user.entities.first.slug), :status => :moved_permanently }
+ elsif @user
+ @amas = @user.amas.order(:date).reverse_order
+ format.html
+ else
+ format.html { redirect_to root_path, :notice => "User does not exist" }
+ end
end
end
end
@@ -12,7 +12,7 @@
<p>
<b>Reddit Usernames:</b>
<% @entity.users.group(:id).each do |u| %>
- <%= link_to u.username, user_path(u) %>
+ <%= link_to u.username, reddit_user_path(u.username) %>
<% end %>
</p>
@@ -33,7 +33,7 @@
<li><%= link_to "Admins", admin_admins_path %></li>
</ul>
</li>
- <li><%= link_to "Logout", root_path %></li>
+ <li><%= link_to "Logout", logout_session_path %></li>
</ul>
</div>
</div>
@@ -56,6 +56,8 @@
<%= link_to "Terms of Service", page_path(:id => "terms"), :rel => :nofollow %>
<%= link_to "Source Code", "https://github.com/andey/bestofama" %>
<%= link_to "Contact", page_path(:id => "contact"), :rel => :nofollow %>
+ <% if current_user %><%= link_to "Admin Panel", admin_amas_path %>
+ <% end %>
<footer>
Copyright © 2013 BestofAMA.com, All rights reserved.
</footer>

0 comments on commit 20a7030

Please sign in to comment.