jintastic 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.md +97 -0
  5. data/Rakefile +59 -0
  6. data/VERSION.yml +5 -0
  7. data/assets/app/views/jintastic/_in_place_editor.html.erb +16 -0
  8. data/assets/public/javascripts/jintastic.js +35 -0
  9. data/config/locale/en.yml +4 -0
  10. data/init.rb +3 -0
  11. data/jintastic.gemspec +111 -0
  12. data/lib/jintastic.rb +61 -0
  13. data/test/jintastic_test.rb +7 -0
  14. data/test/test_helper.rb +10 -0
  15. data/vendor/plugins/formtastic/.gitignore +5 -0
  16. data/vendor/plugins/formtastic/MIT-LICENSE +20 -0
  17. data/vendor/plugins/formtastic/README.textile +553 -0
  18. data/vendor/plugins/formtastic/RELEASE_PROCESS +11 -0
  19. data/vendor/plugins/formtastic/Rakefile +101 -0
  20. data/vendor/plugins/formtastic/VERSION.yml +4 -0
  21. data/vendor/plugins/formtastic/formtastic.gemspec +142 -0
  22. data/vendor/plugins/formtastic/generators/form/USAGE +16 -0
  23. data/vendor/plugins/formtastic/generators/form/form_generator.rb +120 -0
  24. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.erb +5 -0
  25. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.haml +4 -0
  26. data/vendor/plugins/formtastic/generators/formtastic/formtastic_generator.rb +24 -0
  27. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic.css +144 -0
  28. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_changes.css +10 -0
  29. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_config.rb +54 -0
  30. data/vendor/plugins/formtastic/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +16 -0
  31. data/vendor/plugins/formtastic/install.rb +2 -0
  32. data/vendor/plugins/formtastic/lib/formtastic.rb +1687 -0
  33. data/vendor/plugins/formtastic/lib/formtastic/i18n.rb +32 -0
  34. data/vendor/plugins/formtastic/lib/locale/en.yml +8 -0
  35. data/vendor/plugins/formtastic/rails/init.rb +3 -0
  36. data/vendor/plugins/formtastic/spec/buttons_spec.rb +149 -0
  37. data/vendor/plugins/formtastic/spec/commit_button_spec.rb +369 -0
  38. data/vendor/plugins/formtastic/spec/custom_builder_spec.rb +62 -0
  39. data/vendor/plugins/formtastic/spec/custom_macros.rb +561 -0
  40. data/vendor/plugins/formtastic/spec/defaults_spec.rb +20 -0
  41. data/vendor/plugins/formtastic/spec/error_proc_spec.rb +27 -0
  42. data/vendor/plugins/formtastic/spec/errors_spec.rb +85 -0
  43. data/vendor/plugins/formtastic/spec/form_helper_spec.rb +126 -0
  44. data/vendor/plugins/formtastic/spec/i18n_spec.rb +131 -0
  45. data/vendor/plugins/formtastic/spec/include_blank_spec.rb +70 -0
  46. data/vendor/plugins/formtastic/spec/input_spec.rb +628 -0
  47. data/vendor/plugins/formtastic/spec/inputs/boolean_input_spec.rb +93 -0
  48. data/vendor/plugins/formtastic/spec/inputs/check_boxes_input_spec.rb +162 -0
  49. data/vendor/plugins/formtastic/spec/inputs/country_input_spec.rb +80 -0
  50. data/vendor/plugins/formtastic/spec/inputs/date_input_spec.rb +60 -0
  51. data/vendor/plugins/formtastic/spec/inputs/datetime_input_spec.rb +169 -0
  52. data/vendor/plugins/formtastic/spec/inputs/file_input_spec.rb +33 -0
  53. data/vendor/plugins/formtastic/spec/inputs/hidden_input_spec.rb +52 -0
  54. data/vendor/plugins/formtastic/spec/inputs/numeric_input_spec.rb +44 -0
  55. data/vendor/plugins/formtastic/spec/inputs/password_input_spec.rb +46 -0
  56. data/vendor/plugins/formtastic/spec/inputs/radio_input_spec.rb +149 -0
  57. data/vendor/plugins/formtastic/spec/inputs/select_input_spec.rb +459 -0
  58. data/vendor/plugins/formtastic/spec/inputs/string_input_spec.rb +47 -0
  59. data/vendor/plugins/formtastic/spec/inputs/text_input_spec.rb +33 -0
  60. data/vendor/plugins/formtastic/spec/inputs/time_input_spec.rb +44 -0
  61. data/vendor/plugins/formtastic/spec/inputs/time_zone_input_spec.rb +102 -0
  62. data/vendor/plugins/formtastic/spec/inputs_spec.rb +395 -0
  63. data/vendor/plugins/formtastic/spec/label_spec.rb +48 -0
  64. data/vendor/plugins/formtastic/spec/semantic_errors_spec.rb +98 -0
  65. data/vendor/plugins/formtastic/spec/semantic_fields_for_spec.rb +44 -0
  66. data/vendor/plugins/formtastic/spec/spec.opts +2 -0
  67. data/vendor/plugins/formtastic/spec/spec_helper.rb +218 -0
  68. data/vendor/plugins/formtastic/uninstall.rb +1 -0
  69. metadata +132 -0
