Created
March 12, 2011 03:57
-
-
Save adamcarlile/867013 to your computer and use it in GitHub Desktop.
Render user status examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_user_status | |
if user_signed_in? | |
inner_html = content_tag(:span, "Signed in as #{current_user.email}. Not you? \n #{link_to("Sign out", destroy_user_session_path)}") | |
else | |
inner_html = content_tag(:span, "#{link_to("Sign up", new_user_registration_path)} \n or \n #{link_to("Sign in", new_user_session_path)}") | |
end | |
return content_tag(:div, inner_html, :id => "user_nav") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_user_status | |
xhtml = Builder::XmlMarkup.new :target => out=(''), :indent => 2 | |
xhtml.div(:id => "user_nav") do |x| | |
if user_signed_in? | |
x << "Signed in as #{current_user.email}. Not you? " | |
x << link_to("Sign out", destroy_user_session_path) | |
else | |
x << link_to("Sign up", new_user_registration_path) | |
x << " or " | |
x << link_to("Sign in", new_user_session_path) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment