Skip to content
This repository
Browse code

Set up the Application Layout with flash messages and Devise links

  • Loading branch information...
commit f611d573b42887cbdaddf840fd01a9d0a5881616 1 parent 8d0b067
Daniel Kehoe authored August 08, 2010
9  app/views/devise/menu/_login_items.html.erb
... ...
@@ -0,0 +1,9 @@
  1
+<% if user_signed_in? %>
  2
+  <li>
  3
+  <%= link_to('Logout', destroy_user_session_path) %>        
  4
+  </li>
  5
+<% else %>
  6
+  <li>
  7
+  <%= link_to('Login', new_user_session_path)  %>  
  8
+  </li>
  9
+<% end %>
9  app/views/devise/menu/_registration_items.html.erb
... ...
@@ -0,0 +1,9 @@
  1
+<% if user_signed_in? %>
  2
+  <li>
  3
+  <%= link_to('Edit account', edit_user_registration_path) %>
  4
+  </li>
  5
+<% else %>
  6
+  <li>
  7
+  <%= link_to('Sign up', new_user_registration_path)  %>
  8
+  </li>
  9
+<% end %>
12  app/views/layouts/application.html.erb
... ...
@@ -1,14 +1,18 @@
1 1
 <!DOCTYPE html>
2 2
 <html>
3 3
 <head>
4  
-  <title>Rails3SubdomainDevise</title>
  4
+  <title>Rails3-Subdomain-Devise</title>
5 5
   <%= stylesheet_link_tag :all %>
6 6
   <%= javascript_include_tag :defaults %>
7 7
   <%= csrf_meta_tag %>
8 8
 </head>
9 9
 <body>
10  
-
11  
-<%= yield %>
12  
-
  10
+  <ul class="hmenu">
  11
+    <%= render 'devise/menu/registration_items' %>
  12
+    <%= render 'devise/menu/login_items' %>
  13
+  </ul>
  14
+  <p style="color: green"><%= notice %></p>
  15
+  <p style="color: red"><%= alert %></p>
  16
+  <%= yield %>
13 17
 </body>
14 18
 </html>
9  public/stylesheets/application.css
... ...
@@ -0,0 +1,9 @@
  1
+ul.hmenu {
  2
+  list-style: none;	
  3
+  margin: 0 0 2em;
  4
+  padding: 0;
  5
+}
  6
+
  7
+ul.hmenu li {
  8
+  display: inline;  
  9
+}

0 notes on commit f611d57

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