Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

configure for Foundation 3

  • Loading branch information...
commit 637e79e25aa808759b45c06da3b55ae29bfbb677 1 parent 5741753
@balexand balexand authored
View
15 lib/generators/simple_form/install_generator.rb
@@ -5,19 +5,22 @@ class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
class_option :template_engine, :desc => 'Template engine to be invoked (erb, haml or slim).'
class_option :bootstrap, :type => :boolean, :desc => 'Add the Twitter Bootstrap wrappers to the SimpleForm initializer.'
+ class_option :foundation, :type => :boolean, :desc => 'Add the Zurb Foundation 3 wrappers to the SimpleForm initializer.'
def info_bootstrap
- return if options.bootstrap?
- puts "SimpleForm 2 supports Twitter bootstrap. In case you want to " \
- "generate bootstrap configuration, please re-run this " \
- "generator passing --bootstrap as option."
+ return if options.bootstrap? || options.foundation?
+ puts "SimpleForm 2 supports Twitter Bootstrap and Zurb Foundation 3. If you want "\
+ "a configuration that is compatible with one of these frameworks, then please " \
+ "re-run this generator with --bootstrap or --foundation as an option."
end
def copy_config
- template "config/initializers/simple_form.rb"
-
if options[:bootstrap]
template "config/initializers/simple_form_bootstrap.rb"
+ elsif options[:foundation]
+ template "config/initializers/simple_form_foundation.rb"
+ else
+ template "config/initializers/simple_form.rb"
end
directory 'config/locales'
View
6 lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb
@@ -6,7 +6,7 @@
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, :class => :input,
- :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
+ :hint_class => :field_with_hint, :error_class => :error do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
@@ -42,7 +42,7 @@
## Inputs
b.use :label_input
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
- b.use :error, :wrap_with => { :tag => :span, :class => :error }
+ b.use :error, :wrap_with => { :tag => :small }
end
# The default wrapper to be used by the FormBuilder.
@@ -66,7 +66,7 @@
config.error_notification_tag = :div
# CSS class to add for error notification helper.
- config.error_notification_class = 'alert alert-error'
+ config.error_notification_class = 'alert-box alert'
# ID to add for error notification helper.
# config.error_notification_id = nil
Please sign in to comment.
Something went wrong with that request. Please try again.