Skip to content

Commit

Permalink
Ready for prime time.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 6, 2010
1 parent 3873728 commit ee6cb1b
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 33 deletions.
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009 PlataformaTec http://blog.plataformatec.com.br/
Copyright (c) 2010 PlataformaTec http://blog.plataformatec.com.br/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
34 changes: 4 additions & 30 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
== SimpleForm

OBS.: If you want to try this project, please install it as plugin!

Forms made easy (for Rails)!

SimpleForm aims to be as flexible as possible while helping you with powerful components to create your forms. The basic goal of simple form is to not touch your way of defining the layout, this way letting you find how you find the better design for your eyes. Good part of the DSL was inherited from Formtastic, which we are thankful for and should make you feel right at home.
Expand All @@ -10,7 +8,7 @@ SimpleForm aims to be as flexible as possible while helping you with powerful co

Install the gem:

sudo gem install simple_form
sudo gem install simple_form --version=1.0

Configure simple_form gem inside your app:

Expand Down Expand Up @@ -320,41 +318,17 @@ Finally, you can also overwrite labels and hints inside your view, just by passi

There are other options that can be configured through I18n API, such as required text, boolean and button texts. Be sure to check our locale file or the one copied to your application after you run "script/generate simple_form_install".

== Components
== Configuration

SimpleForm has several configuration values. You can read and change them in the initializer created by SimpleForm, so if you haven't executed the command below yet, please do:

ruby script/generate simple_form_install

== Components

SimpleForm is built within components, by default, those components are:

[ SimpleForm::Components::Label, SimpleForm::Components::Input,
SimpleForm::Components::Hint, SimpleForm::Components::Error ]

This means you can add, remove and change components order through the SimpleForm.components method. A component is an object that accepts two arguments on initialization, the form builder and the next component in the stack, and responds to call. A bypass component (which does nothing) is as simple as:

class MyComponent
def initialize(builder, next_component)
@builder = builder
@next_component = next_component
end

def call
@next_component.call
end
end

For example, imagine you get a layout for some project where the concept of hint does not exist. Instead you have instructions and example sections for each input. You can simply create a Instruction and Example component (check for example the Hint component, it's just 10 lines of code) and add them to the component stack.

This also gives great extensibility to SimpleForm, so you can add javascript masks, validations, etc.

== TODO

Please refer to TODO file.

== Contributors
== Maintainers

* José Valim (http://github.com/josevalim)
* Carlos Antonio da Silva (http://github.com/carlosantoniodasilva)
Expand All @@ -365,4 +339,4 @@ If you discover any bugs or want to drop a line, feel free to create an issue on

http://github.com/plataformatec/simple_form/issues

MIT License. Copyright 2009 Plataforma Tecnologia. http://blog.plataformatec.com.br
MIT License. Copyright 2010 Plataforma Tecnologia. http://blog.plataformatec.com.br
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require File.join(File.dirname(__FILE__), 'lib', 'simple_form', 'version')

desc 'Default: run unit tests.'
task :default => :test
Expand All @@ -21,3 +22,21 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "simple_form"
s.version = SimpleForm::VERSION
s.summary = "Forms made easy!"
s.email = "contact@plataformatec.com.br"
s.homepage = "http://github.com/plataformatec/simple_form"
s.description = "Forms made easy!"
s.authors = ['José Valim', 'Carlos Antônio']
s.files = FileList["[A-Z]*(.rdoc)", "{generators,lib}/**/*", "init.rb"]
end

Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
end
2 changes: 0 additions & 2 deletions TODO.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
== General

* Sample CSS
* Add default size support
* HTML 5 support
* Pretty buttons

Expand Down
3 changes: 3 additions & 0 deletions lib/simple_form/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SimpleForm
VERSION = "1.0.0".freeze
end
82 changes: 82 additions & 0 deletions simple_form.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{simple_form}
s.version = "1.0.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jos\303\251 Valim", "Carlos Ant\303\264nio"]
s.date = %q{2010-02-06}
s.description = %q{Forms made easy!}
s.email = %q{contact@plataformatec.com.br}
s.extra_rdoc_files = [
"README.rdoc"
]
s.files = [
"generators/simple_form_install/USAGE",
"generators/simple_form_install/simple_form_install_generator.rb",
"generators/simple_form_install/templates/simple_form.rb",
"init.rb",
"lib/simple_form.rb",
"lib/simple_form/action_view_extensions/builder.rb",
"lib/simple_form/action_view_extensions/form_helper.rb",
"lib/simple_form/action_view_extensions/instance_tag.rb",
"lib/simple_form/components.rb",
"lib/simple_form/components/errors.rb",
"lib/simple_form/components/hints.rb",
"lib/simple_form/components/labels.rb",
"lib/simple_form/components/wrapper.rb",
"lib/simple_form/form_builder.rb",
"lib/simple_form/i18n_cache.rb",
"lib/simple_form/inputs.rb",
"lib/simple_form/inputs/base.rb",
"lib/simple_form/inputs/block_input.rb",
"lib/simple_form/inputs/collection_input.rb",
"lib/simple_form/inputs/date_time_input.rb",
"lib/simple_form/inputs/hidden_input.rb",
"lib/simple_form/inputs/mapping_input.rb",
"lib/simple_form/inputs/priority_input.rb",
"lib/simple_form/inputs/text_field_input.rb",
"lib/simple_form/locale/en.yml",
"lib/simple_form/map_type.rb",
"lib/simple_form/version.rb"
]
s.homepage = %q{http://github.com/plataformatec/simple_form}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Forms made easy!}
s.test_files = [
"test/action_view_extensions/builder_test.rb",
"test/action_view_extensions/form_helper_test.rb",
"test/components/error_test.rb",
"test/components/hint_test.rb",
"test/components/label_test.rb",
"test/form_builder_test.rb",
"test/inputs_test.rb",
"test/simple_form_test.rb",
"test/support/country_select/init.rb",
"test/support/country_select/install.rb",
"test/support/country_select/lib/country_select.rb",
"test/support/country_select/uninstall.rb",
"test/support/misc_helpers.rb",
"test/support/mock_controller.rb",
"test/support/mock_response.rb",
"test/support/models.rb",
"test/test_helper.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

0 comments on commit ee6cb1b

Please sign in to comment.