formtastic 1.2.5 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.yardopts +1 -0
- data/CHANGELOG +279 -0
- data/Gemfile +3 -0
- data/README.textile +155 -172
- data/RELEASE_PROCESS +7 -0
- data/Rakefile +52 -0
- data/app/assets/stylesheets/formtastic.css +275 -0
- data/app/assets/stylesheets/formtastic_ie6.css +27 -0
- data/app/assets/stylesheets/formtastic_ie7.css +17 -0
- data/formtastic.gemspec +51 -0
- data/lib/formtastic.rb +21 -1960
- data/lib/formtastic/engine.rb +7 -0
- data/lib/formtastic/form_builder.rb +83 -0
- data/lib/formtastic/helpers.rb +16 -0
- data/lib/formtastic/helpers/buttons_helper.rb +277 -0
- data/lib/formtastic/helpers/errors_helper.rb +113 -0
- data/lib/formtastic/helpers/fieldset_wrapper.rb +75 -0
- data/lib/formtastic/helpers/file_column_detection.rb +16 -0
- data/lib/formtastic/helpers/form_helper.rb +198 -0
- data/lib/formtastic/helpers/input_helper.rb +366 -0
- data/lib/formtastic/helpers/inputs_helper.rb +392 -0
- data/lib/formtastic/helpers/reflection.rb +33 -0
- data/lib/formtastic/helpers/semantic_form_helper.rb +11 -0
- data/lib/formtastic/html_attributes.rb +21 -0
- data/lib/formtastic/i18n.rb +1 -0
- data/lib/formtastic/inputs.rb +31 -0
- data/lib/formtastic/inputs/base.rb +61 -0
- data/lib/formtastic/inputs/base/associations.rb +31 -0
- data/lib/formtastic/inputs/base/choices.rb +103 -0
- data/lib/formtastic/inputs/base/collections.rb +94 -0
- data/lib/formtastic/inputs/base/database.rb +17 -0
- data/lib/formtastic/inputs/base/errors.rb +58 -0
- data/lib/formtastic/inputs/base/fileish.rb +23 -0
- data/lib/formtastic/inputs/base/grouped_collections.rb +77 -0
- data/lib/formtastic/inputs/base/hints.rb +31 -0
- data/lib/formtastic/inputs/base/html.rb +52 -0
- data/lib/formtastic/inputs/base/labelling.rb +55 -0
- data/lib/formtastic/inputs/base/naming.rb +42 -0
- data/lib/formtastic/inputs/base/options.rb +18 -0
- data/lib/formtastic/inputs/base/stringish.rb +35 -0
- data/lib/formtastic/inputs/base/timeish.rb +128 -0
- data/lib/formtastic/inputs/base/validations.rb +166 -0
- data/lib/formtastic/inputs/base/wrapping.rb +40 -0
- data/lib/formtastic/inputs/boolean_input.rb +96 -0
- data/lib/formtastic/inputs/check_boxes_input.rb +179 -0
- data/lib/formtastic/inputs/country_input.rb +66 -0
- data/lib/formtastic/inputs/date_input.rb +14 -0
- data/lib/formtastic/inputs/datetime_input.rb +9 -0
- data/lib/formtastic/inputs/email_input.rb +40 -0
- data/lib/formtastic/inputs/file_input.rb +42 -0
- data/lib/formtastic/inputs/hidden_input.rb +66 -0
- data/lib/formtastic/inputs/number_input.rb +118 -0
- data/lib/formtastic/inputs/numeric_input.rb +21 -0
- data/lib/formtastic/inputs/password_input.rb +40 -0
- data/lib/formtastic/inputs/phone_input.rb +41 -0
- data/lib/formtastic/inputs/radio_input.rb +157 -0
- data/lib/formtastic/inputs/range_input.rb +119 -0
- data/lib/formtastic/inputs/search_input.rb +40 -0
- data/lib/formtastic/inputs/select_input.rb +210 -0
- data/lib/formtastic/inputs/string_input.rb +34 -0
- data/lib/formtastic/inputs/text_input.rb +47 -0
- data/lib/formtastic/inputs/time_input.rb +14 -0
- data/lib/formtastic/inputs/time_zone_input.rb +48 -0
- data/lib/formtastic/inputs/url_input.rb +40 -0
- data/lib/formtastic/localized_string.rb +105 -0
- data/lib/formtastic/railtie.rb +5 -7
- data/lib/formtastic/semantic_form_builder.rb +11 -0
- data/lib/formtastic/util.rb +6 -19
- data/lib/formtastic/version.rb +3 -0
- data/lib/generators/formtastic/install/install_generator.rb +28 -6
- data/lib/generators/templates/_form.html.erb +10 -4
- data/lib/generators/templates/_form.html.haml +8 -4
- data/lib/generators/templates/formtastic.rb +25 -32
- data/lib/locale/en.yml +1 -0
- data/lib/tasks/verify_rcov.rb +44 -0
- data/sample/basic_inputs.html +182 -0
- data/sample/config.ru +69 -0
- data/sample/index.html +14 -0
- data/spec/builder/custom_builder_spec.rb +109 -0
- data/spec/builder/error_proc_spec.rb +27 -0
- data/spec/builder/errors_spec.rb +193 -0
- data/spec/builder/semantic_fields_for_spec.rb +88 -0
- data/spec/helpers/buttons_helper_spec.rb +150 -0
- data/spec/helpers/commit_button_helper_spec.rb +470 -0
- data/spec/helpers/form_helper_spec.rb +135 -0
- data/spec/helpers/input_helper_spec.rb +837 -0
- data/spec/helpers/inputs_helper_spec.rb +562 -0
- data/spec/helpers/semantic_errors_helper_spec.rb +112 -0
- data/spec/i18n_spec.rb +199 -0
- data/spec/inputs/boolean_input_spec.rb +184 -0
- data/spec/inputs/check_boxes_input_spec.rb +375 -0
- data/spec/inputs/country_input_spec.rb +133 -0
- data/spec/inputs/custom_input_spec.rb +52 -0
- data/spec/inputs/date_input_spec.rb +110 -0
- data/spec/inputs/datetime_input_spec.rb +115 -0
- data/spec/inputs/email_input_spec.rb +55 -0
- data/spec/inputs/file_input_spec.rb +59 -0
- data/spec/inputs/hidden_input_spec.rb +120 -0
- data/spec/inputs/include_blank_spec.rb +70 -0
- data/spec/inputs/label_spec.rb +104 -0
- data/spec/inputs/number_input_spec.rb +487 -0
- data/spec/inputs/numeric_input_spec.rb +41 -0
- data/spec/inputs/password_input_spec.rb +69 -0
- data/spec/inputs/phone_input_spec.rb +55 -0
- data/spec/inputs/placeholder_spec.rb +71 -0
- data/spec/inputs/radio_input_spec.rb +234 -0
- data/spec/inputs/range_input_spec.rb +477 -0
- data/spec/inputs/search_input_spec.rb +55 -0
- data/spec/inputs/select_input_spec.rb +545 -0
- data/spec/inputs/string_input_spec.rb +163 -0
- data/spec/inputs/text_input_spec.rb +158 -0
- data/spec/inputs/time_input_spec.rb +155 -0
- data/spec/inputs/time_zone_input_spec.rb +87 -0
- data/spec/inputs/url_input_spec.rb +55 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +361 -0
- data/spec/support/custom_macros.rb +656 -0
- data/spec/support/deferred_garbage_collection.rb +21 -0
- data/spec/support/deprecation.rb +6 -0
- data/spec/support/test_environment.rb +30 -0
- metadata +306 -88
- data/generators/form/USAGE +0 -16
- data/generators/form/form_generator.rb +0 -111
- data/generators/formtastic/formtastic_generator.rb +0 -26
- data/init.rb +0 -5
- data/lib/formtastic/layout_helper.rb +0 -12
- data/lib/generators/formtastic/form/form_generator.rb +0 -84
- data/lib/generators/templates/formtastic.css +0 -145
- data/lib/generators/templates/formtastic_changes.css +0 -14
- data/lib/generators/templates/rails2/_form.html.erb +0 -5
- data/lib/generators/templates/rails2/_form.html.haml +0 -4
- data/rails/init.rb +0 -2
data/generators/form/USAGE
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
NAME
|
2
|
-
form - Formtastic form generator.
|
3
|
-
|
4
|
-
DESCRIPTION
|
5
|
-
Generates formtastic form code based on an existing model. By default the generated code will be printed out directly in the terminal, and also copied to clipboard. Can optionally be saved into partial directly.
|
6
|
-
|
7
|
-
Required:
|
8
|
-
ExistingModelName - The name of an existing model for which the generator should generate form code.
|
9
|
-
|
10
|
-
Options:
|
11
|
-
--haml Generate HAML instead of ERB.
|
12
|
-
--partial Generate a form partial in the model views path, i.e. "_form.html.erb" or _form.html.haml".
|
13
|
-
--controller PATH Generate for custom controller/view path - in case model and controller namespace is different, i.e. "admin/posts".
|
14
|
-
|
15
|
-
EXAMPLE
|
16
|
-
./script/generate form ExistingModelName [--haml] [--partial]
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class FormGenerator < Rails::Generator::NamedBase
|
4
|
-
|
5
|
-
default_options :haml => false,
|
6
|
-
:partial => false
|
7
|
-
|
8
|
-
VIEWS_PATH = File.join('app', 'views').freeze
|
9
|
-
IGNORED_COLUMNS = [:updated_at, :created_at].freeze
|
10
|
-
|
11
|
-
attr_reader :controller_file_name,
|
12
|
-
:controller_class_path,
|
13
|
-
:controller_class_nesting,
|
14
|
-
:controller_class_nesting_depth,
|
15
|
-
:controller_class_name,
|
16
|
-
:template_type
|
17
|
-
|
18
|
-
def initialize(runtime_args, runtime_options = {})
|
19
|
-
super
|
20
|
-
base_name, @controller_class_path = extract_modules(@name.pluralize)
|
21
|
-
controller_class_name_without_nesting, @controller_file_name = inflect_names(base_name)
|
22
|
-
@template_type = options[:haml] ? :haml : :erb
|
23
|
-
end
|
24
|
-
|
25
|
-
def manifest
|
26
|
-
record do |m|
|
27
|
-
if options[:partial]
|
28
|
-
controller_and_view_path = options[:controller] || File.join(controller_class_path, controller_file_name)
|
29
|
-
# Ensure directory exists.
|
30
|
-
m.directory File.join(VIEWS_PATH, controller_and_view_path)
|
31
|
-
# Create a form partial for the model as "_form" in it's views path.
|
32
|
-
m.template "_form.html.#{template_type}", File.join(VIEWS_PATH, controller_and_view_path, "_form.html.#{template_type}")
|
33
|
-
else
|
34
|
-
# Load template file, and render without saving to file
|
35
|
-
template = File.read(File.join(source_root, "_form.html.#{template_type}"))
|
36
|
-
erb = ERB.new(template, nil, '-')
|
37
|
-
generated_code = erb.result(binding).strip rescue nil
|
38
|
-
|
39
|
-
# Print the result, and copy to clipboard
|
40
|
-
puts "# ---------------------------------------------------------"
|
41
|
-
puts "# GENERATED FORMTASTIC CODE"
|
42
|
-
puts "# ---------------------------------------------------------"
|
43
|
-
puts
|
44
|
-
puts generated_code || " Nothing could be generated - model exists?"
|
45
|
-
puts
|
46
|
-
puts "# ---------------------------------------------------------"
|
47
|
-
puts "Copied to clipboard - just paste it!" if save_to_clipboard(generated_code)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
|
54
|
-
def save_to_clipboard(data)
|
55
|
-
return unless data
|
56
|
-
|
57
|
-
begin
|
58
|
-
case RUBY_PLATFORM
|
59
|
-
when /win32/
|
60
|
-
require 'win32/clipboard'
|
61
|
-
::Win32::Clipboard.data = data
|
62
|
-
when /darwin/ # mac
|
63
|
-
`echo "#{data}" | pbcopy`
|
64
|
-
else # linux/unix
|
65
|
-
`echo "#{data}" | xsel --clipboard` || `echo "#{data}" | xclip`
|
66
|
-
end
|
67
|
-
rescue LoadError
|
68
|
-
false
|
69
|
-
else
|
70
|
-
true
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Add additional model attributes if specified in args - probably not that common scenario.
|
75
|
-
def attributes
|
76
|
-
# Get columns for the requested model.
|
77
|
-
existing_attributes = @class_name.constantize.content_columns.reject { |column| IGNORED_COLUMNS.include?(column.name.to_sym) }
|
78
|
-
@args = super + existing_attributes
|
79
|
-
end
|
80
|
-
|
81
|
-
def add_options!(opt)
|
82
|
-
opt.separator ''
|
83
|
-
opt.separator 'Options:'
|
84
|
-
|
85
|
-
# Allow option to generate HAML views instead of ERB.
|
86
|
-
opt.on('--haml',
|
87
|
-
"Generate HAML output instead of the default ERB.") do |v|
|
88
|
-
options[:haml] = v
|
89
|
-
end
|
90
|
-
|
91
|
-
# Allow option to generate to partial in model's views path, instead of printing out in terminal.
|
92
|
-
opt.on('--partial',
|
93
|
-
"Save generated output directly to a form partial (app/views/{resource}/_form.html.*).") do |v|
|
94
|
-
options[:partial] = v
|
95
|
-
end
|
96
|
-
|
97
|
-
opt.on('--controller CONTROLLER_PATH',
|
98
|
-
"Specify a non-standard controller for the specified model (e.g. admin/posts).") do |v|
|
99
|
-
options[:controller] = v if v.present?
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def banner
|
104
|
-
"Usage: #{$0} form ExistingModelName [--haml] [--partial]"
|
105
|
-
end
|
106
|
-
|
107
|
-
def source_root
|
108
|
-
File.expand_path('../../../lib/generators/templates/rails2', __FILE__)
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class FormtasticGenerator < Rails::Generator::Base
|
4
|
-
|
5
|
-
def manifest
|
6
|
-
record do |m|
|
7
|
-
m.directory File.join('config', 'initializers')
|
8
|
-
m.template 'formtastic.rb', File.join('config', 'initializers', 'formtastic.rb')
|
9
|
-
|
10
|
-
m.directory File.join('public', 'stylesheets')
|
11
|
-
m.template 'formtastic.css', File.join('public', 'stylesheets', 'formtastic.css')
|
12
|
-
m.template 'formtastic_changes.css', File.join('public', 'stylesheets', 'formtastic_changes.css')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def banner
|
19
|
-
%{Usage: #{$0} #{spec.name}\nCopies formtastic.css and formtastic_changes.css to public/stylesheets/ and a config initializer to config/initializers/formtastic.rb}
|
20
|
-
end
|
21
|
-
|
22
|
-
def source_root
|
23
|
-
File.expand_path('../../../lib/generators/templates', __FILE__)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/init.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Formtastic
|
3
|
-
class FormGenerator < Rails::Generators::NamedBase
|
4
|
-
desc "Generates formtastic form code based on an existing model. By default the " <<
|
5
|
-
"generated code will be printed out directly in the terminal, and also copied " <<
|
6
|
-
"to clipboard. Can optionally be saved into partial directly."
|
7
|
-
|
8
|
-
argument :name, :type => :string, :required => true, :banner => 'ExistingModelName'
|
9
|
-
argument :attributes, :type => :array, :default => [], :banner => 'field:type field:type'
|
10
|
-
|
11
|
-
class_option :haml, :type => :boolean, :default => false, :group => :formtastic,
|
12
|
-
:desc => "Generate HAML instead of ERB"
|
13
|
-
|
14
|
-
class_option :partial, :type => :boolean, :default => false, :group => :formtastic,
|
15
|
-
:desc => 'Generate a form partial in the model views path, i.e. "_form.html.erb" or "_form.html.haml"'
|
16
|
-
|
17
|
-
class_option :controller, :type => :string, :default => false, :group => :formtastic,
|
18
|
-
:desc => 'Generate for custom controller/view path - in case model and controller namespace is different, i.e. "admin/posts"'
|
19
|
-
|
20
|
-
source_root File.expand_path('../../../templates', __FILE__)
|
21
|
-
|
22
|
-
def create_or_show
|
23
|
-
@attributes = self.columns if @attributes.empty?
|
24
|
-
|
25
|
-
if options[:partial]
|
26
|
-
empty_directory "app/views/#{controller_path}"
|
27
|
-
template "_form.html.#{template_type}", "app/views/#{controller_path}/_form.html.#{template_type}"
|
28
|
-
else
|
29
|
-
template = File.read("#{self.class.source_root}/_form.html.#{template_type}")
|
30
|
-
erb = ERB.new(template, nil, '-')
|
31
|
-
generated_code = erb.result(binding).strip rescue nil
|
32
|
-
|
33
|
-
puts "# ---------------------------------------------------------"
|
34
|
-
puts "# GENERATED FORMTASTIC CODE"
|
35
|
-
puts "# ---------------------------------------------------------"
|
36
|
-
puts
|
37
|
-
puts generated_code || "Nothing could be generated - model exists?"
|
38
|
-
puts
|
39
|
-
puts "# ---------------------------------------------------------"
|
40
|
-
puts "Copied to clipboard - just paste it!" if save_to_clipboard(generated_code)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
protected
|
45
|
-
|
46
|
-
IGNORED_COLUMNS = [:updated_at, :created_at].freeze
|
47
|
-
|
48
|
-
def template_type
|
49
|
-
@template_type ||= options[:haml] ? :haml : :erb
|
50
|
-
end
|
51
|
-
|
52
|
-
def controller_path
|
53
|
-
@controller_path ||= if options[:controller]
|
54
|
-
options[:controller].underscore
|
55
|
-
else
|
56
|
-
name.underscore.pluralize
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def columns
|
61
|
-
@columns ||= self.name.camelize.constantize.content_columns.reject { |column| IGNORED_COLUMNS.include?(column.name.to_sym) }
|
62
|
-
end
|
63
|
-
|
64
|
-
def save_to_clipboard(data)
|
65
|
-
return unless data
|
66
|
-
|
67
|
-
begin
|
68
|
-
case RUBY_PLATFORM
|
69
|
-
when /win32/
|
70
|
-
require 'win32/clipboard'
|
71
|
-
::Win32::Clipboard.data = data
|
72
|
-
when /darwin/ # mac
|
73
|
-
`echo "#{data}" | pbcopy`
|
74
|
-
else # linux/unix
|
75
|
-
`echo "#{data}" | xsel --clipboard` || `echo "#{data}" | xclip`
|
76
|
-
end
|
77
|
-
rescue LoadError
|
78
|
-
false
|
79
|
-
else
|
80
|
-
true
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
/* -------------------------------------------------------------------------------------------------
|
2
|
-
|
3
|
-
It's *strongly* suggested that you don't modify this file. Instead, load a new stylesheet after
|
4
|
-
this one in your layouts (eg formtastic_changes.css) and override the styles to suit your needs.
|
5
|
-
This will allow you to update formtastic.css with new releases without clobbering your own changes.
|
6
|
-
|
7
|
-
This stylesheet forms part of the Formtastic Rails Plugin
|
8
|
-
(c) 2008 Justin French
|
9
|
-
|
10
|
-
--------------------------------------------------------------------------------------------------*/
|
11
|
-
|
12
|
-
|
13
|
-
/* NORMALIZE AND RESET - obviously inspired by Yahoo's reset.css, but scoped to just form.formtastic
|
14
|
-
--------------------------------------------------------------------------------------------------*/
|
15
|
-
form.formtastic, form.formtastic ul, form.formtastic ol, form.formtastic li, form.formtastic fieldset, form.formtastic legend, form.formtastic input, form.formtastic textarea, form.formtastic select, form.formtastic p { margin:0; padding:0; }
|
16
|
-
form.formtastic fieldset { border:0; }
|
17
|
-
form.formtastic em, form.formtastic strong { font-style:normal; font-weight:normal; }
|
18
|
-
form.formtastic ol, form.formtastic ul { list-style:none; }
|
19
|
-
form.formtastic abbr, form.formtastic acronym { border:0; font-variant:normal; }
|
20
|
-
form.formtastic input, form.formtastic textarea, form.formtastic select { font-family:inherit; font-size:inherit; font-weight:inherit; }
|
21
|
-
form.formtastic input, form.formtastic textarea, form.formtastic select { font-size:100%; }
|
22
|
-
form.formtastic legend { white-space:normal; color:#000; }
|
23
|
-
|
24
|
-
|
25
|
-
/* SEMANTIC ERRORS
|
26
|
-
--------------------------------------------------------------------------------------------------*/
|
27
|
-
form.formtastic ul.errors { color:#cc0000; margin:0.5em 0 1.5em 25%; list-style:square; }
|
28
|
-
form.formtastic ul.errors li { padding:0; border:none; display:list-item; }
|
29
|
-
|
30
|
-
|
31
|
-
/* FIELDSETS & LISTS
|
32
|
-
--------------------------------------------------------------------------------------------------*/
|
33
|
-
form.formtastic fieldset { overflow:hidden; } /* clearing contained floats */
|
34
|
-
form.formtastic fieldset.inputs { }
|
35
|
-
form.formtastic fieldset.buttons { padding-left:25%; }
|
36
|
-
form.formtastic fieldset ol { }
|
37
|
-
form.formtastic fieldset.buttons li { float:left; padding-right:0.5em; }
|
38
|
-
|
39
|
-
/* INPUT LIs
|
40
|
-
--------------------------------------------------------------------------------------------------*/
|
41
|
-
form.formtastic fieldset > ol > li { padding:0.5em 0; margin-top:-0.5em; margin-bottom:1em; } /* padding and negative margin juggling is for Firefox */
|
42
|
-
form.formtastic fieldset > ol > li { overflow:hidden; } /* clearing contained floats */
|
43
|
-
|
44
|
-
form.formtastic fieldset > ol > li.required { }
|
45
|
-
form.formtastic fieldset > ol > li.optional { }
|
46
|
-
form.formtastic fieldset > ol > li.error { }
|
47
|
-
|
48
|
-
|
49
|
-
/* LABELS
|
50
|
-
--------------------------------------------------------------------------------------------------*/
|
51
|
-
form.formtastic fieldset > ol > li label { display:block; width:25%; float:left; padding-top:.2em; }
|
52
|
-
form.formtastic fieldset > ol > li > li label { line-height:100%; padding-top:0; }
|
53
|
-
form.formtastic fieldset > ol > li > li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;}
|
54
|
-
|
55
|
-
|
56
|
-
/* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
|
57
|
-
--------------------------------------------------------------------------------------------------*/
|
58
|
-
form.formtastic fieldset > ol > li fieldset { position:relative; }
|
59
|
-
form.formtastic fieldset > ol > li fieldset legend { position:absolute; width:95%; left: 0px; }
|
60
|
-
form.formtastic fieldset > ol > li fieldset legend span { position:absolute; }
|
61
|
-
form.formtastic fieldset > ol > li fieldset legend.label label { position:absolute; }
|
62
|
-
form.formtastic fieldset > ol > li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 25%; }
|
63
|
-
form.formtastic fieldset > ol > li fieldset ol li { padding:0; border:0; }
|
64
|
-
|
65
|
-
|
66
|
-
/* INLINE HINTS
|
67
|
-
--------------------------------------------------------------------------------------------------*/
|
68
|
-
form.formtastic fieldset > ol > li p.inline-hints { color:#666; margin:0.5em 0 0 25%; }
|
69
|
-
|
70
|
-
|
71
|
-
/* INLINE ERRORS
|
72
|
-
--------------------------------------------------------------------------------------------------*/
|
73
|
-
form.formtastic fieldset > ol > li p.inline-errors { color:#cc0000; margin:0.5em 0 0 25%; }
|
74
|
-
form.formtastic fieldset > ol > li ul.errors { color:#cc0000; margin:0.5em 0 0 25%; list-style:square; }
|
75
|
-
form.formtastic fieldset > ol > li ul.errors li { padding:0; border:none; display:list-item; }
|
76
|
-
|
77
|
-
|
78
|
-
/* STRING, NUMERIC, PASSWORD, EMAIL, URL, PHONE & SEARCH OVERRIDES
|
79
|
-
--------------------------------------------------------------------------------------------------*/
|
80
|
-
form.formtastic fieldset > ol > li.string input,
|
81
|
-
form.formtastic fieldset > ol > li.password input,
|
82
|
-
form.formtastic fieldset > ol > li.numeric input,
|
83
|
-
form.formtastic fieldset > ol > li.email input,
|
84
|
-
form.formtastic fieldset > ol > li.url input,
|
85
|
-
form.formtastic fieldset > ol > li.phone input,
|
86
|
-
form.formtastic fieldset > ol > li.search input { width:72%; }
|
87
|
-
|
88
|
-
form.formtastic fieldset > ol > li.string input[size],
|
89
|
-
form.formtastic fieldset > ol > li.password input[size],
|
90
|
-
form.formtastic fieldset > ol > li.numeric input[size],
|
91
|
-
form.formtastic fieldset > ol > li.email input[size],
|
92
|
-
form.formtastic fieldset > ol > li.url input[size],
|
93
|
-
form.formtastic fieldset > ol > li.phone input[size],
|
94
|
-
form.formtastic fieldset > ol > li.search input[size] { width:auto; max-width:72%; }
|
95
|
-
|
96
|
-
|
97
|
-
/* TEXTAREA OVERRIDES
|
98
|
-
--------------------------------------------------------------------------------------------------*/
|
99
|
-
form.formtastic fieldset > ol > li.text textarea { width:72%; }
|
100
|
-
form.formtastic fieldset > ol > li.text textarea[cols] { width:auto; max-width:72%; }
|
101
|
-
|
102
|
-
|
103
|
-
/* HIDDEN OVERRIDES
|
104
|
-
--------------------------------------------------------------------------------------------------*/
|
105
|
-
form.formtastic fieldset ol li.hidden { display:none; }
|
106
|
-
|
107
|
-
/* BOOLEAN OVERRIDES
|
108
|
-
--------------------------------------------------------------------------------------------------*/
|
109
|
-
form.formtastic fieldset > ol > li.boolean label { padding-left:25%; width:auto; }
|
110
|
-
form.formtastic fieldset > ol > li.boolean label input { margin:0 0.5em 0 0.2em; }
|
111
|
-
|
112
|
-
|
113
|
-
/* RADIO OVERRIDES
|
114
|
-
--------------------------------------------------------------------------------------------------*/
|
115
|
-
form.formtastic fieldset > ol > li.radio { }
|
116
|
-
form.formtastic fieldset > ol > li.radio fieldset { overflow:visible; }
|
117
|
-
form.formtastic fieldset > ol > li.radio fieldset ol { margin-bottom:-0.5em; }
|
118
|
-
form.formtastic fieldset > ol > li.radio fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; }
|
119
|
-
form.formtastic fieldset > ol > li.radio fieldset ol li label { float:none; width:100%; }
|
120
|
-
form.formtastic fieldset > ol > li.radio fieldset ol li label input { margin-right:0.2em; }
|
121
|
-
|
122
|
-
|
123
|
-
/* CHECK BOXES (COLLECTION) OVERRIDES
|
124
|
-
--------------------------------------------------------------------------------------------------*/
|
125
|
-
form.formtastic fieldset > ol > li.check_boxes { }
|
126
|
-
form.formtastic fieldset > ol > li.check_boxes fieldset { overflow:visible; }
|
127
|
-
form.formtastic fieldset > ol > li.check_boxes fieldset ol { margin-bottom:-0.5em; }
|
128
|
-
form.formtastic fieldset > ol > li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; }
|
129
|
-
form.formtastic fieldset > ol > li.check_boxes fieldset ol li label { float:none; width:100%; }
|
130
|
-
form.formtastic fieldset > ol > li.check_boxes fieldset ol li label input { margin-right:0.2em; }
|
131
|
-
|
132
|
-
|
133
|
-
/* DATE & TIME OVERRIDES
|
134
|
-
--------------------------------------------------------------------------------------------------*/
|
135
|
-
form.formtastic fieldset > ol > li.date fieldset ol li,
|
136
|
-
form.formtastic fieldset > ol > li.time fieldset ol li,
|
137
|
-
form.formtastic fieldset > ol > li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; }
|
138
|
-
|
139
|
-
form.formtastic fieldset > ol > li.date fieldset ol li label,
|
140
|
-
form.formtastic fieldset > ol > li.time fieldset ol li label,
|
141
|
-
form.formtastic fieldset > ol > li.datetime fieldset ol li label { display:none; }
|
142
|
-
|
143
|
-
form.formtastic fieldset > ol > li.date fieldset ol li label input,
|
144
|
-
form.formtastic fieldset > ol > li.time fieldset ol li label input,
|
145
|
-
form.formtastic fieldset > ol > li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; }
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/* -------------------------------------------------------------------------------------------------
|
2
|
-
|
3
|
-
Load this stylesheet after formtastic.css in your layouts to override the CSS to suit your needs.
|
4
|
-
This will allow you to update formtastic.css with new releases without clobbering your own changes.
|
5
|
-
|
6
|
-
For example, to make the inline hint paragraphs a little darker in color than the standard #666:
|
7
|
-
|
8
|
-
form.formtastic fieldset > ol > li p.inline-hints { color:#333; }
|
9
|
-
|
10
|
-
HINT:
|
11
|
-
The following style may be *conditionally* included for improved support on older versions of IE(<8)
|
12
|
-
form.formtastic fieldset ol li fieldset legend { margin-left: -6px;}
|
13
|
-
|
14
|
-
--------------------------------------------------------------------------------------------------*/
|
data/rails/init.rb
DELETED