Added logout button
Added logged_in helper to allow us to check whether a user is logged in to show the appropriate button
This commit is contained in:
parent
7e4280d451
commit
ab81cf9d5c
@ -1,4 +1,5 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
helper_method :current_user, :logged_in?
|
||||
|
||||
def require_login
|
||||
redirect_to login_url unless current_user.present?
|
||||
|
@ -33,7 +33,11 @@
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<div class="buttons">
|
||||
<% if !logged_in? -%>
|
||||
<%= link_to "Login", login_url, { :class => "button is-primary"} %>
|
||||
<% else -%>
|
||||
<%= link_to "Logout", logout_url, { :class => "button is-light"} %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user