Permalink
Browse files

a couple small ui tweaks

  • Loading branch information...
1 parent 7d7146a commit 902d1236d3ba86ded91e0010345aad675abadb15 @adamcooper committed Nov 22, 2011
@@ -1,2 +1,10 @@
module RatingsHelper
+
+
+ def wrapper_for(form, object, field, &block)
+ classes = object.errors[field] ? "clearfix error" : "clearfix"
+ content_tag(:div, class: classes) do
+ form.label(field) + content_tag(:div, class: 'input', &block)
+ end
+ end
end
@@ -66,7 +66,7 @@ def basic_datetime_select(field, options = {})
basic_helpers.each do |name|
# First alias old method
- class_eval("alias super_#{name.to_s} #{name}")
+ # class_eval("alias super_#{name.to_s} #{name}")
define_method(name) do |field, *args|
with_custom_field_error_proc do
View
@@ -1,2 +1,4 @@
class Rating < ActiveRecord::Base
+
+ validates :name, :presence => true
end
@@ -9,6 +9,10 @@
<body>
<%= render :partial => '/partials/navigation' %>
<div class="container">
+ <% if notice.present? %>
+ <div class="alert-message success"><p><%= notice %></p></div>
+ <%- end %>
+
<%= yield %>
</div>
@@ -1,46 +1,14 @@
-<%= form_for(@rating) do |f| %>
- <% if @rating.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@rating.errors.count, "error") %> prohibited this rating from being saved:</h2>
-
- <ul>
- <% @rating.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+<%= form_for(@rating, :builder => BootstrapFormBuilder) do |f| %>
<fieldset>
<legend>Rating details</legend>
- <div class="clearfix">
- <%= f.label :name %>
- <div class="input">
- <%= f.text_field :name, :class => 'xxlarge' %>
- </div>
- </div>
- <div class="clearfix">
- <%= f.label :title %>
- <div class="input">
- <%= f.text_field :title, :class => 'xxlarge' %>
- </div>
- </div>
- <div class="clearfix">
- <%= f.label :stars %>
- <div class="input">
- <%= f.select :stars, [1,2,3,4,5], :class => 'xxlarge' %>
- </div>
- </div>
+ <%= f.text_field :name, :class => 'xxlarge' %>
- <div class="clearfix">
- <%= f.label :comments %>
- <div class="input">
- <%= f.text_area :comments, :class => 'xxlarge' %>
- <span class="help-block">
- Please enter some nice comments so I can improve
- </span>
- </div>
- </div>
+ <%= f.text_field :title, :class => 'xxlarge', :help_block => 'A short descriptive summary of the talk' %>
+
+ <%= f.select :stars, [1,2,3,4,5] %>
+
+ <%= f.text_area :comments, :class => 'xxlarge', :help_block => 'Please enter some nice comments so I can improve presenting' %>
<div class="actions">
<%= f.submit :class => 'btn primary' %>
@@ -15,7 +15,7 @@
<tr>
<td><%= rating.title %></td>
<td><%= rating.stars %></td>
- <td><%= rating.comments %></td>
+ <td><%= truncate(rating.comments, :size => 100) %></td>
<td><%= rating.name %></td>
<td><%= link_to 'Show', rating %></td>
<td><%= link_to 'Edit', edit_rating_path(rating) %></td>
@@ -26,6 +26,4 @@
<br />
-<div class="actions">
- <%= link_to 'New Rating', new_rating_path, :class => 'btn' %>
-</div>
+ <%= link_to 'New Rating', new_rating_path, :class => 'btn small' %>
@@ -1,4 +1,3 @@
-<p id="notice"><%= notice %></p>
<h1><%= @rating.title %></h1>
@@ -8,7 +7,5 @@
</blockquote>
-<div class="actions">
- <%= link_to 'Edit', edit_rating_path(@rating), :class => 'btn' %>
- <%= link_to 'Back', ratings_path, :class => 'btn' %>
-</div>
+ <%= link_to 'Edit', edit_rating_path(@rating), :class => 'btn primary small' %>
+ <%= link_to 'Back', ratings_path, :class => 'btn small' %>
View
@@ -32,5 +32,7 @@ update all the forms for twitter bootstap - maybe jump to a commit...
# deploy
add gem 'heroku' to the rails file
move 'sqlite' to the development group
+add 'pg' to the production group
+

0 comments on commit 902d123

Please sign in to comment.