source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/email_input_spec.rb
Ruby
mit
5,205
master
2,370
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'email input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "when object is provided" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/datetime_select_input_spec.rb
Ruby
mit
5,205
master
9,751
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'datetime select input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "general" do before do ::I18n.backend.store_translations :en, {} @output...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/password_input_spec.rb
Ruby
mit
5,205
master
3,176
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'password input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.input(:title, :as => :password)) en...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/country_input_spec.rb
Ruby
mit
5,205
master
4,850
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'country input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "when country_select is not available as a helper from a plugin" do it "should raise an erro...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/time_zone_input_spec.rb
Ruby
mit
5,205
master
4,919
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'time_zone input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.input(:time_zone)) end) end i...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/hidden_input_spec.rb
Ruby
mit
5,205
master
4,783
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'hidden input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.input(:secret, :as => :hidden)) con...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/select_input_spec.rb
Ruby
mit
5,205
master
25,515
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'select input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe 'explicit values' do describe 'using an array of values' do before do @array_wit...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/url_input_spec.rb
Ruby
mit
5,205
master
2,342
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'url input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "when object is provided" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/with_options_spec.rb
Ruby
mit
5,205
master
1,383
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'string input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "with_options and :wrapper_html" do before do concat(semantic_form_for(@new_post) do |bu...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/readonly_spec.rb
Ruby
mit
5,205
master
1,913
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'readonly option' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "placeholder text" do [:email, :number, :password, :phone, :search, :string, :url, :text, :...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/radio_input_spec.rb
Ruby
mit
5,205
master
12,550
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'radio input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe 'for belongs_to association' do before do concat(semantic_form_for(@new_post) do |builder...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/include_blank_spec.rb
Ruby
mit
5,205
master
2,828
# frozen_string_literal: true require 'spec_helper' RSpec.describe "*select: options[:include_blank]" do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything allow(@new_post).to receive(:author_id).and_return(nil) allow(@new_post).to receive(:pu...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/time_picker_input_spec.rb
Ruby
mit
5,205
master
13,303
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'time_picker input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end context "with an object" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/datalist_input_spec.rb
Ruby
mit
5,205
master
1,831
# frozen_string_literal: true require 'spec_helper' RSpec.describe "datalist inputs" do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "renders correctly" do lists_without_values =[ %w(a b c), ["a", "b", "c"], ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/number_input_spec.rb
Ruby
mit
5,205
master
29,668
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'number input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything allow(@new_post.class).to receive(:validators_on).with(:title).and_return([ active_model_numericality_val...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/boolean_input_spec.rb
Ruby
mit
5,205
master
11,122
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'boolean input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe 'generic' do before do concat(semantic_form_for(@new_post) do |builder| concat(...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/date_select_input_spec.rb
Ruby
mit
5,205
master
10,543
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'date select input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "general" do before do @output_buffer = ActionView::OutputBuffer.new '' conc...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/file_input_spec.rb
Ruby
mit
5,205
master
2,604
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'file input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.input(:body, :as => :file)) end) end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/custom_input_spec.rb
Ruby
mit
5,205
master
1,127
# frozen_string_literal: true require 'spec_helper' # TODO extract out module TestInputs def input_args @template = self @object = ::Post.new @object_name = 'post' @method = :title @options = {} @proc = Proc.new {} @builder = Formtastic::FormBuilder.new(@object_name, @object, @template, ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/color_input_spec.rb
Ruby
mit
5,205
master
2,370
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'color input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "when object is provided" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/check_boxes_input_spec.rb
Ruby
mit
5,205
master
22,014
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'check_boxes input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe 'for a has_many association' do before do @output_buffer = ActionView::OutputBuffer...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/text_input_spec.rb
Ruby
mit
5,205
master
6,301
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'text input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.input(:body, :as => :text)) end) end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/date_picker_input_spec.rb
Ruby
mit
5,205
master
13,177
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'date_picker input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end context "with an object" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/time_select_input_spec.rb
Ruby
mit
5,205
master
11,502
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'time select input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "general" do before do ::I18n.backend.reload! @output_buffer = ActionView::Ou...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/string_input_spec.rb
Ruby
mit
5,205
master
12,491
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'string input' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end describe "when object is provided" do before do concat(semantic_form_for(@new_post) do |builder| ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/base/validations_spec.rb
Ruby
mit
5,205
master
14,883
# frozen_string_literal: true require 'fast_spec_helper' require 'active_model' require 'inputs/base/validations' class MyInput attr_accessor :validations include Formtastic::Inputs::Base::Validations def validations? true end end RSpec.describe MyInput do let(:builder) { double } let(:template) { do...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/inputs/base/collections_spec.rb
Ruby
mit
5,205
master
3,961
# frozen_string_literal: true require 'fast_spec_helper' require 'inputs/base/collections' class MyInput include Formtastic::Inputs::Base::Collections end RSpec.describe MyInput do let(:builder) { double } let(:template) { double } let(:model_class) { double } let(:model) { double(:class => model_class) } ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/actions/input_action_spec.rb
Ruby
mit
5,205
master
1,350
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'InputAction', 'when submitting' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.action(:submit, :as => ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/actions/generic_action_spec.rb
Ruby
mit
5,205
master
20,724
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'InputAction::Base' do # Most basic Action class to test Base class ::GenericAction include ::Formtastic::Actions::Base def supported_methods [:submit, :reset, :cancel] end def to_html wrapper do builder.submi...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/actions/link_action_spec.rb
Ruby
mit
5,205
master
2,149
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'LinkAction', 'when cancelling' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything end context 'without a :url' do before do concat(semantic_form_for(@new_post) do |bu...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
spec/actions/button_action_spec.rb
Ruby
mit
5,205
master
1,528
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'ButtonAction', 'when submitting' do include FormtasticSpecHelper before do @output_buffer = ActionView::OutputBuffer.new '' mock_everything concat(semantic_form_for(@new_post) do |builder| concat(builder.action(:submit, :as =>...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic.rb
Ruby
mit
5,205
master
870
# frozen_string_literal: true module Formtastic extend ActiveSupport::Autoload autoload :Helpers autoload :HtmlAttributes autoload :LocalizedString autoload :Localizer autoload :NamespacedClassFinder autoload :InputClassFinder autoload :ActionClassFinder autoload :Deprecation eager_autoload do ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers.rb
Ruby
mit
5,205
master
701
# frozen_string_literal: true module Formtastic module Helpers autoload :ActionHelper, 'formtastic/helpers/action_helper' autoload :ActionsHelper, 'formtastic/helpers/actions_helper' autoload :ErrorsHelper, 'formtastic/helpers/errors_helper' autoload :FieldsetWrapper, 'formtastic/helpers/fieldset_wrap...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs.rb
Ruby
mit
5,205
master
1,046
# frozen_string_literal: true module Formtastic module Inputs extend ActiveSupport::Autoload autoload :Base autoload :Basic autoload :Timeish eager_autoload do autoload :BooleanInput autoload :CheckBoxesInput autoload :ColorInput autoload :CountryInput autoload :Dat...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/input_class_finder.rb
Ruby
mit
5,205
master
428
# frozen_string_literal: true module Formtastic # Uses the {Formtastic::NamespacedClassFinder} to look up input class names. # # See {Formtastic::FormBuilder#namespaced_input_class} for details. # class InputClassFinder < NamespacedClassFinder # @param builder [FormBuilder] def initialize(builder) ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/form_builder.rb
Ruby
mit
5,205
master
4,679
# frozen_string_literal: true module Formtastic class FormBuilder < ActionView::Helpers::FormBuilder # Defines a new configurable option # @param [Symbol] name the configuration name # @param [Object] default the configuration default value # @private # # @!macro [new] configure # @!sco...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/localizer.rb
Ruby
mit
5,205
master
4,824
# frozen_string_literal: true module Formtastic # Implementation for looking up localized values within Formtastic using I18n, if no # explicit value (like the `:label` option) is set and I18n-lookups are enabled in the # configuration. # # You can subclass this to implement your own Localizer, and configure ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/localized_string.rb
Ruby
mit
5,205
master
470
# frozen_string_literal: true module Formtastic module LocalizedString def model_name @object.present? ? @object.class.name : @object_name.to_s.classify end protected def localized_string(key, value, type, options = {}) # @private current_builder = respond_to?(:builder) ? builder : self...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/actions.rb
Ruby
mit
5,205
master
269
# frozen_string_literal: true module Formtastic module Actions extend ActiveSupport::Autoload autoload :Base autoload :Buttonish eager_autoload do autoload :InputAction autoload :LinkAction autoload :ButtonAction end end end
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/html_attributes.rb
Ruby
mit
5,205
master
893
# frozen_string_literal: true module Formtastic # @private module HtmlAttributes # Returns a namespace passed by option or inherited from parent builders / class configuration def dom_id_namespace namespace = options[:custom_namespace] parent = options[:parent_builder] case when n...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/i18n.rb
Ruby
mit
5,205
master
914
# frozen_string_literal: true module Formtastic # @private module I18n DEFAULT_SCOPE = [:formtastic].freeze DEFAULT_VALUES = YAML.load_file(File.expand_path("../../locale/en.yml", __FILE__))["en"]["formtastic"].freeze SCOPES = [ '%{model}.%{nested_model}.%{action}.%{attribute}', '%{mod...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/action_class_finder.rb
Ruby
mit
5,205
master
431
# frozen_string_literal: true module Formtastic # Uses the {NamespacedClassFinder} to look up action class names. # # See {Formtastic::Helpers::ActionHelper#namespaced_action_class} for details. # class ActionClassFinder < NamespacedClassFinder # @param builder [FormBuilder] def initialize(builder) ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/namespaced_class_finder.rb
Ruby
mit
5,205
master
2,913
# frozen_string_literal: true module Formtastic # This class implements class resolution in a namespace chain. It # is used both by Formtastic::Helpers::InputHelper and # Formtastic::Helpers::ActionHelper to look up action and input classes. # # @example Implementing own class finder # # You can implement...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/errors_helper.rb
Ruby
mit
5,205
master
5,249
# frozen_string_literal: true module Formtastic module Helpers module ErrorsHelper include Formtastic::Helpers::FileColumnDetection include Formtastic::Helpers::Reflection include Formtastic::LocalizedString INLINE_ERROR_TYPES = [:sentence, :list, :first] # Generates an unordered l...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/input_helper.rb
Ruby
mit
5,205
master
16,873
# frozen_string_literal: true module Formtastic module Helpers # {#input} is used to render all content (labels, form widgets, error messages, hints, etc) for # a single form input (or field), usually representing a single method or attribute on the # form's object or model. # # The content is wr...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/enum.rb
Ruby
mit
5,205
master
325
# frozen_string_literal: true module Formtastic module Helpers # @private module Enum # Returns the enum (if defined) for the given method def enum_for(method) # @private if @object.respond_to?(:defined_enums) @object.defined_enums[method.to_s] end end end end...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/action_helper.rb
Ruby
mit
5,205
master
4,599
# frozen_string_literal: true module Formtastic module Helpers module ActionHelper # Renders an action for the form (such as a subit/reset button, or a cancel link). # # Each action is wrapped in an `<li class="action">` tag with other classes added based on the # type of action being rend...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/fieldset_wrapper.rb
Ruby
mit
5,205
master
3,538
# frozen_string_literal: true module Formtastic module Helpers # @private module FieldsetWrapper protected # Generates a fieldset and wraps the content in an ordered list. When working # with nested attributes, it allows %i as interpolation option in :name. So you can do: # # ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/form_helper.rb
Ruby
mit
5,205
master
9,189
# frozen_string_literal: true module Formtastic module Helpers # FormHelper provides a handful of wrappers around Rails' built-in form helpers methods to set # the `:builder` option to `Formtastic::FormBuilder` and apply some class names to the `<form>` # tag. # # The following methods are wrappe...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/actions_helper.rb
Ruby
mit
5,205
master
6,085
# frozen_string_literal: true module Formtastic module Helpers # ActionsHelper encapsulates the responsibilities of the {#actions} DSL for acting on # (submitting, cancelling, resetting) forms. # # {#actions} is a block helper used to wrap the form's actions (buttons, links) in a # `<fieldset>` ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/reflection.rb
Ruby
mit
5,205
master
1,360
# frozen_string_literal: true module Formtastic module Helpers # @private module Reflection # If an association method is passed in (f.input :author) try to find the # reflection object. def reflection_for(method) # @private if @object.class.respond_to?(:reflect_on_association) ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/file_column_detection.rb
Ruby
mit
5,205
master
441
# frozen_string_literal: true module Formtastic module Helpers # @private module FileColumnDetection def is_file?(method, options = {}) @files ||= {} @files[method] ||= (options[:as].present? && options[:as] == :file) || begin file = @object.send(method) if @object && @object....
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/helpers/inputs_helper.rb
Ruby
mit
5,205
master
17,644
# frozen_string_literal: true module Formtastic module Helpers # {#inputs} is used to wrap a series of form items in a `<fieldset>` and `<ol>`, with each item # in the list containing the markup representing a single {#input}. # # {#inputs} is usually called with a block containing a series of {#inpu...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/select_input.rb
Ruby
mit
5,205
master
10,877
# frozen_string_literal: true module Formtastic module Inputs # A select input is used to render a `<select>` tag with a series of options to choose from. # It works for both single selections (like a `belongs_to` relationship, or "yes/no" boolean), # as well as multiple selections (like a `has_and_belong...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/text_input.rb
Ruby
mit
5,205
master
1,419
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a `<textarea>` wrapped in the standard # `<li>` wrapper. This is the default input choice for database columns of the `:text` type, # but can forced on any text-like input with `:as => :text`. # # @exa...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/datetime_select_input.rb
Ruby
mit
5,205
master
414
# frozen_string_literal: true module Formtastic module Inputs # Outputs a series of select boxes for the fragments that make up a date and time (year, month, day, hour, minute, second). # # @see Formtastic::Inputs::Base::Timeish Timeish module for documentation of date, time and datetime input options. ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/phone_input.rb
Ruby
mit
5,205
master
1,259
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="phone">` wrapped in the standard # `<li>` wrapper. This is the default input choice for attributes with a name matching # `/(phone|fax)/`, but can be applied to any text-like input with `...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/string_input.rb
Ruby
mit
5,205
master
1,215
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a `<input type="text">` wrapped in the standard # `<li>` wrapper. This is the default input choice for database columns of the `:string` type, # and is the default choice for all inputs when no other logical i...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/url_input.rb
Ruby
mit
5,205
master
1,262
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="url">` wrapped in the standard # `<li>` wrapper. This is the default input choice for all attributes matching # `/^url$|^website$|_url$/`, but can be applied to any text-like input with `...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/search_input.rb
Ruby
mit
5,205
master
1,268
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="search">` wrapped in the standard # `<li>` wrapper. This is the default input choice for attributes with a name matching # `/^search$/`, but can be applied to any text-like input with `:a...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/file_input.rb
Ruby
mit
5,205
master
1,487
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a `<input type="file">` wrapped in the standard # `<li>` wrapper. This is the default input choice for objects with attributes that appear # to be for file uploads, by detecting some common method names used b...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/date_picker_input.rb
Ruby
mit
5,205
master
4,198
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="date">` wrapped in the standard # `<li>` wrapper. This is an alternative to `:date_select` for `:date`, `:time`, `:datetime` # database columns. You can use this input with `:as => :...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/time_picker_input.rb
Ruby
mit
5,205
master
4,322
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="time">` wrapped in the standard # `<li>` wrapper. This is an alternative to `:time_select` for `:date`, `:time`, `:datetime` # database columns. You can use this input with `:as => :...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/check_boxes_input.rb
Ruby
mit
5,205
master
7,887
# frozen_string_literal: true module Formtastic module Inputs # A CheckBoxes input is used to render a series of checkboxes. This is an alternative input choice # for `has_many` or `has_and_belongs_to_many` associations like a `Post` belonging to many # `categories` (by default, a {SelectInput `:select`}...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/boolean_input.rb
Ruby
mit
5,205
master
3,270
# frozen_string_literal: true module Formtastic module Inputs # Boolean inputs are used to render an input for a single checkbox, typically for attributes # with a simple yes/no or true/false value. Boolean inputs are used by default for boolean # database columns. # # @example Full form context a...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/email_input.rb
Ruby
mit
5,205
master
1,285
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="email">` wrapped in the standard # `<li>` wrapper. This is the default input choice for attributes with a name matching # `/email/`, but can be applied to any text-like input with `:as =>...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base.rb
Ruby
mit
5,205
master
2,653
# frozen_string_literal: true module Formtastic module Inputs module Base attr_accessor :builder, :template, :object, :object_name, :method, :options def initialize(builder, template, object, object_name, method, options) @builder = builder @template = template @object = obje...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/number_input.rb
Ruby
mit
5,205
master
3,535
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="number">` wrapped in the standard # `<li>` wrapper. This is the default input choice for all database columns of the type `:float` # and `:decimal`, as well as `:integer` columns that are...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/color_input.rb
Ruby
mit
5,205
master
1,246
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="color">` wrapped in the standard # `<li>` wrapper. This is the default input choice for attributes with a name matching # `/color/`, but can be applied to any text-like input with `:as =>...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/hidden_input.rb
Ruby
mit
5,205
master
1,703
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<input type="hidden">` wrapped in the standard `<li>` wrapper. This is # provided for situations where a hidden field needs to be rendered in the flow of a form with # many inputs that form an `<ol>`. Wrapping the hidden in...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/date_select_input.rb
Ruby
mit
5,205
master
1,015
# frozen_string_literal: true module Formtastic module Inputs # Outputs a series of select boxes for the fragments that make up a date (year, month, day). # # @see Formtastic::Inputs::Base::Timeish Timeish module for documentation of date, time and datetime input options. class DateSelectInput ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/time_select_input.rb
Ruby
mit
5,205
master
1,292
# frozen_string_literal: true module Formtastic module Inputs # Outputs a series of select boxes for the fragments that make up a time (hour, minute, second). # Unless `:ignore_date` is true, it will render hidden inputs for the year, month and day as # well, defaulting to `Time.current` if the form obje...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/datalist_input.rb
Ruby
mit
5,205
master
1,482
# frozen_string_literal: true module Formtastic module Inputs # Outputs a label and a text field, along with a datalist tag # datalist tag provides a list of options which drives a simple autocomplete # on the text field. This is a HTML5 feature, more info can be found at # {https://developer.mozilla....
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/password_input.rb
Ruby
mit
5,205
master
1,270
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a `<input type="password">` wrapped in the standard # `<li>` wrapper. This is the default input choice for all attributes matching `/password/`, but # can be applied to any text-like input with `:as => :passwo...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/country_input.rb
Ruby
mit
5,205
master
3,652
# frozen_string_literal: true module Formtastic module Inputs # Outputs a country select input, wrapping around a regular country_select helper. # Rails doesn't come with a `country_select` helper by default any more, so you'll need to do # one of the following: # # * install the [country_select](...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/datetime_picker_input.rb
Ruby
mit
5,205
master
5,060
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="datetime-local">` (or # `<input type="datetime">`) wrapped in the standard `<li>` wrapper. This is an alternative to # `:date_select` for `:date`, `:time`, `:datetime` database colu...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/range_input.rb
Ruby
mit
5,205
master
3,526
# frozen_string_literal: true module Formtastic module Inputs # Outputs a simple `<label>` with a HTML5 `<input type="range">` wrapped in the standard # `<li>` wrapper. This is an alternative input choice to a number input. # # Sensible default for the `min`, `max` and `step` attributes are found...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/radio_input.rb
Ruby
mit
5,205
master
8,392
# frozen_string_literal: true module Formtastic module Inputs # A radio input is used to render a series of radio inputs. This is an alternative input choice # for `belongs_to` associations like a `Post` belonging to a `Section` or an `Author`, or any # case where the user needs to make a single selectio...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/time_zone_input.rb
Ruby
mit
5,205
master
1,910
# frozen_string_literal: true module Formtastic module Inputs # Outputs a `<label>` with a `<select>` containing a series of time zones (using Rails' own # `time_zone_select` helper), wrapped in the standard `<li>` wrapper. # This is the default input choice for attributes matching /time_zone/, but can ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/hints.rb
Ruby
mit
5,205
master
628
# frozen_string_literal: true module Formtastic module Inputs module Base module Hints def hint_html if hint? template.content_tag( :p, hint_text.html_safe, :class => builder.default_hint_class ) end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/fileish.rb
Ruby
mit
5,205
master
430
# frozen_string_literal: true module Formtastic module Inputs module Base module Fileish def file? @file ||= begin # TODO return true if self.is_a?(Formtastic::Inputs::FileInput::Woo) object && object.respond_to?(method) && builder.file_methods.any? { |m| obj...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/options.rb
Ruby
mit
5,205
master
420
# frozen_string_literal: true module Formtastic module Inputs module Base module Options def input_options options.except(*formtastic_options) end def formtastic_options [:priority_countries, :priority_zones, :member_label, :member_value, :collection, :required,...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/html.rb
Ruby
mit
5,205
master
1,563
# frozen_string_literal: true module Formtastic module Inputs module Base module Html # Defines how the instance of an input should be rendered to a HTML string. # # @abstract Implement this method in your input class to describe how the input should render itself. # ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/placeholder.rb
Ruby
mit
5,205
master
373
# frozen_string_literal: true module Formtastic module Inputs module Base module Placeholder def input_html_options {:placeholder => placeholder_text}.merge(super) end def placeholder_text localized_string(method, options[:placeholder], :placehol...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/associations.rb
Ruby
mit
5,205
master
642
# frozen_string_literal: true module Formtastic module Inputs module Base module Associations include Formtastic::Helpers::Reflection # :belongs_to, etc def association @association ||= association_macro_for_method(method) end def reflection @ref...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/timeish.rb
Ruby
mit
5,205
master
9,818
# frozen_string_literal: true module Formtastic module Inputs module Base # Timeish inputs (`:date_select`, `:datetime_select`, `:time_select`) are similar to the Rails date and time # helpers (`date_select`, `datetime_select`, `time_select`), rendering a series of `<select>` # tags for each fr...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/stringish.rb
Ruby
mit
5,205
master
1,013
# frozen_string_literal: true module Formtastic module Inputs module Base module Stringish # @abstract Override this method in your input class to describe how the input should render itself. def to_html input_wrapping do label_html << builder.text_fi...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/aria.rb
Ruby
mit
5,205
master
636
# frozen_string_literal: true module Formtastic module Inputs module Base module Aria def error_aria_attributes return {} unless builder.semantic_errors_link_to_inputs return {} unless errors? { 'aria-describedby': describedby, 'aria-invalid': ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/collections.rb
Ruby
mit
5,205
master
5,688
# frozen_string_literal: true module Formtastic module Inputs module Base module Collections def label_method @label_method ||= (label_method_from_options || label_and_value_method.first) end def label_method_from_options options[:member_label] end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/wrapping.rb
Ruby
mit
5,205
master
1,541
# frozen_string_literal: true module Formtastic module Inputs module Base # @todo relies on `dom_id`, `required?`, `optional`, `errors?`, `association_primary_key` & `sanitized_method_name` methods from another module module Wrapping # Override this method if you want to change the display or...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/naming.rb
Ruby
mit
5,205
master
1,243
# frozen_string_literal: true module Formtastic module Inputs module Base module Naming def as self.class.name.split("::")[-1].underscore.gsub(/_input$/, '') end def sanitized_object_name object_name.to_s.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "") e...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/errors.rb
Ruby
mit
5,205
master
1,738
# frozen_string_literal: true module Formtastic module Inputs module Base module Errors def error_html errors? ? send(:"error_#{builder.inline_errors}_html") : +"" end def error_sentence_html error_class = builder.default_inline_error_class ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/labelling.rb
Ruby
mit
5,205
master
1,421
# frozen_string_literal: true module Formtastic module Inputs module Base module Labelling include Formtastic::LocalizedString def label_html render_label? ? builder.label(input_name, label_text, label_html_options) : +"".html_safe end def...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/choices.rb
Ruby
mit
5,205
master
2,937
# frozen_string_literal: true module Formtastic module Inputs module Base module Choices def choices_wrapping(&block) template.content_tag(:fieldset, template.capture(&block), choices_wrapping_html_options ) end def choices_wrapping_html_...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/numeric.rb
Ruby
mit
5,205
master
1,265
# frozen_string_literal: true module Formtastic module Inputs module Base module Numeric def input_html_options defaults = super # override rails default size - does not apply to numeric inputs #@todo document/spec defaults[:size] = nil i...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/validations.rb
Ruby
mit
5,205
master
8,538
# frozen_string_literal: true module Formtastic module Inputs module Base module Validations class IndeterminableMinimumAttributeError < ArgumentError def message [ "A minimum value can not be determined when the validation uses :greater_than on a :decimal or :fl...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/database.rb
Ruby
mit
5,205
master
336
# frozen_string_literal: true module Formtastic module Inputs module Base module Database def column if object.respond_to?(:column_for_attribute) object.column_for_attribute(method) end end def column? !column.nil? end end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/inputs/base/datetime_pickerish.rb
Ruby
mit
5,205
master
2,304
# frozen_string_literal: true module Formtastic module Inputs module Base module DatetimePickerish include Base::Placeholder def html_input_type raise NotImplementedError end def default_size raise NotImplementedError end ...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/actions/link_action.rb
Ruby
mit
5,205
master
3,310
# frozen_string_literal: true module Formtastic module Actions # Outputs a link wrapped in the standard `<li>` wrapper. This the default for `:cancel` actions. # The link's URL defaults to Rails' built-in `:back` macro (the HTTP referrer, or Javascript for the # browser's history), but can be altered with the `...
github
formtastic/formtastic
https://github.com/formtastic/formtastic
lib/formtastic/actions/input_action.rb
Ruby
mit
5,205
master
2,608
# frozen_string_literal: true module Formtastic module Actions # Outputs an `<input type="submit">` or `<input type="reset">` wrapped in the standard `<li>` # wrapper. This the default for `:submit` and `:reset` actions, but `:as => :button` is also # available as an alternative. # # @example The `:as` can...