Skip to content

Commit

Permalink
Only display form when signed in.
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed Mar 27, 2012
1 parent fb95977 commit 26fcaf8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/views/shouts/index.html.erb
Expand Up @@ -6,16 +6,19 @@
<%= link_to "Sign in", sign_in_path %>
<% end %>
<%= form_for(@shout) do |form| %>
<% if @shout.errors.any? %>
<% @shout.errors.full_messages.each do |message| %>
<div><strong><%= message %></strong></div>
<% if signed_in? %>
<%= form_for(@shout) do |form| %>
<% if @shout.errors.any? %>
<% @shout.errors.full_messages.each do |message| %>
<div><strong><%= message %></strong></div>
<% end %>
<% end %>
<%= form.text_field :body, :placeholder => "Shout" %>
<%= form.submit "Shout!" %>
<% end %>
<%= form.text_field :body, :placeholder => "Shout" %>
<%= form.submit "Shout!" %>
<% end %>

<h2>Shouts</h2>
<% @shouts.each do |shout| %>
<div><%= shout.body %> <%= shout.user.email %> <%= time_ago_in_words(shout.created_at) %></div>
<% end %>

0 comments on commit 26fcaf8

Please sign in to comment.