diff app/views/pastes/show.html.erb @ 190:d4682cea8e58

Fun with alerts.
author Edho Arief <edho@myconan.net>
date Sat, 23 Feb 2013 14:31:34 +0900
parents b4b7a29b70f6
children 22c4b5f90e24
line wrap: on
line diff
--- a/app/views/pastes/show.html.erb	Sat Feb 23 14:01:22 2013 +0900
+++ b/app/views/pastes/show.html.erb	Sat Feb 23 14:31:34 2013 +0900
@@ -1,4 +1,11 @@
 <% provide :title, "Paste ##{@paste.id}" %>
+
+<% if flash[:error] %>
+  <div class="alert alert-error">
+    <%= flash[:error] %>
+  </div>
+<% end %>
+
 <div class="page-header">
   <h1><%= content_for :title %></h1>
 </div>
@@ -38,7 +45,7 @@
 
 <div class="input-append">
   <%= form_for @paste, :method => :delete do |f| %>
-    <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key' %>
+    <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :autofocus => !flash[:error].blank? %>
     <%= f.submit 'Delete this paste', :class => 'btn btn-danger' %>
   <% end %>
 </div>