Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
padrino_bootstrap_forms
Advanced tools
Padrino Bootstrap Forms is a port of Seth Vargo's Bootstrap Forms for Rails. Thanks Seth!
It currently renders forms using Bootstrap 2 markup.
If your Padrino version is < 0.11 you must use version 0.0.2 of this gem.
bootstrap
namespace for localization@builder.error_messages
was removed and the Padrino version is not automatically called when there's an errorrequired
attribute automatically added to their input
scollection_select
country_select
time_zone_select
range_field
bootstrap_forms
after v3
A super special thanks to vincenzor for updating bootstrap_forms
to comply with the new methods and features in Twitter Bootstrap 2.0.
Add it to your Gemfile
:
gem 'padrino_bootstrap_forms', :require => 'bootstrap_forms'
Don't forget to run the bundle
command.
Register it with your application:
class YourApplication < Padrino::Application
register BootstrapForms
# ...
end
This will add the method bootstrap_form_for
for use in your project.
With Bootstrap, you would need the following code for a form:
/ using HAML
= form_for @model do |f|
.clearfix
%label MyLabel
.input
= f.text_area :field, :opts => {...}
Using Bootstrap Forms, this is much simpler:
/ using HAML
= bootstrap_form_for @model do |f|
= f.text_area :field, :opts => {...}
The custom form builder will automatically wrap everything for you. This helps clean up your view layer significantly!
Just when you thought you were done... Bootstrap Forms includes additional form helpers that make life a lot easier! For example, the markup required for a list of checkboxes is quite cumbersome... well, it used to be.
collection_check_boxes
behaves very similarly to collection_select
:
= f.collection_check_boxes :category_ids, Category.all, :id, :name
See description above...
= f.collection_radio_buttons :primary_category_id, Category.all, :id, :name
= f.radio_buttons :published, { "Published" => true, "Unpublished" => false }
Bootstrap Forms adds another helper method that generates the necessary markup for uneditable inputs:
= f.uneditable_input :name
yields:
<div class="clearfix">
<label for="organization_name">Organization Name</label>
<div class="input">
<span class="uneditable-input">The Variety Hour</span>
</div>
</div>
Bootstrap Forms also adds a default actions panel when you call f.submit
:
= f.submit
generates:
<div class="actions">
<input type="submit" value="..." class="btn primary" />
<a href="..." class="btn">Cancel</a>
</div>
You can skip the cancel button by passing the :include_cancel
button a false
value.
Pretty swell if you ask me.
You can add as many options to any form helper tag. If they are interpreted by Bootstrap Forms, they are interpreted and rendered in the output. If not, they are passed along as values to the final HTML form object.
Name | Description | Usage |
---|---|---|
help_inline | Add inline help text | = f.text_field :name, :help_inline => 'help me!' |
help_block | Add block help text (below) | = f.text_field :name, :help_block => 'help me!' |
error | Styles the field as error (red) | = f.text_field :name, :error => 'This is an error!' |
success | Styles the field as success (green) | = f.text_field :name, :success => 'This checked out OK' |
info | Styles the field as info (blue) | = f.text_field :name, :info => 'Hey, it's OK' |
warning | Styles the field as warning (yellow) | = f.text_field :name, :warning => 'Take a look at this...' |
prepend | Adds special text to the front of the input | = f.text_field :name, :prepend => '@' |
append | Adds special text at the end of the input | = f.text_field :name, :append => '@' |
I'm pretty dam active on github. Fork and submit a pull request. Most of my pull requests are merged the same day. Make sure you:
Copyright (c) 2012 Seth Vargo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that padrino_bootstrap_forms demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.