Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ test/dummy/tmp/
*.gem
.rbenv-gemsets
*.swp
gemfiles/*.lock
Gemfile.lock
.ruby-version
47 changes: 24 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
sudo: false
language: ruby
rvm:
- 1.9
- 2.0
- 2.1
- 2.2
- 2.3.1
- 2.2.9
- 2.3.6
- 2.4.3
- 2.5.0
gemfile:
- gemfiles/4.0.gemfile
- gemfiles/4.1.gemfile
- gemfiles/4.2.gemfile
- test/gemfiles/5.0.gemfile
- test/gemfiles/5.1.gemfile
- test/gemfiles/5.2.gemfile
before_install:
- gem update --system
- gem install bundler --no-document

matrix:
include:
- rvm: 2.2.2
gemfile: gemfiles/5.0.gemfile
- rvm: 2.3.1
gemfile: gemfiles/5.0.gemfile
# Run Danger only once
script: bundle exec danger
- rvm: 2.2.2
gemfile: gemfiles/5.1.gemfile
- rvm: 2.3.1
gemfile: gemfiles/5.1.gemfile
before_install:
- gem install bundler --conservative --version '~> 1.10'
before_script:
- bundle exec rake -f test/dummy/Rakefile db:create db:migrate RAILS_ENV=test
# Bleeding edge
- rvm: ruby-head
gemfile: test/gemfiles/5.2.gemfile

# Running one job to execute DANGER bot
- rvm: 2.5.0
gemfile: test/gemfiles/5.2.gemfile
script:
- gem install danger
- danger

allow_failures:
- rvm: ruby-head
28 changes: 0 additions & 28 deletions Appraisals

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Bugfixes:

Features:
- Your contribution here!
* [#344](https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/344): Allow HTML in help translations by using the '_html' suffix on the key - [@unikitty37](https://github.com/unikitty37)
* [#325](https://github.com/bootstrap-ruby/rails-bootstrap-forms/pull/325): Support :prepend and :append for the `select` helper - [@donv](https://github.com/donv).


Expand Down
70 changes: 37 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
# Contributing

The release of Bootstrap 4 and Rails 5.1 have implications
for the future direction of `bootstrap_form`.
Don't worry.
We plan to move this gem forward to Bootstrap 4
and to support Rails 5.1 and beyond.
If you're thinking of contributing to `bootstrap_form`,
please read [issue #361](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/361).
The release of Bootstrap 4 and Rails 5.1 have implications for the future
direction of `bootstrap_form`. Don't worry. We plan to move this gem forward to
Bootstrap 4 and to support Rails 5.1 and beyond. If you're thinking of
contributing to `bootstrap_form`, please read
[issue #361](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/361).

Your comments are welcome.

Thanks so much for considering contributing to bootstrap_form!
We love pull requests!
Thanks so much for considering a contribution to bootstrap_form. We love pull requests!

Here's a quick guide for contributing:

1. Make sure no one else is working on the same issue or feature.
Search the issues and pull requests for anything
that looks like the issue or feature you want to address.
If no one else is working on your issue or feature,
carry on with the following steps.
### 1. Check if issue or feature is available to work on

Make sure no one else is working on the same issue or feature. Search the issues
and pull requests for anything that looks like the issue or feature you want to
address. If no one else is working on your issue or feature, carry on with the
following steps.

### 2. Fork the repo

For the project. Optionally, create a branch you want to work on

2. Fork the repo.
### 3. Get it running locally

2. Install the required dependencies.
- Install the required dependencies with `bundle install`
- Run tests via: `bundle exec rake`

```
bundle install
bundle exec appraisal install
```
### 4. Hack away

3. Run the existing test suite:
- Try to keep your changes small. Consider making several smaller pull requests.
- Don't forget to add necessary tests.
- Update the README if necessary.
- Add a line to the CHANGELOG for your bug fix or feature.

```
$ bundle exec rake -f test/dummy/Rakefile db:create db:migrate RAILS_ENV=test
$ bundle exec appraisal rake test
```
You may find using test/dummy application useful for development and debugging.

4. Add tests for your change.
- `cd test/dummy`
- `rake db:schema:load`
- `rails s`
- Navigate to http://localhost:3000

5. Add your changes and make your test(s) pass. Following the conventions you
see used in the source will increase the chance that your pull request is
accepted right away.
### 5. Make a Pull Request

6. Update the README if necessary.
- If you never done it before read this: https://help.github.com/articles/about-pull-requests/
- When PR is submitted check if TravisCI ran all tests successfully didn't raise any issues

7. Add a line to the CHANGELOG for your bug fix or feature.
### 6. Done!

8. Push to your fork and submit a pull request.
Somebody will shortly review your pull request and if everything is good will be
merged into master brach. Eventually gem will be published with your changes.

## Contributors
---

Thanks to all the great contributors over the years: https://github.com/bootstrap-ruby/rails-bootstrap-forms/graphs/contributors
25 changes: 14 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
source "http://rubygems.org"

# Declare your gem's dependencies in bootstrap_form.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# jquery-rails is used by the dummy application
gem "jquery-rails"
# Uncomment and change rails version for testing purposes
# gem "rails", "~> 5.2.0.beta2"

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
group :development do
gem "htmlbeautifier"
end

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
gem "diffy"
gem "equivalent-xml"
gem "mocha"
gem "sqlite3"
gem "timecop", "~> 0.7.1"
end

gem "minitest", "~> 5.10.3"
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ en:
password: "A good password should be at least six characters long"
```

Help translations containing HTML should follow the convention of appending `_html` to the name:

```yml
en:
activerecord:
help:
user:
password_html: "A <strong>good</strong> password should be at least six characters long"
```

If your model name has multiple words (like `SuperUser`), the key on the
translation file should be underscored (`super_user`).

Expand Down Expand Up @@ -269,7 +279,7 @@ You still can use `wrapper_class` option to set only a css class. This is just a
Our select helper accepts the same arguments as the [default Rails helper](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select). Here's an example of how you pass both options and html_options hashes:

```erb
<%= f.select :product, [["Apple", 1], ["Grape", 2]], { label: "Choose your favorite fruit:" }, { class: "selectpicker" } %>
<%= f.select :product, [["Apple", 1], ["Grape", 2]], { label: "Choose your favorite fruit:" }, { class: "selectpicker", wrapper: { class: 'has-warning', data: { foo: 'bar' } } } %>
```

### Checkboxes and Radios
Expand Down
20 changes: 5 additions & 15 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end

require 'rdoc/task'

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'BootstrapForm'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end



Bundler::GemHelper.install_tasks
require 'bundler/gem_tasks'

require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end


task :default => :test
task default: :test
22 changes: 9 additions & 13 deletions bootstrap_form.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require "bootstrap_form/version"

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "bootstrap_form"
s.version = BootstrapForm::VERSION
Expand All @@ -16,17 +16,13 @@ Gem::Specification.new do |s|
s.license = "MIT"

s.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
f.match(%r{^(test)/})
end
s.bindir = "exe"

s.add_development_dependency "appraisal"
s.add_development_dependency "diffy"
s.add_development_dependency "equivalent-xml"
s.add_development_dependency "mime-types", "~> 2.6.2"
s.add_development_dependency "mocha"
s.add_development_dependency "nokogiri"
s.add_development_dependency "rails", ">= 4.0"
s.add_development_dependency "sqlite3"
s.add_development_dependency "timecop", "~> 0.7.1"
s.bindir = "exe"
s.require_paths = ["lib"]

s.required_ruby_version = ">= 2.2.2"

s.add_dependency "rails", ">= 5.0"
end
9 changes: 0 additions & 9 deletions gemfiles/4.0.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/4.1.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/4.2.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/5.0.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/5.1.gemfile

This file was deleted.

5 changes: 5 additions & 0 deletions lib/bootstrap_form/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ def get_help_text_by_i18n_key(name)
warn "I18n key '#{downcased_scope}.#{name}' is deprecated, use '#{underscored_scope}.#{name}' instead"
text
end
help_text ||= I18n.t("#{name}_html", scope: underscored_scope, default: '').html_safe.presence
help_text ||= if text = I18n.t("#{name}_html", scope: downcased_scope, default: '').html_safe.presence
warn "I18n key '#{downcased_scope}.#{name}' is deprecated, use '#{underscored_scope}.#{name}' instead"
text
end
help_text
end
end
Expand Down
Loading