Commit f5c3f94c

mo k <mo@mokhan.ca>
2012-06-03 00:59:54
fix error styles.
1 parent 5b8201a
Changed files (3)
app
assets
stylesheets
controllers
views
app/assets/stylesheets/custom.css.scss
@@ -62,25 +62,22 @@ footer #footer-floor {
   float: left;
   margin: 4px 5px 0 0;
 }
-
-
-#error_explanation {
-  @extend .control-group;
-  @extend .error;  
-  color: #f00;
-  ul {
-    list-style: none;
-    margin: 0 0 18px 0;
-}
-}
-
+/*#error_explanation {*/
+/*@extend .control-group;*/
+/*@extend .error;*/
+/*color: #f00;*/
+/*ul {*/
+/*list-style: none;*/
+/*margin: 0 0 18px 0;*/
+/*}*/
+/*}*/
 .field_with_errors{
   @extend .control-group;
   @extend .error;
-
 }
-
-
+.form-horizontal .control-group:before, .form-horizontal .field_with_errors:before, .form-horizontal .control-group:after, .form-horizontal .field_with_errors:after {
+  content: normal;
+}
 .ui-autocomplete {
   position: absolute;
   top: 100%;
@@ -131,5 +128,3 @@ footer #footer-floor {
     }
   }
 }
-
-
app/controllers/creations_controller.rb
@@ -34,6 +34,7 @@ class CreationsController < ApplicationController
           format.html { render :action => "crop" }
         end
       else
+        flash[:error] = @creation.errors.full_messages
         format.html { render :action => "new" }
       end
     end
app/views/creations/_form.html.erb
@@ -1,14 +1,4 @@
 <%= form_for(@creation, :html => {:multipart => true, :class => "form-horizontal"}) do |f| %>
-  <% if @creation.errors.any? %>
-    <div id="error_explanation">
-      <h2><%= pluralize(@creation.errors.count, "error") %> prohibited this creation from being saved:</h2>
-      <ul>
-        <% @creation.errors.full_messages.each do |msg| %>
-          <li><%= msg %></li>
-        <% end %>
-      </ul>
-    </div>
-  <% end %>
   <fieldset>
     <legend>Share a new creation</legend>
     <div class="control-group">
@@ -16,30 +6,22 @@
       <div class="controls">
         <%= f.text_field :name, :class => "input-xlarge" %>
       </div>
-    </div><!-- /control-group -->
+    </div>
     <div class="control-group">
-      <%= f.label :image, "Upload Main Image" %>
+      <%= f.label :image, "Upload Main Image", :class => "control-label" %>
       <div class="controls">
         <%= f.file_field :image, :class => "input-file" %>
       </div>
-    </div><!-- /control-group -->
-    <!--
-    <div class="control-group">
-      <%= f.label :remote_image_url, "Or Image URL" %><br />
-      <div class="controls">
-        <%= f.text_field :remote_image_url, :class=>"input-xlarge" %>
-      </div>
     </div>
-    -->
     <div class="control-group">
-      <%= f.label :story, "Description" %><br />
+      <%= f.label :story, "Description", :class=> "control-label" %>
       <div class="controls">
         <%= f.text_area :story, :class =>"input-xlarge", :rows => "3" %>
         <p class="help-block">
-          Tell us the story or description of the creation.
+        Tell us the story or description of the creation.
         </p>
       </div>
-    </div><!-- /control-group -->
+    </div>
     <div class="control-group">
       <label class="control-label">Categories</label>
       <div class="controls">
@@ -54,7 +36,7 @@
         Help us categorize your creation by checking off one or more from the above list.
         </p>
       </div>
-    </div><!-- /control-group -->
+    </div>
     <div class="form-actions">
       <button type="submit" class="btn btn-primary">Save changes</button>
       <a href="<%= url_for @creation %>" class="btn">Cancel</a>