diff app/views/pastes/show.html.erb @ 265:6cca1ab53337

Infinitely better error messages and notice.
author edogawaconan <me@myconan.net>
date Wed, 16 Oct 2013 02:56:30 +0900
parents fa4a1ba990ae
children 77c157a9e645
line wrap: on
line diff
--- a/app/views/pastes/show.html.erb	Wed Oct 16 02:19:36 2013 +0900
+++ b/app/views/pastes/show.html.erb	Wed Oct 16 02:56:30 2013 +0900
@@ -1,8 +1,8 @@
 <% provide :title, "Paste ##{@paste.id}" %>
 
-<% if flash[:error] %>
-  <div class="alert alert-error">
-    <%= flash[:error] %>
+<% if alert %>
+  <div class="alert alert-danger">
+    <%= alert %>
   </div>
 <% end %>
 
@@ -31,9 +31,10 @@
 </div>
 
 <%= form_for @paste, :method => :delete do |f| %>
+
   <div class="row"><div class="col-md-4">
     <div class="input-group">
-      <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :class => "form-control", :autofocus => !flash[:error].blank? %>
+      <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :class => "form-control", :autofocus => f.object.errors.any? %>
       <span class="input-group-btn">
         <%= f.submit 'Delete this paste', :class => 'btn btn-danger' %>
       </span>