super-sharp-sys 0.0.1

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.

Potentially problematic release.


This version of super-sharp-sys might be problematic. Click here for more details.

Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/formtastic-6.0.0/Appraisals +23 -0
  3. data/formtastic-6.0.0/CONTRIBUTING.md +27 -0
  4. data/formtastic-6.0.0/Gemfile +8 -0
  5. data/formtastic-6.0.0/MIT-LICENSE +20 -0
  6. data/formtastic-6.0.0/README.md +600 -0
  7. data/formtastic-6.0.0/RELEASE_PROCESS +7 -0
  8. data/formtastic-6.0.0/Rakefile +54 -0
  9. data/formtastic-6.0.0/bin/appraisal +8 -0
  10. data/formtastic-6.0.0/formtastic.gemspec +45 -0
  11. data/formtastic-6.0.0/gemfiles/rails_72.gemfile +9 -0
  12. data/formtastic-6.0.0/gemfiles/rails_80.gemfile +9 -0
  13. data/formtastic-6.0.0/gemfiles/rails_81.gemfile +9 -0
  14. data/formtastic-6.0.0/gemfiles/rails_edge.gemfile +9 -0
  15. data/formtastic-6.0.0/lib/formtastic/action_class_finder.rb +19 -0
  16. data/formtastic-6.0.0/lib/formtastic/actions/base.rb +157 -0
  17. data/formtastic-6.0.0/lib/formtastic/actions/button_action.rb +68 -0
  18. data/formtastic-6.0.0/lib/formtastic/actions/buttonish.rb +18 -0
  19. data/formtastic-6.0.0/lib/formtastic/actions/input_action.rb +71 -0
  20. data/formtastic-6.0.0/lib/formtastic/actions/link_action.rb +89 -0
  21. data/formtastic-6.0.0/lib/formtastic/actions.rb +15 -0
  22. data/formtastic-6.0.0/lib/formtastic/deprecation.rb +6 -0
  23. data/formtastic-6.0.0/lib/formtastic/form_builder.rb +109 -0
  24. data/formtastic-6.0.0/lib/formtastic/helpers/action_helper.rb +115 -0
  25. data/formtastic-6.0.0/lib/formtastic/helpers/actions_helper.rb +169 -0
  26. data/formtastic-6.0.0/lib/formtastic/helpers/enum.rb +14 -0
  27. data/formtastic-6.0.0/lib/formtastic/helpers/errors_helper.rb +139 -0
  28. data/formtastic-6.0.0/lib/formtastic/helpers/fieldset_wrapper.rb +85 -0
  29. data/formtastic-6.0.0/lib/formtastic/helpers/file_column_detection.rb +17 -0
  30. data/formtastic-6.0.0/lib/formtastic/helpers/form_helper.rb +204 -0
  31. data/formtastic-6.0.0/lib/formtastic/helpers/input_helper.rb +349 -0
  32. data/formtastic-6.0.0/lib/formtastic/helpers/inputs_helper.rb +421 -0
  33. data/formtastic-6.0.0/lib/formtastic/helpers/reflection.rb +38 -0
  34. data/formtastic-6.0.0/lib/formtastic/helpers.rb +16 -0
  35. data/formtastic-6.0.0/lib/formtastic/html_attributes.rb +33 -0
  36. data/formtastic-6.0.0/lib/formtastic/i18n.rb +33 -0
  37. data/formtastic-6.0.0/lib/formtastic/input_class_finder.rb +19 -0
  38. data/formtastic-6.0.0/lib/formtastic/inputs/base/aria.rb +26 -0
  39. data/formtastic-6.0.0/lib/formtastic/inputs/base/associations.rb +32 -0
  40. data/formtastic-6.0.0/lib/formtastic/inputs/base/choices.rb +109 -0
  41. data/formtastic-6.0.0/lib/formtastic/inputs/base/collections.rb +158 -0
  42. data/formtastic-6.0.0/lib/formtastic/inputs/base/database.rb +20 -0
  43. data/formtastic-6.0.0/lib/formtastic/inputs/base/datetime_pickerish.rb +86 -0
  44. data/formtastic-6.0.0/lib/formtastic/inputs/base/errors.rb +59 -0
  45. data/formtastic-6.0.0/lib/formtastic/inputs/base/fileish.rb +24 -0
  46. data/formtastic-6.0.0/lib/formtastic/inputs/base/hints.rb +32 -0
  47. data/formtastic-6.0.0/lib/formtastic/inputs/base/html.rb +54 -0
  48. data/formtastic-6.0.0/lib/formtastic/inputs/base/labelling.rb +53 -0
  49. data/formtastic-6.0.0/lib/formtastic/inputs/base/naming.rb +43 -0
  50. data/formtastic-6.0.0/lib/formtastic/inputs/base/numeric.rb +51 -0
  51. data/formtastic-6.0.0/lib/formtastic/inputs/base/options.rb +18 -0
  52. data/formtastic-6.0.0/lib/formtastic/inputs/base/placeholder.rb +18 -0
  53. data/formtastic-6.0.0/lib/formtastic/inputs/base/stringish.rb +39 -0
  54. data/formtastic-6.0.0/lib/formtastic/inputs/base/timeish.rb +246 -0
  55. data/formtastic-6.0.0/lib/formtastic/inputs/base/validations.rb +250 -0
  56. data/formtastic-6.0.0/lib/formtastic/inputs/base/wrapping.rb +51 -0
  57. data/formtastic-6.0.0/lib/formtastic/inputs/base.rb +79 -0
  58. data/formtastic-6.0.0/lib/formtastic/inputs/boolean_input.rb +119 -0
  59. data/formtastic-6.0.0/lib/formtastic/inputs/check_boxes_input.rb +198 -0
  60. data/formtastic-6.0.0/lib/formtastic/inputs/color_input.rb +42 -0
  61. data/formtastic-6.0.0/lib/formtastic/inputs/country_input.rb +90 -0
  62. data/formtastic-6.0.0/lib/formtastic/inputs/datalist_input.rb +42 -0
  63. data/formtastic-6.0.0/lib/formtastic/inputs/date_picker_input.rb +94 -0
  64. data/formtastic-6.0.0/lib/formtastic/inputs/date_select_input.rb +35 -0
  65. data/formtastic-6.0.0/lib/formtastic/inputs/datetime_picker_input.rb +104 -0
  66. data/formtastic-6.0.0/lib/formtastic/inputs/datetime_select_input.rb +13 -0
  67. data/formtastic-6.0.0/lib/formtastic/inputs/email_input.rb +42 -0
  68. data/formtastic-6.0.0/lib/formtastic/inputs/file_input.rb +43 -0
  69. data/formtastic-6.0.0/lib/formtastic/inputs/hidden_input.rb +63 -0
  70. data/formtastic-6.0.0/lib/formtastic/inputs/number_input.rb +89 -0
  71. data/formtastic-6.0.0/lib/formtastic/inputs/password_input.rb +42 -0
  72. data/formtastic-6.0.0/lib/formtastic/inputs/phone_input.rb +43 -0
  73. data/formtastic-6.0.0/lib/formtastic/inputs/radio_input.rb +164 -0
  74. data/formtastic-6.0.0/lib/formtastic/inputs/range_input.rb +96 -0
  75. data/formtastic-6.0.0/lib/formtastic/inputs/search_input.rb +42 -0
  76. data/formtastic-6.0.0/lib/formtastic/inputs/select_input.rb +236 -0
  77. data/formtastic-6.0.0/lib/formtastic/inputs/string_input.rb +37 -0
  78. data/formtastic-6.0.0/lib/formtastic/inputs/text_input.rb +49 -0
  79. data/formtastic-6.0.0/lib/formtastic/inputs/time_picker_input.rb +100 -0
  80. data/formtastic-6.0.0/lib/formtastic/inputs/time_select_input.rb +39 -0
  81. data/formtastic-6.0.0/lib/formtastic/inputs/time_zone_input.rb +59 -0
  82. data/formtastic-6.0.0/lib/formtastic/inputs/url_input.rb +42 -0
  83. data/formtastic-6.0.0/lib/formtastic/inputs.rb +43 -0
  84. data/formtastic-6.0.0/lib/formtastic/localized_string.rb +18 -0
  85. data/formtastic-6.0.0/lib/formtastic/localizer.rb +151 -0
  86. data/formtastic-6.0.0/lib/formtastic/namespaced_class_finder.rb +98 -0
  87. data/formtastic-6.0.0/lib/formtastic/version.rb +4 -0
  88. data/formtastic-6.0.0/lib/formtastic.rb +196 -0
  89. data/formtastic-6.0.0/lib/generators/formtastic/form/form_generator.rb +111 -0
  90. data/formtastic-6.0.0/lib/generators/formtastic/input/input_generator.rb +47 -0
  91. data/formtastic-6.0.0/lib/generators/formtastic/install/install_generator.rb +23 -0
  92. data/formtastic-6.0.0/lib/generators/formtastic/stylesheets/stylesheets_generator.rb +15 -0
  93. data/formtastic-6.0.0/lib/generators/templates/_form.html.erb +11 -0
  94. data/formtastic-6.0.0/lib/generators/templates/_form.html.haml +8 -0
  95. data/formtastic-6.0.0/lib/generators/templates/_form.html.slim +8 -0
  96. data/formtastic-6.0.0/lib/generators/templates/formtastic.css +289 -0
  97. data/formtastic-6.0.0/lib/generators/templates/formtastic.rb +118 -0
  98. data/formtastic-6.0.0/lib/generators/templates/input.rb +19 -0
  99. data/formtastic-6.0.0/lib/locale/en.yml +10 -0
  100. data/formtastic-6.0.0/sample/basic_inputs.html +224 -0
  101. data/formtastic-6.0.0/sample/config.ru +69 -0
  102. data/formtastic-6.0.0/sample/index.html +14 -0
  103. data/formtastic-6.0.0/script/integration-template.rb +76 -0
  104. data/formtastic-6.0.0/script/integration.sh +32 -0
  105. data/formtastic-6.0.0/spec/action_class_finder_spec.rb +12 -0
  106. data/formtastic-6.0.0/spec/actions/button_action_spec.rb +63 -0
  107. data/formtastic-6.0.0/spec/actions/generic_action_spec.rb +521 -0
  108. data/formtastic-6.0.0/spec/actions/input_action_spec.rb +59 -0
  109. data/formtastic-6.0.0/spec/actions/link_action_spec.rb +92 -0
  110. data/formtastic-6.0.0/spec/builder/custom_builder_spec.rb +132 -0
  111. data/formtastic-6.0.0/spec/builder/error_proc_spec.rb +27 -0
  112. data/formtastic-6.0.0/spec/builder/semantic_fields_for_spec.rb +213 -0
  113. data/formtastic-6.0.0/spec/fast_spec_helper.rb +12 -0
  114. data/formtastic-6.0.0/spec/generators/formtastic/form/form_generator_spec.rb +132 -0
  115. data/formtastic-6.0.0/spec/generators/formtastic/input/input_generator_spec.rb +125 -0
  116. data/formtastic-6.0.0/spec/generators/formtastic/install/install_generator_spec.rb +48 -0
  117. data/formtastic-6.0.0/spec/generators/formtastic/stylesheets/stylesheets_generator_spec.rb +22 -0
  118. data/formtastic-6.0.0/spec/helpers/action_helper_spec.rb +338 -0
  119. data/formtastic-6.0.0/spec/helpers/actions_helper_spec.rb +143 -0
  120. data/formtastic-6.0.0/spec/helpers/form_helper_spec.rb +224 -0
  121. data/formtastic-6.0.0/spec/helpers/input_helper_spec.rb +991 -0
  122. data/formtastic-6.0.0/spec/helpers/inputs_helper_spec.rb +669 -0
  123. data/formtastic-6.0.0/spec/helpers/reflection_helper_spec.rb +32 -0
  124. data/formtastic-6.0.0/spec/helpers/semantic_errors_helper_spec.rb +220 -0
  125. data/formtastic-6.0.0/spec/i18n_spec.rb +210 -0
  126. data/formtastic-6.0.0/spec/input_class_finder_spec.rb +10 -0
  127. data/formtastic-6.0.0/spec/inputs/base/collections_spec.rb +119 -0
  128. data/formtastic-6.0.0/spec/inputs/base/validations_spec.rb +481 -0
  129. data/formtastic-6.0.0/spec/inputs/boolean_input_spec.rb +254 -0
  130. data/formtastic-6.0.0/spec/inputs/check_boxes_input_spec.rb +547 -0
  131. data/formtastic-6.0.0/spec/inputs/color_input_spec.rb +85 -0
  132. data/formtastic-6.0.0/spec/inputs/country_input_spec.rb +133 -0
  133. data/formtastic-6.0.0/spec/inputs/custom_input_spec.rb +51 -0
  134. data/formtastic-6.0.0/spec/inputs/datalist_input_spec.rb +61 -0
  135. data/formtastic-6.0.0/spec/inputs/date_picker_input_spec.rb +449 -0
  136. data/formtastic-6.0.0/spec/inputs/date_select_input_spec.rb +249 -0
  137. data/formtastic-6.0.0/spec/inputs/datetime_picker_input_spec.rb +490 -0
  138. data/formtastic-6.0.0/spec/inputs/datetime_select_input_spec.rb +209 -0
  139. data/formtastic-6.0.0/spec/inputs/email_input_spec.rb +85 -0
  140. data/formtastic-6.0.0/spec/inputs/file_input_spec.rb +89 -0
  141. data/formtastic-6.0.0/spec/inputs/hidden_input_spec.rb +135 -0
  142. data/formtastic-6.0.0/spec/inputs/include_blank_spec.rb +78 -0
  143. data/formtastic-6.0.0/spec/inputs/label_spec.rb +181 -0
  144. data/formtastic-6.0.0/spec/inputs/number_input_spec.rb +815 -0
  145. data/formtastic-6.0.0/spec/inputs/password_input_spec.rb +99 -0
  146. data/formtastic-6.0.0/spec/inputs/phone_input_spec.rb +85 -0
  147. data/formtastic-6.0.0/spec/inputs/placeholder_spec.rb +71 -0
  148. data/formtastic-6.0.0/spec/inputs/radio_input_spec.rb +326 -0
  149. data/formtastic-6.0.0/spec/inputs/range_input_spec.rb +505 -0
  150. data/formtastic-6.0.0/spec/inputs/readonly_spec.rb +50 -0
  151. data/formtastic-6.0.0/spec/inputs/search_input_spec.rb +84 -0
  152. data/formtastic-6.0.0/spec/inputs/select_input_spec.rb +661 -0
  153. data/formtastic-6.0.0/spec/inputs/string_input_spec.rb +326 -0
  154. data/formtastic-6.0.0/spec/inputs/text_input_spec.rb +187 -0
  155. data/formtastic-6.0.0/spec/inputs/time_picker_input_spec.rb +455 -0
  156. data/formtastic-6.0.0/spec/inputs/time_select_input_spec.rb +261 -0
  157. data/formtastic-6.0.0/spec/inputs/time_zone_input_spec.rb +143 -0
  158. data/formtastic-6.0.0/spec/inputs/url_input_spec.rb +85 -0
  159. data/formtastic-6.0.0/spec/inputs/with_options_spec.rb +43 -0
  160. data/formtastic-6.0.0/spec/localizer_spec.rb +130 -0
  161. data/formtastic-6.0.0/spec/namespaced_class_finder_spec.rb +90 -0
  162. data/formtastic-6.0.0/spec/schema.rb +22 -0
  163. data/formtastic-6.0.0/spec/spec.opts +2 -0
  164. data/formtastic-6.0.0/spec/spec_helper.rb +466 -0
  165. data/formtastic-6.0.0/spec/support/custom_macros.rb +570 -0
  166. data/formtastic-6.0.0/spec/support/deprecation.rb +7 -0
  167. data/formtastic-6.0.0/spec/support/shared_examples.rb +13 -0
  168. data/formtastic-6.0.0/spec/support/specialized_class_finder_shared_example.rb +27 -0
  169. data/formtastic-6.0.0/spec/support/test_environment.rb +46 -0
  170. data/super-sharp-sys.gemspec +11 -0
  171. metadata +209 -0
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+ module Formtastic
3
+ # Generates a Formtastic form partial based on an existing model. It will not overwrite existing
4
+ # files without confirmation.
5
+ #
6
+ # @example
7
+ # !!!shell
8
+ # $ rails generate formtastic:form Post
9
+ # @example Copy the partial code to the pasteboard rather than generating a partial
10
+ # !!!shell
11
+ # $ rails generate formtastic:form Post --copy
12
+ # @example Return HAML or Slim output instead of default ERB
13
+ # !!!shell
14
+ # $ rails generate formtastic:form Post --template-engine haml
15
+ # $ rails generate formtastic:form Post --template-engine slim
16
+ # @example Generate a form for specific model attributes
17
+ # !!!shell
18
+ # $ rails generate formtastic:form Post title:string body:text
19
+ # @example Generate a form for a specific controller
20
+ # !!!shell
21
+ # $ rails generate formtastic:form Post --controller admin/posts
22
+ class FormGenerator < Rails::Generators::NamedBase
23
+ desc "Generates a Formtastic form partial based on an existing model."
24
+
25
+ argument :name, :type => :string, :required => true, :banner => 'MODEL_NAME'
26
+ argument :attributes, :type => :array, :default => [], :banner => 'attribute attribute'
27
+
28
+ source_root File.expand_path('../../../templates', __FILE__)
29
+
30
+ class_option :template_engine
31
+
32
+ class_option :copy, :type => :boolean, :default => false, :group => :formtastic,
33
+ :desc => 'Copy the generated code the clipboard instead of generating a partial file."'
34
+
35
+ class_option :controller, :type => :string, :default => nil, :group => :formtastic,
36
+ :desc => 'Generate for custom controller/view path - in case model and controller namespace is different, i.e. "admin/posts"'
37
+
38
+ def create_or_show
39
+ @attributes = reflected_attributes if @attributes.empty?
40
+
41
+ engine = options[:template_engine]
42
+
43
+ if options[:copy]
44
+ template = File.read("#{self.class.source_root}/_form.html.#{engine}")
45
+ erb = ERB.new(template, trim_mode: '-')
46
+ generated_code = erb.result(binding).strip rescue nil
47
+ puts "The following code has been copied to the clipboard, just paste it in your views:" if save_to_clipboard(generated_code)
48
+ puts generated_code || "Error: Nothing generated. Does the model exist?"
49
+ else
50
+ empty_directory "app/views/#{controller_path}"
51
+ template "_form.html.#{engine}", "app/views/#{controller_path}/_form.html.#{engine}"
52
+ end
53
+ end
54
+
55
+ protected
56
+
57
+ def controller_path
58
+ @controller_path ||= if options[:controller]
59
+ options[:controller].underscore
60
+ else
61
+ name.underscore.pluralize
62
+ end
63
+ end
64
+
65
+ def reflected_attributes
66
+ columns = content_columns
67
+ columns += association_columns
68
+ end
69
+
70
+ def model
71
+ @model ||= name.camelize.constantize
72
+ end
73
+
74
+ # Collects content columns (non-relation columns) for the current class.
75
+ # Skips Active Record Timestamps.
76
+ def content_columns
77
+ model.content_columns.select do |column|
78
+ !Formtastic::FormBuilder.skipped_columns.include? column.name.to_sym
79
+ end
80
+ end
81
+
82
+ # Collects association columns (relation columns) for the current class. Skips polymorphic
83
+ # associations because we can't guess which class to use for an automatically generated input.
84
+ def association_columns
85
+ model.reflect_on_all_associations(:belongs_to).select do |association_reflection|
86
+ association_reflection.options[:polymorphic] != true
87
+ end
88
+ end
89
+
90
+ def save_to_clipboard(data)
91
+ return unless data
92
+
93
+ begin
94
+ case RUBY_PLATFORM
95
+ when /win32/
96
+ require 'win32/clipboard'
97
+ ::Win32::Clipboard.data = data
98
+ when /darwin/ # mac
99
+ `echo "#{data}" | pbcopy`
100
+ else # linux/unix
101
+ `echo "#{data}" | xsel --clipboard` || `echo "#{data}" | xclip`
102
+ end
103
+ rescue LoadError
104
+ false
105
+ else
106
+ true
107
+ end
108
+ end
109
+
110
+ end
111
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ module Formtastic
3
+
4
+ # Modify existing inputs, subclass them, or create your own from scratch.
5
+ # @example
6
+ # !!!shell
7
+ # $ rails generate formtastic:input HatSize
8
+
9
+ # @example Define input name using underscore convention
10
+ # !!!shell
11
+ # $ rails generate formtastic:input hat_size
12
+
13
+ # @example Override an existing input behavior
14
+ # !!!shell
15
+ # $ rails generate formtastic:input string --extend
16
+
17
+ # @example Extend an existing input behavior
18
+ # !!!shell
19
+ # $ rails generate formtastic:input FlexibleText --extend string
20
+ class InputGenerator < Rails::Generators::NamedBase
21
+
22
+ argument :name, :type => :string, :required => true, :banner => 'FILE_NAME'
23
+
24
+ source_root File.expand_path('../../../templates', __FILE__)
25
+
26
+ class_option :extend
27
+
28
+ def create
29
+ normalize_file_name
30
+ define_extension_sentence
31
+ template "input.rb", "app/inputs/#{name.underscore}_input.rb"
32
+ end
33
+
34
+ protected
35
+
36
+ def normalize_file_name
37
+ name.chomp!("Input") if name.ends_with?("Input")
38
+ name.chomp!("_input") if name.ends_with?("_input")
39
+ name.chomp!("input") if name.ends_with?("input")
40
+ end
41
+
42
+ def define_extension_sentence
43
+ @extension_sentence = "< Formtastic::Inputs::#{name.camelize}Input" if options[:extend] == "extend"
44
+ @extension_sentence ||= "< Formtastic::Inputs::#{options[:extend].camelize}Input" if options[:extend]
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Formtastic
4
+ # Copies a config initializer to config/initializers/formtastic.rb
5
+ #
6
+ # @example
7
+ # !!!shell
8
+ # $ rails generate formtastic:install
9
+ class InstallGenerator < Rails::Generators::Base
10
+ source_root File.expand_path('../../../templates', __FILE__)
11
+ class_option :template_engine
12
+
13
+ desc "Copies a config initializer to config/initializers/formtastic.rb"
14
+ def copy_files
15
+ copy_file 'formtastic.rb', 'config/initializers/formtastic.rb'
16
+ end
17
+
18
+ def copy_scaffold_template
19
+ engine = options[:template_engine]
20
+ copy_file "_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Formtastic
2
+ # Copies a stylesheet into to app/assets/stylesheets/formtastic.css
3
+ #
4
+ # @example
5
+ # !!!shell
6
+ # $ rails generate formtastic:stylesheets
7
+ class StylesheetsGenerator < Rails::Generators::Base
8
+ source_root File.expand_path("../../../templates", __FILE__)
9
+
10
+ desc "Copies Formtastic example stylesheet into your app"
11
+ def copy_files
12
+ copy_file "formtastic.css", "app/assets/stylesheets/formtastic.css"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ <%%= semantic_form_for @<%= singular_name %> do |f| %>
2
+ <%%= f.inputs do %>
3
+ <%- attributes.each do |attribute| -%>
4
+ <%%= f.input :<%= attribute.name %> %>
5
+ <%- end -%>
6
+ <%% end %>
7
+
8
+ <%%= f.actions do %>
9
+ <%%= f.action :submit, :as => :input %>
10
+ <%% end %>
11
+ <%% end %>
@@ -0,0 +1,8 @@
1
+ = semantic_form_for @<%= singular_name %> do |f|
2
+ = f.inputs do
3
+ <%- attributes.each do |attribute| -%>
4
+ = f.input :<%= attribute.name %>
5
+ <%- end -%>
6
+
7
+ = f.actions do
8
+ = f.action :submit, :as => :input
@@ -0,0 +1,8 @@
1
+ = semantic_form_for @<%= singular_name %> do |f|
2
+ = f.inputs do
3
+ <%- attributes.each do |attribute| -%>
4
+ = f.input :<%= attribute.name %>
5
+ <%- end -%>
6
+
7
+ = f.actions do
8
+ = f.action :submit, as: :input
@@ -0,0 +1,289 @@
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 gem
8
+ (c) Justin French
9
+
10
+ --------------------------------------------------------------------------------------------------*/
11
+
12
+ /* NORMALIZE AND RESET - obviously inspired by Yahoo's reset.css, but scoped to just .formtastic
13
+ --------------------------------------------------------------------------------------------------*/
14
+ .formtastic,
15
+ .formtastic ul,
16
+ .formtastic ol,
17
+ .formtastic li,
18
+ .formtastic fieldset,
19
+ .formtastic legend,
20
+ .formtastic input,
21
+ .formtastic button,
22
+ .formtastic textarea,
23
+ .formtastic select,
24
+ .formtastic p {
25
+ margin:0;
26
+ padding:0;
27
+ }
28
+
29
+ .formtastic fieldset {
30
+ border:0;
31
+ }
32
+
33
+ .formtastic em,
34
+ .formtastic strong {
35
+ font-style:normal;
36
+ font-weight:normal;
37
+ }
38
+
39
+ .formtastic ol,
40
+ .formtastic ul {
41
+ list-style:none;
42
+ }
43
+
44
+ .formtastic abbr,
45
+ .formtastic acronym {
46
+ border:0;
47
+ font-variant:normal;
48
+ }
49
+
50
+ .formtastic input,
51
+ .formtastic button,
52
+ .formtastic textarea {
53
+ font-family:sans-serif;
54
+ font-size:inherit;
55
+ font-weight:inherit;
56
+ }
57
+
58
+ .formtastic input,
59
+ .formtastic textarea,
60
+ .formtastic select {
61
+ font-size:100%;
62
+ }
63
+
64
+ .formtastic legend {
65
+ white-space:normal;
66
+ color:#000;
67
+ }
68
+
69
+
70
+ /* SEMANTIC ERRORS
71
+ --------------------------------------------------------------------------------------------------*/
72
+ .formtastic .errors {
73
+ color:#cc0000;
74
+ margin:0.5em 0 1.5em 25%;
75
+ list-style:square;
76
+ }
77
+
78
+ .formtastic .errors li {
79
+ padding:0;
80
+ border:none;
81
+ display:list-item;
82
+ }
83
+
84
+
85
+ /* BUTTONS & ACTIONS
86
+ --------------------------------------------------------------------------------------------------*/
87
+ .formtastic .buttons,
88
+ .formtastic .actions {
89
+ overflow:hidden; /* clear containing floats */
90
+ padding-left:25%;
91
+ }
92
+
93
+ .formtastic .button,
94
+ .formtastic .action {
95
+ float:left;
96
+ padding-right:0.5em;
97
+ }
98
+
99
+ .formtastic .button_action button {
100
+ padding:3px 8px;
101
+ }
102
+
103
+ .formtastic .link_action a {
104
+ display:block;
105
+ padding:3px 0;
106
+ }
107
+
108
+
109
+ /* INPUTS
110
+ --------------------------------------------------------------------------------------------------*/
111
+ .formtastic .inputs {
112
+ overflow:hidden; /* clear containing floats */
113
+ }
114
+
115
+ .formtastic .input {
116
+ overflow:hidden; /* clear containing floats */
117
+ padding:0.5em 0; /* padding and negative margin juggling is for Firefox */
118
+ margin-top:-0.5em;
119
+ margin-bottom:1em;
120
+ }
121
+
122
+
123
+ /* LEFT ALIGNED LABELS
124
+ --------------------------------------------------------------------------------------------------*/
125
+ .formtastic .input .label {
126
+ display:block;
127
+ width:25%;
128
+ float:left;
129
+ padding-top:.2em;
130
+ }
131
+
132
+ .formtastic .fragments .label,
133
+ .formtastic .choices .label {
134
+ position:absolute;
135
+ width:95%;
136
+ left:0px;
137
+ }
138
+
139
+ .formtastic .fragments .label label,
140
+ .formtastic .choices .label label {
141
+ position:absolute;
142
+ }
143
+
144
+ /* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
145
+ --------------------------------------------------------------------------------------------------*/
146
+ .formtastic .choices {
147
+ position:relative;
148
+ }
149
+
150
+ .formtastic .choices-group {
151
+ float:left;
152
+ width:74%;
153
+ margin:0;
154
+ padding:0 0 0 25%;
155
+ }
156
+
157
+ .formtastic .choice {
158
+ padding:0;
159
+ border:0;
160
+ }
161
+
162
+
163
+ /* INLINE HINTS
164
+ --------------------------------------------------------------------------------------------------*/
165
+ .formtastic .input .inline-hints {
166
+ color:#666;
167
+ margin:0.5em 0 0 25%;
168
+ }
169
+
170
+
171
+ /* INLINE ERRORS
172
+ --------------------------------------------------------------------------------------------------*/
173
+ .formtastic .inline-errors {
174
+ color:#cc0000;
175
+ margin:0.5em 0 0 25%;
176
+ }
177
+
178
+ .formtastic .errors {
179
+ color:#cc0000;
180
+ margin:0.5em 0 0 25%;
181
+ list-style:square;
182
+ }
183
+
184
+ .formtastic .errors li {
185
+ padding:0;
186
+ border:none;
187
+ display:list-item;
188
+ }
189
+
190
+
191
+ /* STRING, NUMERIC, PASSWORD, EMAIL, URL, PHONE, SEARCH (ETC) OVERRIDES
192
+ --------------------------------------------------------------------------------------------------*/
193
+ .formtastic .stringish input {
194
+ width:72%;
195
+ }
196
+
197
+ .formtastic .stringish input[size],
198
+ .formtastic .stringish input[max] {
199
+ width:auto;
200
+ max-width:72%;
201
+ }
202
+
203
+
204
+ /* TEXTAREA OVERRIDES
205
+ --------------------------------------------------------------------------------------------------*/
206
+ .formtastic .text textarea {
207
+ width:72%;
208
+ }
209
+
210
+ .formtastic .text textarea[cols] {
211
+ width:auto;
212
+ max-width:72%;
213
+ }
214
+
215
+
216
+ /* HIDDEN OVERRIDES
217
+ --------------------------------------------------------------------------------------------------*/
218
+ .formtastic .hidden {
219
+ display:none;
220
+ }
221
+
222
+
223
+ /* BOOLEAN LABELS
224
+ --------------------------------------------------------------------------------------------------*/
225
+ .formtastic .boolean label {
226
+ margin-left:25%;
227
+ display:block;
228
+ }
229
+
230
+
231
+ /* CHOICE GROUPS
232
+ --------------------------------------------------------------------------------------------------*/
233
+ .formtastic .choices-group {
234
+ margin-bottom:-0.5em;
235
+ }
236
+
237
+ .formtastic .choice {
238
+ margin:0.1em 0 0.5em 0;
239
+ }
240
+
241
+ .formtastic .choice label {
242
+ float:none;
243
+ width:100%;
244
+ line-height:100%;
245
+ padding-top:0;
246
+ margin-bottom:0.6em;
247
+ }
248
+
249
+
250
+ /* ADJUSTMENTS FOR INPUTS INSIDE LABELS (boolean input, radio input, check_boxes input)
251
+ --------------------------------------------------------------------------------------------------*/
252
+ .formtastic .choice label input,
253
+ .formtastic .boolean label input {
254
+ margin:0 0.3em 0 0.1em;
255
+ line-height:100%;
256
+ }
257
+
258
+
259
+ /* FRAGMENTED INPUTS (DATE/TIME/DATETIME)
260
+ --------------------------------------------------------------------------------------------------*/
261
+ .formtastic .fragments {
262
+ position:relative;
263
+ }
264
+
265
+ .formtastic .fragments-group {
266
+ float:left;
267
+ width:74%;
268
+ margin:0;
269
+ padding:0 0 0 25%;
270
+ }
271
+
272
+ .formtastic .fragment {
273
+ float:left;
274
+ width:auto;
275
+ margin:0 .3em 0 0;
276
+ padding:0;
277
+ border:0;
278
+ }
279
+
280
+ .formtastic .fragment label {
281
+ display:none;
282
+ }
283
+
284
+ .formtastic .fragment label input {
285
+ display:inline;
286
+ margin:0;
287
+ padding:0;
288
+ }
289
+
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Set the default text field size when input is a string. Default is nil.
4
+ # Formtastic::FormBuilder.default_text_field_size = 50
5
+
6
+ # Set the default text area height when input is a text. Default is 20.
7
+ # Formtastic::FormBuilder.default_text_area_height = 5
8
+
9
+ # Set the default text area width when input is a text. Default is nil.
10
+ # Formtastic::FormBuilder.default_text_area_width = 50
11
+
12
+ # Should all fields be considered "required" by default?
13
+ # Defaults to true.
14
+ # Formtastic::FormBuilder.all_fields_required_by_default = true
15
+
16
+ # Should select fields have a blank option/prompt by default?
17
+ # Defaults to true.
18
+ # Formtastic::FormBuilder.include_blank_for_select_by_default = true
19
+
20
+ # Set the string that will be appended to the labels/fieldsets which are required.
21
+ # It accepts string or procs and the default is a localized version of
22
+ # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
23
+ # in your locale, it will replace the abbr title properly. But if you don't want to use
24
+ # abbr tag, you can simply give a string as below.
25
+ # Formtastic::FormBuilder.required_string = "(required)"
26
+
27
+ # Set the string that will be appended to the labels/fieldsets which are optional.
28
+ # Defaults to an empty string ("") and also accepts procs (see required_string above).
29
+ # Formtastic::FormBuilder.optional_string = "(optional)"
30
+
31
+ # Set the way inline errors will be displayed.
32
+ # Defaults to :sentence, valid options are :sentence, :list, :first and :none
33
+ # Formtastic::FormBuilder.inline_errors = :sentence
34
+ # Formtastic uses the following classes as default for hints, inline_errors and error list
35
+
36
+ # If you override the class here, please ensure to override it in your stylesheets as well.
37
+ # Formtastic::FormBuilder.default_hint_class = "inline-hints"
38
+ # Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
39
+ # Formtastic::FormBuilder.default_error_list_class = "errors"
40
+
41
+ # Set the method to call on label text to transform or format it for human-friendly
42
+ # reading when formtastic is used without object. Defaults to :humanize.
43
+ # Formtastic::FormBuilder.label_str_method = :humanize
44
+
45
+ # Set the array of methods to try calling on parent objects in :select and :radio inputs
46
+ # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
47
+ # that is found on the object will be used.
48
+ # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
49
+ # Formtastic::FormBuilder.collection_label_methods = [
50
+ # "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
51
+
52
+ # Specifies if labels/hints for input fields automatically be looked up using I18n.
53
+ # Default value: true. Overridden for specific fields by setting value to true,
54
+ # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
55
+ # Formtastic::FormBuilder.i18n_lookups_by_default = false
56
+
57
+ # Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
58
+ # Defaults to true.
59
+ # Formtastic::FormBuilder.i18n_cache_lookups = false
60
+
61
+ # Specifies the class to use for localization lookups. You can create your own
62
+ # class and use it instead by subclassing Formtastic::Localizer (which is the default).
63
+ # Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
64
+
65
+ # You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
66
+ # specifying that class here. Defaults to Formtastic::FormBuilder.
67
+ # Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
68
+
69
+ # All formtastic forms have a class that indicates that they are just that. You
70
+ # can change it to any class you want.
71
+ # Formtastic::Helpers::FormHelper.default_form_class = 'formtastic'
72
+
73
+ # Formtastic will infer a class name from the model, array, string or symbol you pass to the
74
+ # form builder. You can customize the way that class is presented by overriding
75
+ # this proc.
76
+ # Formtastic::Helpers::FormHelper.default_form_model_class_proc = proc { |model_class_name| model_class_name }
77
+
78
+ # Allows to set a custom field_error_proc wrapper. By default this wrapper
79
+ # is disabled since `formtastic` already adds an error class to the LI tag
80
+ # containing the input.
81
+ # Formtastic::Helpers::FormHelper.formtastic_field_error_proc = proc { |html_tag, instance_tag| html_tag }
82
+
83
+ # You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
84
+ # and `<textarea>` tags by setting this to true (defaults to false).
85
+ # Formtastic::FormBuilder.use_required_attribute = false
86
+
87
+ # You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
88
+ # this to true. Doing so will omit the `novalidate` attribute from the `<form>` tag.
89
+ # See http://diveintohtml5.org/forms.html#validation for more info.
90
+ # Formtastic::FormBuilder.perform_browser_validations = true
91
+
92
+ # By creating custom input class finder, you can change how input classes are looked up.
93
+ # For example you can make it to search for TextInputFilter instead of TextInput.
94
+ # See https://github.com/formtastic/formtastic/wiki/Custom-Class-Finders
95
+ # Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
96
+
97
+ # Define custom namespaces in which to look up your Input classes. Default is
98
+ # to look up in the global scope and in Formtastic::Inputs.
99
+ # Formtastic::FormBuilder.input_namespaces = [ ::Object, ::MyInputsModule, ::Formtastic::Inputs ]
100
+
101
+ # By creating custom action class finder, you can change how action classes are looked up.
102
+ # For example you can make it to search for MyButtonAction instead of ButtonAction.
103
+ # See https://github.com/formtastic/formtastic/wiki/Custom-Class-Finders
104
+ # Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
105
+
106
+ # Define custom namespaces in which to look up your Action classes. Default is
107
+ # to look up in the global scope and in Formtastic::Actions.
108
+ # Formtastic::FormBuilder.action_namespaces = [ ::Object, ::MyActionsModule, ::Formtastic::Actions ]
109
+
110
+ # Which columns to skip when automatically rendering a form without any fields specified.
111
+ # Formtastic::FormBuilder.skipped_columns = [:created_at, :updated_at, :created_on, :updated_on, :lock_version, :version]
112
+
113
+ # You can opt-in to accessibility features for the `semantic_errors` helper by setting
114
+ # this to true. Doing so will render the attributes in the error summary list
115
+ # as `<li> <a>` links to the inputs that have errors. the inline error sentence's id is added to
116
+ # the errored input's aria-describedby. This ensures that the errored input is read out with
117
+ # the inline error sentence's error explanation, aria-invalid is set to true for errored inputs
118
+ # Formtastic::FormBuilder.semantic_errors_link_to_inputs = true
@@ -0,0 +1,19 @@
1
+ class <%= name.camelize %>Input <%= @extension_sentence %>
2
+ <%- if !options[:extend] -%>
3
+ include Formtastic::Inputs::Base
4
+ <%- end -%>
5
+
6
+ <%- if !options[:extend] || (options[:extend] == "extend") -%>
7
+ def to_html
8
+ # Add your custom input definition here.
9
+ <%- if options[:extend] == "extend" -%>
10
+ super
11
+ <%- end -%>
12
+ end
13
+
14
+ <%- else -%>
15
+ def input_html_options
16
+ # Add your custom input extension here.
17
+ end
18
+ <%- end -%>
19
+ end
@@ -0,0 +1,10 @@
1
+ en:
2
+ formtastic:
3
+ :yes: 'Yes'
4
+ :no: 'No'
5
+ :create: 'Create %{model}'
6
+ :update: 'Update %{model}'
7
+ :submit: 'Submit %{model}'
8
+ :cancel: 'Cancel %{model}'
9
+ :reset: 'Reset %{model}'
10
+ :required: 'required'