andrba / hungryform Goto Github PK
View Code? Open in Web Editor NEWRuby gem for building complex multi page forms
License: MIT License
Ruby gem for building complex multi page forms
License: MIT License
Create a js module for dependency handling and form navigation.
It would be good to have some sort of form elements configuration, where we could set up default attributes.
Rather than doing this every time we define a new field in a form
text_field :first_name, max_length: 100
text_field :last_name, max_length: 100
we could configure it like this
HungryForm::Elements::TextField.configure do |c|
c.max_length = 100
end
If a hash is given as a dependency parameter it should be converted to a proper json
string.
We need to create more elements:
Currently it is required to define two routes to handle forms:
get 'hungryform/:page' => 'hungryform#show'
post 'hungryform/:page' => 'hungryform#update'
It would be worth creating some sort of a helper to define all form routes in one line.
Sometimes it is necessary to create multiple groups of the same type. Imagine we have a form that asks about the addresses a person lived at within 10 years. Each address should consist of the following fields:
text_field :line_1
text_field :line_2
text_field :city
text_field country
Rather than copy-pasting 10..20 groups in the form definition we could set a quantity: 10
or multiple: true
parameter which will render these groups automatically. Each group will have its number in the name, like page_mygroup_1
with field names like page_mygroup_1_city
.
The question is how it will be rendered in the Rails app. Obviously we should not show to a user 10 groups all at once. I see two ways of doing it:
Any other ideas are welcome!
It would be better to create a namespace for form fields. Currently they are all located under the HungryForm class, that has some other classes such as Validator
or Resolver
. A class lookup loops through these classes every time a new field is created.
A decision needs to be made to what extent this gem will be responsible for rendering HTML. If it is used extensively with frameworks like Rails or Sinatra, it will be better to delegate all this work to their template engines. However, this delegation will require extra work to be done each time it is used in a project.
Another option is to create a gem for each framework individually. If it is based on a current gem it can make integration easier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.