Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 1 commit
  • 8 files changed
  • 0 commit comments
  • 1 contributor
2  Gemfile
View
@@ -14,13 +14,13 @@ gem 'carrierwave'
gem 'mini_magick'
gem 'fog'
gem 'jquery-star-rating-rails'
-gem 'client_side_validations'
gem 'forum_monster'
gem 'bb-ruby'
gem 'koala'
gem 'airbrake'
gem 'maruku'
gem 'simple_form'
+gem 'client_side_validations', '3.2.0.beta.6', :git => 'https://github.com/bcardarella/client_side_validations.git'
# le windows
platforms :mswin, :mingw do
9 Gemfile.lock
View
@@ -1,3 +1,9 @@
+GIT
+ remote: https://github.com/bcardarella/client_side_validations.git
+ revision: a7fcf0cecea15859d647f2205d8c466408062563
+ specs:
+ client_side_validations (3.2.0.beta.6)
+
GEM
remote: http://rubygems.org/
specs:
@@ -65,7 +71,6 @@ GEM
activesupport (>= 3.2.0)
childprocess (0.3.2)
ffi (~> 1.0.6)
- client_side_validations (3.1.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -264,7 +269,7 @@ DEPENDENCIES
capybara
carmen
carrierwave
- client_side_validations
+ client_side_validations (= 3.2.0.beta.6)!
coffee-rails (~> 3.2.1)
eventmachine (= 1.0.0.beta.4.1)
factory_girl_rails
1  app/assets/javascripts/application.js
View
@@ -14,6 +14,7 @@
//= require jquery
//= require jquery_ujs
//= require rails.validations
+//= require rails.validations.simple_form
//= require bootstrap
//= require fullcalendar
//= require_tree ./gmaps4rails
51 app/assets/javascripts/client_validations_custom.mak
View
@@ -0,0 +1,51 @@
+(function() {
+ $(document).ready(function() {
+ return $("div.control-group").focusout(function() {
+ if (!$("div.control-group").hasClass("error")) {
+ return $(this).addClass("success");
+ }
+ });
+ });
+}).call(this);
+
+ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = {
+ add: function(element, settings, message) {
+ var errorElement, wrapper;
+
+ settings.wrapper_tag = ".control-group";
+ settings.error_tag = "span";
+ settings.error_class = "help-inline";
+ settings.wrapper_error_class = "error";
+ settings.wrapper_success = "success";
+
+ if (element.data('valid') !== false) {
+ wrapper = element.closest(settings.wrapper_tag);
+ wrapper.removeClass(settings.wrapper_success);
+ wrapper.addClass(settings.wrapper_error_class);
+ errorElement = $("<" + settings.error_tag + "/>", {
+ "class": settings.error_class,
+ text: message
+ });
+ return wrapper.find(".controls").append(errorElement);
+ } else {
+ wrapper = element.closest(settings.wrapper_tag);
+ wrapper.addClass(settings.wrapper_error_class);
+ return element.parent().find("" + settings.error_tag + "." + settings.error_class).text(message);
+ }
+ },
+ remove: function(element, settings) {
+ var errorElement, wrapper;
+
+ settings.wrapper_tag = ".control-group";
+ settings.error_tag = "span";
+ settings.error_class = "help-inline";
+ settings.wrapper_error_class = "error";
+ settings.wrapper_success = "success";
+
+ wrapper = element.closest("" + settings.wrapper_tag + "." + settings.wrapper_error_class);
+ wrapper.removeClass(settings.wrapper_error_class);
+ wrapper.addClass(settings.wrapper_success);
+ errorElement = wrapper.find("" + settings.error_tag + "." + settings.error_class);
+ return errorElement.remove();
+ }
+};
12 app/assets/stylesheets/application.css.scss
View
@@ -106,4 +106,16 @@ h3 small {
width:400px;
margin: 10px auto 0 auto;
text-align:center;
+}
+
+.simple_form .date .controls select {
+ width: 75px;
+}
+.simple_form .date .controls select:nth-child(2) {
+ width: 100px;
+}
+.simple_form .help-block {
+ margin-top: 5px;
+ color:#999999;
+ font-size: 13px;
}
55 app/views/day_homes/show.html.haml
View
@@ -5,8 +5,6 @@
.span12
%h2
= @day_home.name
- %h2
- you've got the right one
%p
:plain
<div class="fb-like" data-href="#{day_home_slug_url(@day_home.slug)}" data-send="false" data-layout="button_count" data-width="55" data-show-faces="false"></div>
@@ -82,49 +80,34 @@
#contact-form.modal
%h3
Contact #{@day_home.name}
- = simple_form_for @day_home_contact, :url => contact_day_home_path(@day_home), :validate => true do |cf|
- - if @day_home_contact.errors.any?
- %div#errorExplanation
- %h2
- = pluralize(@user.errors.count, "error")
- prohibited this user from being saved:
- %ul
- -@user.errors.full_messages.each do |msg|
- %li
- = msg
- </ul>
- </div>
+ = simple_form_for @day_home_contact, :url => contact_day_home_path(@day_home),:validate=>true do |cf|
.span4.well
= cf.input :name, :label=>"Your name"
= cf.input :email, :label=>"Your email"
= cf.input :phone, :label=>"Your phone"
- .span4.well.form-horizontal
- = cf.label "Child's name:"
- = cf.text_field :email, :class => "required"
-
- = cf.label "Child's Birthday"
- = cf.text_field :email, :class => "required"
- = cf.text_field :email, :class => "required"
-
- = cf.label "Start Date"
- = cf.text_field :email, :class => "required"
-
- = cf.label "Your address (optional):"
- = cf.text_field :email
-
- .span9
- = cf.label "Regarding:"
- = cf.text_field :subject
+ .span4.well
+ = cf.input :child_name, :label =>"Child's name"
+ = cf.input :child_birth_date, :discard_day => true
+ = cf.input :child_start_date, :label=>"Desired Start Date"
- .remember
- = cf.label "Message:"
+ = cf.input :home_address, :label=>false do
+ =cf.label :home_address, :style => 'display:inline;'
+ %i.icon-info-sign{:rel=>"tooltip", :title=> "If you are contacting a licensed dayhome, this helps the agency find other options if this one won't work." }
+ =cf.text_field :home_address
+
+ .span9.remember
+ = cf.input :subject,:label=>"Regarding"
+ = cf.error :subject, :id => 'subject_error'
+
+ = cf.input :message, :label=>false do
+ =cf.label :message, :label=>"Message", :style => 'display:inline;'
%i.icon-info-sign{:rel=>"tooltip", :title=> "Make sure to include contact information in your message!" }
- = cf.text_area :message, :style => 'height: 150px !important;'
-
+ = cf.text_area :message, :style => 'height: 150px !important;'
+
= cf.hidden_field :day_home_email, :value => @day_home_contact.day_home_email
.submit
- = cf.submit "Contact", :class => 'btn btn-primary span3'
+ = cf.button :submit, "Contact", :class => 'btn btn-primary span3'
.span4
= link_to 'Contact Dayhome', '#contact-form', :rel => 'modal:open', :class => "callToActionButton gradient"
.row
12 db/migrate/20120905171055_add_properties_to_day_home_contact.rb
View
@@ -0,0 +1,12 @@
+class AddPropertiesToDayHomeContact < ActiveRecord::Migration
+ def change
+ add_column :day_home_contacts, :child_name, :string
+
+ add_column :day_home_contacts, :child_birth_date, :date
+
+ add_column :day_home_contacts, :child_start_date, :date
+
+ add_column :day_home_contacts, :home_address, :string
+
+ end
+end
10 db/schema.rb
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120803195020) do
+ActiveRecord::Schema.define(:version => 20120905171055) do
create_table "availability_types", :force => true do |t|
t.string "kind"
@@ -61,8 +61,12 @@
t.string "subject"
t.text "message"
t.integer "day_home_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "child_name"
+ t.date "child_birth_date"
+ t.date "child_start_date"
+ t.string "home_address"
end
add_index "day_home_contacts", ["day_home_id"], :name => "index_day_home_contacts_on_day_home_id"

No commit comments for this range

Something went wrong with that request. Please try again.