tmayad-formtastic 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +517 -0
- data/Rakefile +101 -0
- data/generators/form/USAGE +16 -0
- data/generators/form/form_generator.rb +120 -0
- data/generators/form/templates/view__form.html.erb +5 -0
- data/generators/form/templates/view__form.html.haml +4 -0
- data/generators/formtastic/formtastic_generator.rb +24 -0
- data/generators/formtastic/templates/formtastic.css +138 -0
- data/generators/formtastic/templates/formtastic.rb +54 -0
- data/generators/formtastic/templates/formtastic_changes.css +10 -0
- data/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +16 -0
- data/lib/formtastic.rb +1643 -0
- data/lib/formtastic/i18n.rb +32 -0
- data/lib/locale/en.yml +8 -0
- data/rails/init.rb +3 -0
- data/spec/buttons_spec.rb +149 -0
- data/spec/commit_button_spec.rb +344 -0
- data/spec/custom_builder_spec.rb +62 -0
- data/spec/custom_macros.rb +561 -0
- data/spec/defaults_spec.rb +20 -0
- data/spec/error_proc_spec.rb +27 -0
- data/spec/errors_spec.rb +85 -0
- data/spec/form_helper_spec.rb +120 -0
- data/spec/i18n_spec.rb +131 -0
- data/spec/include_blank_spec.rb +70 -0
- data/spec/input_spec.rb +608 -0
- data/spec/inputs/boolean_input_spec.rb +93 -0
- data/spec/inputs/check_boxes_input_spec.rb +162 -0
- data/spec/inputs/country_input_spec.rb +80 -0
- data/spec/inputs/date_input_spec.rb +45 -0
- data/spec/inputs/datetime_input_spec.rb +155 -0
- data/spec/inputs/file_input_spec.rb +33 -0
- data/spec/inputs/hidden_input_spec.rb +52 -0
- data/spec/inputs/numeric_input_spec.rb +44 -0
- data/spec/inputs/password_input_spec.rb +46 -0
- data/spec/inputs/radio_input_spec.rb +149 -0
- data/spec/inputs/select_input_spec.rb +459 -0
- data/spec/inputs/string_input_spec.rb +47 -0
- data/spec/inputs/text_input_spec.rb +33 -0
- data/spec/inputs/time_input_spec.rb +44 -0
- data/spec/inputs/time_zone_input_spec.rb +102 -0
- data/spec/inputs_spec.rb +395 -0
- data/spec/label_spec.rb +48 -0
- data/spec/semantic_fields_for_spec.rb +44 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +212 -0
- metadata +169 -0
data/Rakefile
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'spec/rake/spectask'
|
7
|
+
rescue LoadError
|
8
|
+
begin
|
9
|
+
gem 'rspec-rails', '>= 1.0.0'
|
10
|
+
require 'spec/rake/spectask'
|
11
|
+
rescue LoadError
|
12
|
+
puts "[formtastic:] RSpec - or one of it's dependencies - is not available. Install it with: sudo gem install rspec-rails"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
GEM = "formtastic"
|
18
|
+
AUTHOR = "Justin French"
|
19
|
+
EMAIL = "justin@indent.com.au"
|
20
|
+
SUMMARY = "A Rails form builder plugin/gem with semantically rich and accessible markup"
|
21
|
+
HOMEPAGE = "http://github.com/justinfrench/formtastic/tree/master"
|
22
|
+
INSTALL_MESSAGE = %q{
|
23
|
+
========================================================================
|
24
|
+
Thanks for installing Formtastic!
|
25
|
+
------------------------------------------------------------------------
|
26
|
+
You can now (optionally) run the generator to copy some stylesheets and
|
27
|
+
a config initializer into your application:
|
28
|
+
./script/generate formtastic
|
29
|
+
|
30
|
+
To generate some semantic form markup for your exisiting models, just run:
|
31
|
+
./script/generate form MODEL_NAME
|
32
|
+
|
33
|
+
Find out more and get involved:
|
34
|
+
http://github.com/justinfrench/formtastic
|
35
|
+
http://groups.google.com.au/group/formtastic
|
36
|
+
========================================================================
|
37
|
+
}
|
38
|
+
|
39
|
+
gem 'jeweler', '>= 1.0.0'
|
40
|
+
require 'jeweler'
|
41
|
+
|
42
|
+
Jeweler::Tasks.new do |s|
|
43
|
+
s.name = GEM
|
44
|
+
s.summary = SUMMARY
|
45
|
+
s.email = EMAIL
|
46
|
+
s.homepage = HOMEPAGE
|
47
|
+
s.description = SUMMARY
|
48
|
+
s.author = AUTHOR
|
49
|
+
s.post_install_message = INSTALL_MESSAGE
|
50
|
+
|
51
|
+
s.require_path = 'lib'
|
52
|
+
s.files = %w(MIT-LICENSE README.textile Rakefile) + Dir.glob("{rails,lib,generators,spec}/**/*")
|
53
|
+
|
54
|
+
# Runtime dependencies: When installing Formtastic these will be checked if they are installed.
|
55
|
+
# Will be offered to install these if they are not already installed.
|
56
|
+
s.add_dependency 'activesupport', '>= 2.3.0'
|
57
|
+
s.add_dependency 'actionpack', '>= 2.3.0'
|
58
|
+
|
59
|
+
# Development dependencies. Not installed by default.
|
60
|
+
# Install with: sudo gem install formtastic --development
|
61
|
+
s.add_development_dependency 'rspec-rails', '>= 1.2.6'
|
62
|
+
s.add_development_dependency 'rspec_tag_matchers', '>= 1.0.0'
|
63
|
+
end
|
64
|
+
|
65
|
+
Jeweler::GemcutterTasks.new
|
66
|
+
rescue LoadError
|
67
|
+
puts "[formtastic:] Jeweler - or one of its dependencies - is not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Default: run unit specs.'
|
71
|
+
task :default => :spec
|
72
|
+
|
73
|
+
desc 'Generate documentation for the formtastic plugin.'
|
74
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
75
|
+
rdoc.rdoc_dir = 'rdoc'
|
76
|
+
rdoc.title = 'Formtastic'
|
77
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
78
|
+
rdoc.rdoc_files.include('README.textile')
|
79
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
80
|
+
end
|
81
|
+
|
82
|
+
if defined?(Spec)
|
83
|
+
desc 'Test the formtastic plugin.'
|
84
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
85
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
86
|
+
t.spec_opts = ["-c"]
|
87
|
+
end
|
88
|
+
|
89
|
+
desc 'Test the formtastic plugin with specdoc formatting and colors'
|
90
|
+
Spec::Rake::SpecTask.new('specdoc') do |t|
|
91
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
92
|
+
t.spec_opts = ["--format specdoc", "-c"]
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "Run all examples with RCov"
|
96
|
+
Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
|
97
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
98
|
+
t.rcov = true
|
99
|
+
t.rcov_opts = ['--exclude', 'spec,Library']
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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]
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Get current OS - needed for clipboard functionality
|
3
|
+
case RUBY_PLATFORM
|
4
|
+
when /darwin/ then
|
5
|
+
CURRENT_OS = :osx
|
6
|
+
when /win32/
|
7
|
+
CURRENT_OS = :win
|
8
|
+
begin
|
9
|
+
require 'win32/clipboard'
|
10
|
+
rescue LoadError
|
11
|
+
# Do nothing
|
12
|
+
end
|
13
|
+
else
|
14
|
+
CURRENT_OS = :x
|
15
|
+
end
|
16
|
+
|
17
|
+
class FormGenerator < Rails::Generator::NamedBase
|
18
|
+
|
19
|
+
default_options :haml => false,
|
20
|
+
:partial => false
|
21
|
+
|
22
|
+
VIEWS_PATH = File.join('app', 'views').freeze
|
23
|
+
IGNORED_COLUMNS = [:updated_at, :created_at].freeze
|
24
|
+
|
25
|
+
attr_reader :controller_file_name,
|
26
|
+
:controller_class_path,
|
27
|
+
:controller_class_nesting,
|
28
|
+
:controller_class_nesting_depth,
|
29
|
+
:controller_class_name,
|
30
|
+
:template_type
|
31
|
+
|
32
|
+
def initialize(runtime_args, runtime_options = {})
|
33
|
+
super
|
34
|
+
base_name, @controller_class_path = extract_modules(@name.pluralize)
|
35
|
+
controller_class_name_without_nesting, @controller_file_name = inflect_names(base_name)
|
36
|
+
@template_type = options[:haml] ? :haml : :erb
|
37
|
+
end
|
38
|
+
|
39
|
+
def manifest
|
40
|
+
record do |m|
|
41
|
+
if options[:partial]
|
42
|
+
controller_and_view_path = options[:controller] || File.join(controller_class_path, controller_file_name)
|
43
|
+
# Ensure directory exists.
|
44
|
+
m.directory File.join(VIEWS_PATH, controller_and_view_path)
|
45
|
+
# Create a form partial for the model as "_form" in it's views path.
|
46
|
+
m.template "view__form.html.#{template_type}", File.join(VIEWS_PATH, controller_and_view_path, "_form.html.#{template_type}")
|
47
|
+
else
|
48
|
+
# Load template file, and render without saving to file
|
49
|
+
template = File.read(File.join(source_root, "view__form.html.#{template_type}"))
|
50
|
+
erb = ERB.new(template, nil, '-')
|
51
|
+
generated_code = erb.result(binding).strip rescue nil
|
52
|
+
|
53
|
+
# Print the result, and copy to clipboard
|
54
|
+
puts "# ---------------------------------------------------------"
|
55
|
+
puts "# GENERATED FORMTASTIC CODE"
|
56
|
+
puts "# ---------------------------------------------------------"
|
57
|
+
puts
|
58
|
+
puts generated_code || " Nothing could be generated - model exists?"
|
59
|
+
puts
|
60
|
+
puts "# ---------------------------------------------------------"
|
61
|
+
puts " Copied to clipboard - just paste it!" if save_to_clipboard(generated_code)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
protected
|
67
|
+
|
68
|
+
# Save to lipboard with multiple OS support.
|
69
|
+
def save_to_clipboard(data)
|
70
|
+
return unless data
|
71
|
+
begin
|
72
|
+
case CURRENT_OS
|
73
|
+
when :osx
|
74
|
+
`echo "#{data}" | pbcopy`
|
75
|
+
when :win
|
76
|
+
::Win32::Clipboard.data = data
|
77
|
+
else # :linux/:unix
|
78
|
+
`echo "#{data}" | xsel --clipboard` || `echo "#{data}" | xclip`
|
79
|
+
end
|
80
|
+
rescue
|
81
|
+
false
|
82
|
+
else
|
83
|
+
true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Add additional model attributes if specified in args - probably not that common scenario.
|
88
|
+
def attributes
|
89
|
+
# Get columns for the requested model.
|
90
|
+
existing_attributes = @class_name.constantize.content_columns.reject { |column| IGNORED_COLUMNS.include?(column.name.to_sym) }
|
91
|
+
@args = super + existing_attributes
|
92
|
+
end
|
93
|
+
|
94
|
+
def add_options!(opt)
|
95
|
+
opt.separator ''
|
96
|
+
opt.separator 'Options:'
|
97
|
+
|
98
|
+
# Allow option to generate HAML views instead of ERB.
|
99
|
+
opt.on('--haml',
|
100
|
+
"Generate HAML output instead of the default ERB.") do |v|
|
101
|
+
options[:haml] = v
|
102
|
+
end
|
103
|
+
|
104
|
+
# Allow option to generate to partial in model's views path, instead of printing out in terminal.
|
105
|
+
opt.on('--partial',
|
106
|
+
"Save generated output directly to a form partial (app/views/{resource}/_form.html.*).") do |v|
|
107
|
+
options[:partial] = v
|
108
|
+
end
|
109
|
+
|
110
|
+
opt.on('--controller CONTROLLER_PATH',
|
111
|
+
"Specify a non-standard controller for the specified model (e.g. admin/posts).") do |v|
|
112
|
+
options[:controller] = v if v.present?
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def banner
|
117
|
+
"Usage: #{$0} form ExistingModelName [--haml] [--partial]"
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class FormtasticGenerator < Rails::Generator::Base
|
2
|
+
|
3
|
+
def initialize(*runtime_args)
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.directory File.join('config', 'initializers')
|
10
|
+
m.template 'formtastic.rb', File.join('config', 'initializers', 'formtastic.rb')
|
11
|
+
|
12
|
+
m.directory File.join('public', 'stylesheets')
|
13
|
+
m.template 'formtastic.css', File.join('public', 'stylesheets', 'formtastic.css')
|
14
|
+
m.template 'formtastic_changes.css', File.join('public', 'stylesheets', 'formtastic_changes.css')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def banner
|
21
|
+
%{Usage: #{$0} #{spec.name}\nCopies formtastic.css and formtastic_changes.css to public/stylesheets/ and a config initializer to config/initializers/formtastic.rb}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,138 @@
|
|
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 { color:#000; }
|
23
|
+
|
24
|
+
|
25
|
+
/* FIELDSETS & LISTS
|
26
|
+
--------------------------------------------------------------------------------------------------*/
|
27
|
+
form.formtastic fieldset { }
|
28
|
+
form.formtastic fieldset.inputs { }
|
29
|
+
form.formtastic fieldset.buttons { padding-left:25%; }
|
30
|
+
form.formtastic fieldset ol { }
|
31
|
+
form.formtastic fieldset.buttons li { float:left; padding-right:0.5em; }
|
32
|
+
|
33
|
+
/* clearfixing the fieldsets */
|
34
|
+
form.formtastic fieldset { display: inline-block; }
|
35
|
+
form.formtastic fieldset:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
36
|
+
html[xmlns] form.formtastic fieldset { display: block; }
|
37
|
+
* html form.formtastic fieldset { height: 1%; }
|
38
|
+
|
39
|
+
|
40
|
+
/* INPUT LIs
|
41
|
+
--------------------------------------------------------------------------------------------------*/
|
42
|
+
form.formtastic fieldset ol li { margin-bottom:1.5em; }
|
43
|
+
|
44
|
+
/* clearfixing the li's */
|
45
|
+
form.formtastic fieldset ol li { display: inline-block; }
|
46
|
+
form.formtastic fieldset ol li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
47
|
+
html[xmlns] form.formtastic fieldset ol li { display: block; }
|
48
|
+
* html form.formtastic fieldset ol li { height: 1%; }
|
49
|
+
|
50
|
+
form.formtastic fieldset ol li.required { }
|
51
|
+
form.formtastic fieldset ol li.optional { }
|
52
|
+
form.formtastic fieldset ol li.error { }
|
53
|
+
|
54
|
+
|
55
|
+
/* LABELS
|
56
|
+
--------------------------------------------------------------------------------------------------*/
|
57
|
+
form.formtastic fieldset ol li label { display:block; width:25%; float:left; padding-top:.2em; }
|
58
|
+
form.formtastic fieldset ol li li label { line-height:100%; padding-top:0; }
|
59
|
+
form.formtastic fieldset ol li li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;}
|
60
|
+
|
61
|
+
|
62
|
+
/* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
|
63
|
+
--------------------------------------------------------------------------------------------------*/
|
64
|
+
form.formtastic fieldset ol li fieldset { position:relative; }
|
65
|
+
form.formtastic fieldset ol li fieldset legend { position:absolute; width:25%; padding-top:0.1em; }
|
66
|
+
form.formtastic fieldset ol li fieldset legend span { position:absolute; }
|
67
|
+
form.formtastic fieldset ol li fieldset legend.label label { position:absolute; }
|
68
|
+
form.formtastic fieldset ol li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 25%; }
|
69
|
+
form.formtastic fieldset ol li fieldset ol li { padding:0; border:0; }
|
70
|
+
|
71
|
+
|
72
|
+
/* INLINE HINTS
|
73
|
+
--------------------------------------------------------------------------------------------------*/
|
74
|
+
form.formtastic fieldset ol li p.inline-hints { color:#666; margin:0.5em 0 0 25%; }
|
75
|
+
|
76
|
+
|
77
|
+
/* INLINE ERRORS
|
78
|
+
--------------------------------------------------------------------------------------------------*/
|
79
|
+
form.formtastic fieldset ol li p.inline-errors { color:#cc0000; margin:0.5em 0 0 25%; }
|
80
|
+
form.formtastic fieldset ol li ul.errors { color:#cc0000; margin:0.5em 0 0 25%; list-style:square; }
|
81
|
+
form.formtastic fieldset ol li ul.errors li { padding:0; border:none; display:list-item; }
|
82
|
+
|
83
|
+
|
84
|
+
/* STRING & NUMERIC OVERRIDES
|
85
|
+
--------------------------------------------------------------------------------------------------*/
|
86
|
+
form.formtastic fieldset ol li.string input { width:74%; }
|
87
|
+
form.formtastic fieldset ol li.password input { width:74%; }
|
88
|
+
form.formtastic fieldset ol li.numeric input { width:74%; }
|
89
|
+
|
90
|
+
|
91
|
+
/* TEXTAREA OVERRIDES
|
92
|
+
--------------------------------------------------------------------------------------------------*/
|
93
|
+
form.formtastic fieldset ol li.text textarea { width:74%; }
|
94
|
+
|
95
|
+
|
96
|
+
/* HIDDEN OVERRIDES
|
97
|
+
--------------------------------------------------------------------------------------------------*/
|
98
|
+
form.formtastic fieldset ol li.hidden { display:none; }
|
99
|
+
|
100
|
+
|
101
|
+
/* BOOLEAN OVERRIDES
|
102
|
+
--------------------------------------------------------------------------------------------------*/
|
103
|
+
form.formtastic fieldset ol li.boolean label { padding-left:25%; width:auto; }
|
104
|
+
form.formtastic fieldset ol li.boolean label input { margin:0 0.5em 0 0.2em; }
|
105
|
+
|
106
|
+
|
107
|
+
/* RADIO OVERRIDES
|
108
|
+
--------------------------------------------------------------------------------------------------*/
|
109
|
+
form.formtastic fieldset ol li.radio { }
|
110
|
+
form.formtastic fieldset ol li.radio fieldset ol { margin-bottom:-0.6em; }
|
111
|
+
form.formtastic fieldset ol li.radio fieldset ol li { margin:0.1em 0 0.5em 0; }
|
112
|
+
form.formtastic fieldset ol li.radio fieldset ol li label { float:none; width:100%; }
|
113
|
+
form.formtastic fieldset ol li.radio fieldset ol li label input { margin-right:0.2em; }
|
114
|
+
|
115
|
+
|
116
|
+
/* CHECK BOXES (COLLECTION) OVERRIDES
|
117
|
+
--------------------------------------------------------------------------------------------------*/
|
118
|
+
form.formtastic fieldset ol li.check_boxes { }
|
119
|
+
form.formtastic fieldset ol li.check_boxes fieldset ol { margin-bottom:-0.6em; }
|
120
|
+
form.formtastic fieldset ol li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; }
|
121
|
+
form.formtastic fieldset ol li.check_boxes fieldset ol li label { float:none; width:100%; }
|
122
|
+
form.formtastic fieldset ol li.check_boxes fieldset ol li label input { margin-right:0.2em; }
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
/* DATE & TIME OVERRIDES
|
127
|
+
--------------------------------------------------------------------------------------------------*/
|
128
|
+
form.formtastic fieldset ol li.date fieldset ol li,
|
129
|
+
form.formtastic fieldset ol li.time fieldset ol li,
|
130
|
+
form.formtastic fieldset ol li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; }
|
131
|
+
|
132
|
+
form.formtastic fieldset ol li.date fieldset ol li label,
|
133
|
+
form.formtastic fieldset ol li.time fieldset ol li label,
|
134
|
+
form.formtastic fieldset ol li.datetime fieldset ol li label { display:none; }
|
135
|
+
|
136
|
+
form.formtastic fieldset ol li.date fieldset ol li label input,
|
137
|
+
form.formtastic fieldset ol li.time fieldset ol li label input,
|
138
|
+
form.formtastic fieldset ol li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; }
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Set the default text field size when input is a string. Default is 50.
|
2
|
+
# Formtastic::SemanticFormBuilder.default_text_field_size = 50
|
3
|
+
|
4
|
+
# Set the default text area height when input is a text. Default is 20.
|
5
|
+
# Formtastic::SemanticFormBuilder.default_text_area_height = 5
|
6
|
+
|
7
|
+
# Should all fields be considered "required" by default?
|
8
|
+
# Defaults to true, see ValidationReflection notes below.
|
9
|
+
# Formtastic::SemanticFormBuilder.all_fields_required_by_default = true
|
10
|
+
|
11
|
+
# Should select fields have a blank option/prompt by default?
|
12
|
+
# Defaults to true.
|
13
|
+
# Formtastic::SemanticFormBuilder.include_blank_for_select_by_default = true
|
14
|
+
|
15
|
+
# Set the string that will be appended to the labels/fieldsets which are required
|
16
|
+
# It accepts string or procs and the default is a localized version of
|
17
|
+
# '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
|
18
|
+
# in your locale, it will replace the abbr title properly. But if you don't want to use
|
19
|
+
# abbr tag, you can simply give a string as below
|
20
|
+
# Formtastic::SemanticFormBuilder.required_string = "(required)"
|
21
|
+
|
22
|
+
# Set the string that will be appended to the labels/fieldsets which are optional
|
23
|
+
# Defaults to an empty string ("") and also accepts procs (see required_string above)
|
24
|
+
# Formtastic::SemanticFormBuilder.optional_string = "(optional)"
|
25
|
+
|
26
|
+
# Set the way inline errors will be displayed.
|
27
|
+
# Defaults to :sentence, valid options are :sentence, :list and :none
|
28
|
+
# Formtastic::SemanticFormBuilder.inline_errors = :sentence
|
29
|
+
|
30
|
+
# Set the method to call on label text to transform or format it for human-friendly
|
31
|
+
# reading when formtastic is user without object. Defaults to :humanize.
|
32
|
+
# Formtastic::SemanticFormBuilder.label_str_method = :humanize
|
33
|
+
|
34
|
+
# Set the array of methods to try calling on parent objects in :select and :radio inputs
|
35
|
+
# for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
|
36
|
+
# that is found on the object will be used.
|
37
|
+
# Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
38
|
+
# Formtastic::SemanticFormBuilder.collection_label_methods = [
|
39
|
+
# "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
40
|
+
|
41
|
+
# Formtastic by default renders inside li tags the input, hints and then
|
42
|
+
# errors messages. Sometimes you want the hints to be rendered first than
|
43
|
+
# the input, in the following order: hints, input and errors. You can
|
44
|
+
# customize it doing just as below:
|
45
|
+
# Formtastic::SemanticFormBuilder.inline_order = [:input, :hints, :errors]
|
46
|
+
|
47
|
+
# Specifies if labels/hints for input fields automatically be looked up using I18n.
|
48
|
+
# Default value: false. Overridden for specific fields by setting value to true,
|
49
|
+
# i.e. :label => true, or :hint => true (or opposite depending on initialized value)
|
50
|
+
# Formtastic::SemanticFormBuilder.i18n_lookups_by_default = false
|
51
|
+
|
52
|
+
# You can add custom inputs or override parts of Formtastic by subclassing SemanticFormBuilder and
|
53
|
+
# specifying that class here. Defaults to SemanticFormBuilder.
|
54
|
+
# Formtastic::SemanticFormHelper.builder = MyCustomBuilder
|