@@ -0,0 +1,11 @@
1
+ git status # check you have a clean working directory
2
+ rake version:bump:minor # or patch or major, commits the change
3
+ rake gemspec # to generate the new gemspec file
4
+ git add formtastic.gemspec # stage changes
5
+ git commit -am "new gemspec" # commit and describe the reason for the new gem
6
+ git tag -am "0.2.3" 0.2.3 # tag the new version in the code base too
7
+ git log 0.2.2..0.2.3 # check the log since last tag
8
+ gem build formtastic.gemspec # build the gem
9
+ gem push formtastic-0.2.3.gem # publish the gem
10
+ git push # push to github
11
+ git push --tags # push the tags up to remote too
@@ -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,4 @@
1
+ ---
2
+ :minor: 9
3
+ :patch: 7
4
+ :major: 0
@@ -0,0 +1,142 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{formtastic}
8
+ s.version = "0.9.7"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Justin French"]
12
+ s.date = %q{2009-12-04}
13
+ s.description = %q{A Rails form builder plugin/gem with semantically rich and accessible markup}
14
+ s.email = %q{justin@indent.com.au}
15
+ s.extra_rdoc_files = [
16
+ "README.textile"
17
+ ]
18
+ s.files = [
19
+ "MIT-LICENSE",
20
+ "README.textile",
21
+ "Rakefile",
22
+ "generators/form/USAGE",
23
+ "generators/form/form_generator.rb",
24
+ "generators/form/templates/view__form.html.erb",
25
+ "generators/form/templates/view__form.html.haml",
26
+ "generators/formtastic/formtastic_generator.rb",
27
+ "generators/formtastic/templates/formtastic.css",
28
+ "generators/formtastic/templates/formtastic.rb",
29
+ "generators/formtastic/templates/formtastic_changes.css",
30
+ "generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb",
31
+ "lib/formtastic.rb",
32
+ "lib/formtastic/i18n.rb",
33
+ "lib/locale/en.yml",
34
+ "rails/init.rb",
35
+ "spec/buttons_spec.rb",
36
+ "spec/commit_button_spec.rb",
37
+ "spec/custom_builder_spec.rb",
38
+ "spec/custom_macros.rb",
39
+ "spec/defaults_spec.rb",
40
+ "spec/error_proc_spec.rb",
41
+ "spec/errors_spec.rb",
42
+ "spec/form_helper_spec.rb",
43
+ "spec/i18n_spec.rb",
44
+ "spec/include_blank_spec.rb",
45
+ "spec/input_spec.rb",
46
+ "spec/inputs/boolean_input_spec.rb",
47
+ "spec/inputs/check_boxes_input_spec.rb",
48
+ "spec/inputs/country_input_spec.rb",
49
+ "spec/inputs/date_input_spec.rb",
50
+ "spec/inputs/datetime_input_spec.rb",
51
+ "spec/inputs/file_input_spec.rb",
52
+ "spec/inputs/hidden_input_spec.rb",
53
+ "spec/inputs/numeric_input_spec.rb",
54
+ "spec/inputs/password_input_spec.rb",
55
+ "spec/inputs/radio_input_spec.rb",
56
+ "spec/inputs/select_input_spec.rb",
57
+ "spec/inputs/string_input_spec.rb",
58
+ "spec/inputs/text_input_spec.rb",
59
+ "spec/inputs/time_input_spec.rb",
60
+ "spec/inputs/time_zone_input_spec.rb",
61
+ "spec/inputs_spec.rb",
62
+ "spec/label_spec.rb",
63
+ "spec/semantic_fields_for_spec.rb",
64
+ "spec/spec.opts",
65
+ "spec/spec_helper.rb"
66
+ ]
67
+ s.homepage = %q{http://github.com/justinfrench/formtastic/tree/master}
68
+ s.post_install_message = %q{
69
+ ========================================================================
70
+ Thanks for installing Formtastic!
71
+ ------------------------------------------------------------------------
72
+ You can now (optionally) run the generator to copy some stylesheets and
73
+ a config initializer into your application:
74
+ ./script/generate formtastic
75
+
76
+ To generate some semantic form markup for your exisiting models, just run:
77
+ ./script/generate form MODEL_NAME
78
+
79
+ Find out more and get involved:
80
+ http://github.com/justinfrench/formtastic
81
+ http://groups.google.com.au/group/formtastic
82
+ ========================================================================
83
+ }
84
+ s.rdoc_options = ["--charset=UTF-8"]
85
+ s.require_paths = ["lib"]
86
+ s.rubygems_version = %q{1.3.5}
87
+ s.summary = %q{A Rails form builder plugin/gem with semantically rich and accessible markup}
88
+ s.test_files = [
89
+ "spec/buttons_spec.rb",
90
+ "spec/commit_button_spec.rb",
91
+ "spec/custom_builder_spec.rb",
92
+ "spec/custom_macros.rb",
93
+ "spec/defaults_spec.rb",
94
+ "spec/error_proc_spec.rb",
95
+ "spec/errors_spec.rb",
96
+ "spec/form_helper_spec.rb",
97
+ "spec/i18n_spec.rb",
98
+ "spec/include_blank_spec.rb",
99
+ "spec/input_spec.rb",
100
+ "spec/inputs/boolean_input_spec.rb",
101
+ "spec/inputs/check_boxes_input_spec.rb",
102
+ "spec/inputs/country_input_spec.rb",
103
+ "spec/inputs/date_input_spec.rb",
104
+ "spec/inputs/datetime_input_spec.rb",
105
+ "spec/inputs/file_input_spec.rb",
106
+ "spec/inputs/hidden_input_spec.rb",
107
+ "spec/inputs/numeric_input_spec.rb",
108
+ "spec/inputs/password_input_spec.rb",
109
+ "spec/inputs/radio_input_spec.rb",
110
+ "spec/inputs/select_input_spec.rb",
111
+ "spec/inputs/string_input_spec.rb",
112
+ "spec/inputs/text_input_spec.rb",
113
+ "spec/inputs/time_input_spec.rb",
114
+ "spec/inputs/time_zone_input_spec.rb",
115
+ "spec/inputs_spec.rb",
116
+ "spec/label_spec.rb",
117
+ "spec/semantic_fields_for_spec.rb",
118
+ "spec/spec_helper.rb"
119
+ ]
120
+
121
+ if s.respond_to? :specification_version then
122
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
123
+ s.specification_version = 3
124
+
125
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
126
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.0"])
127
+ s.add_runtime_dependency(%q<actionpack>, [">= 2.3.0"])
128
+ s.add_development_dependency(%q<rspec-rails>, [">= 1.2.6"])
129
+ s.add_development_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
130
+ else
131
+ s.add_dependency(%q<activesupport>, [">= 2.3.0"])
132
+ s.add_dependency(%q<actionpack>, [">= 2.3.0"])
133
+ s.add_dependency(%q<rspec-rails>, [">= 1.2.6"])
134
+ s.add_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
135
+ end
136
+ else
137
+ s.add_dependency(%q<activesupport>, [">= 2.3.0"])
138
+ s.add_dependency(%q<actionpack>, [">= 2.3.0"])
139
+ s.add_dependency(%q<rspec-rails>, [">= 1.2.6"])
140
+ s.add_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
141
+ end
142
+ 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,5 @@
1
+ <%% f.inputs do %>
2
+ <% attributes.each do |attribute| -%>
3
+ <%%= f.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>' %>
4
+ <% end -%>
5
+ <%% end %>
@@ -0,0 +1,4 @@
1
+ - f.inputs do
2
+ <% attributes.each do |attribute| -%>
3
+ = f.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>'
4
+ <% 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_config.rb', File.join('config', 'initializers', 'formtastic_config.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_config.rb}
22
+ end
23
+
24
+ end
@@ -0,0 +1,144 @@
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
+ /* 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 { }
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
+ /* clearfixing the fieldsets */
40
+ form.formtastic fieldset { display: inline-block; }
41
+ form.formtastic fieldset:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
42
+ html[xmlns] form.formtastic fieldset { display: block; }
43
+ * html form.formtastic fieldset { height: 1%; }
44
+
45
+
46
+ /* INPUT LIs
47
+ --------------------------------------------------------------------------------------------------*/
48
+ form.formtastic fieldset ol li { margin-bottom:1.5em; }
49
+
50
+ /* clearfixing the li's */
51
+ form.formtastic fieldset ol li { display: inline-block; }
52
+ form.formtastic fieldset ol li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
53
+ html[xmlns] form.formtastic fieldset ol li { display: block; }
54
+ * html form.formtastic fieldset ol li { height: 1%; }
55
+
56
+ form.formtastic fieldset ol li.required { }
57
+ form.formtastic fieldset ol li.optional { }
58
+ form.formtastic fieldset ol li.error { }
59
+
60
+
61
+ /* LABELS
62
+ --------------------------------------------------------------------------------------------------*/
63
+ form.formtastic fieldset ol li label { display:block; width:25%; float:left; padding-top:.2em; }
64
+ form.formtastic fieldset ol li li label { line-height:100%; padding-top:0; }
65
+ form.formtastic fieldset ol li li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;}
66
+
67
+
68
+ /* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
69
+ --------------------------------------------------------------------------------------------------*/
70
+ form.formtastic fieldset ol li fieldset { position:relative; }
71
+ form.formtastic fieldset ol li fieldset legend { position:absolute; width:25%; padding-top:0.1em; }
72
+ form.formtastic fieldset ol li fieldset legend span { position:absolute; }
73
+ form.formtastic fieldset ol li fieldset legend.label label { position:absolute; }
74
+ form.formtastic fieldset ol li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 25%; }
75
+ form.formtastic fieldset ol li fieldset ol li { padding:0; border:0; }
76
+
77
+
78
+ /* INLINE HINTS
79
+ --------------------------------------------------------------------------------------------------*/
80
+ form.formtastic fieldset ol li p.inline-hints { color:#666; margin:0.5em 0 0 25%; }
81
+
82
+
83
+ /* INLINE ERRORS
84
+ --------------------------------------------------------------------------------------------------*/
85
+ form.formtastic fieldset ol li p.inline-errors { color:#cc0000; margin:0.5em 0 0 25%; }
86
+ form.formtastic fieldset ol li ul.errors { color:#cc0000; margin:0.5em 0 0 25%; list-style:square; }
87
+ form.formtastic fieldset ol li ul.errors li { padding:0; border:none; display:list-item; }
88
+
89
+
90
+ /* STRING & NUMERIC OVERRIDES
91
+ --------------------------------------------------------------------------------------------------*/
92
+ form.formtastic fieldset ol li.string input { width:74%; }
93
+ form.formtastic fieldset ol li.password input { width:74%; }
94
+ form.formtastic fieldset ol li.numeric input { width:74%; }
95
+
96
+
97
+ /* TEXTAREA OVERRIDES
98
+ --------------------------------------------------------------------------------------------------*/
99
+ form.formtastic fieldset ol li.text textarea { width:74%; }
100
+
101
+
102
+ /* HIDDEN OVERRIDES
103
+ --------------------------------------------------------------------------------------------------*/
104
+ form.formtastic fieldset ol li.hidden { display:none; }
105
+
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 ol { margin-bottom:-0.6em; }
117
+ form.formtastic fieldset ol li.radio fieldset ol li { margin:0.1em 0 0.5em 0; }
118
+ form.formtastic fieldset ol li.radio fieldset ol li label { float:none; width:100%; }
119
+ form.formtastic fieldset ol li.radio fieldset ol li label input { margin-right:0.2em; }
120
+
121
+
122
+ /* CHECK BOXES (COLLECTION) OVERRIDES
123
+ --------------------------------------------------------------------------------------------------*/
124
+ form.formtastic fieldset ol li.check_boxes { }
125
+ form.formtastic fieldset ol li.check_boxes fieldset ol { margin-bottom:-0.6em; }
126
+ form.formtastic fieldset ol li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; }
127
+ form.formtastic fieldset ol li.check_boxes fieldset ol li label { float:none; width:100%; }
128
+ form.formtastic fieldset ol li.check_boxes fieldset ol li label input { margin-right:0.2em; }
129
+
130
+
131
+
132
+ /* DATE & TIME OVERRIDES
133
+ --------------------------------------------------------------------------------------------------*/
134
+ form.formtastic fieldset ol li.date fieldset ol li,
135
+ form.formtastic fieldset ol li.time fieldset ol li,
136
+ form.formtastic fieldset ol li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; }
137
+
138
+ form.formtastic fieldset ol li.date fieldset ol li label,
139
+ form.formtastic fieldset ol li.time fieldset ol li label,
140
+ form.formtastic fieldset ol li.datetime fieldset ol li label { display:none; }
141
+
142
+ form.formtastic fieldset ol li.date fieldset ol li label input,
143
+ form.formtastic fieldset ol li.time fieldset ol li label input,
144
+ form.formtastic fieldset ol li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; }