simple-bootstrap-forms 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +30 -0
- data/Rakefile +27 -0
- data/lib/generators/simple_bootstrap_forms_generator.rb +15 -0
- data/lib/generators/templates/_error.html.erb +10 -0
- data/lib/generators/templates/_form.html.erb +21 -0
- data/lib/generators/templates/simple.rb +2 -0
- data/lib/simple/bootstrap/forms/railtie.rb +8 -0
- data/lib/simple/bootstrap/forms/version.rb +7 -0
- data/lib/simple/bootstrap/forms.rb +9 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f75ad1f11f052cb709279e39c11c095db43149a5461eec63c191c623bef2d7b
|
4
|
+
data.tar.gz: 695f2061d908c23f0dc2309b353b079b368265959692af5558f745a96d5a94c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5b3b275e4a5c8fd1b687c26e2455560c14de5d909e1a8c8fc3341898fc80b0c6771b10a026ae9863fd0d5d2d310c7f6499252fe9572ba01a6daf9267aad9140
|
7
|
+
data.tar.gz: bcc016e868c3c87902dbc10b324e53cfb264be006c0781a6afe926bd1b47c62792746625418baa4e31b1da42c8201eab0b6be105ee79f77a7e7a433b9c0c099b
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Andrew Kress
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Simple::Bootstrap::Forms
|
2
|
+
Simply override the default generators to use bootstrap classes in rails without any dependencies that will be out of date because the maintainer hasn't updated their gem in 4 years.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'simple-bootstrap-forms', github: 'andrewkress/simple-bootstrap-forms'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle install
|
17
|
+
$ rails g simple_bootstrap_forms
|
18
|
+
```
|
19
|
+
|
20
|
+
3 files will be generated:
|
21
|
+
|
22
|
+
- config/initializers/simple_boostrap_forms.rb (Config to suppress generating scaffold.scss)
|
23
|
+
- lib/templates/erb/scaffold/_form.html.erb (Simple override to the standard generator)
|
24
|
+
- app/views/shared/_error.html.erb (Shared error partial to keep code DRY)
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
Open a pull request or issue. Mainly for personal use, but if you enjoy, feel free to contribute.
|
28
|
+
|
29
|
+
## License
|
30
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Simple::Bootstrap::Forms'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = false
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: :test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class SimpleBootstrapFormsGenerator < Rails::Generators::Base
|
2
|
+
source_root ::File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
def copy_initializer_file
|
5
|
+
copy_file "simple.rb", "config/initializers/simple_boostrap_forms.rb"
|
6
|
+
end
|
7
|
+
|
8
|
+
def copy_form_builder
|
9
|
+
copy_file "_form.html.erb", "lib/templates/erb/scaffold/_form.html.erb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_error_parial
|
13
|
+
copy_file "_error.html.erb", "app/views/shared/_error.html.erb"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if target.errors.any? %>
|
2
|
+
<div id="error_explanation">
|
3
|
+
<h4><%= pluralize(target.errors.count, "error") %> prohibited this from being saved:</h4>
|
4
|
+
<ul>
|
5
|
+
<% target.errors.full_messages.each do |message| %>
|
6
|
+
<li><%= message %></li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%%= form_with(model: <%= singular_table_name %>, local: true) do |f| %>
|
2
|
+
|
3
|
+
<%%= render "shared/error", target: @<%= singular_table_name %> %>
|
4
|
+
|
5
|
+
<% attributes.each do |attribute| -%>
|
6
|
+
<% if attribute.field_type == :check_box %>
|
7
|
+
<div class="form-check">
|
8
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-check-input' %>
|
9
|
+
<%%= f.label :<%= attribute.name %> %>
|
10
|
+
</div>
|
11
|
+
<% else %>
|
12
|
+
<div class="form-group">
|
13
|
+
<%%= f.label :<%= attribute.name %> %>
|
14
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control' %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
<% end -%>
|
18
|
+
<div class="form-group">
|
19
|
+
<%%= f.submit class: "btn btn-primary" %>
|
20
|
+
</div>
|
21
|
+
<%% end %>
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple-bootstrap-forms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Kress
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Override default rails generators to use bootstrap classes on forms.
|
42
|
+
email:
|
43
|
+
- andrew.kress@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- lib/generators/simple_bootstrap_forms_generator.rb
|
52
|
+
- lib/generators/templates/_error.html.erb
|
53
|
+
- lib/generators/templates/_form.html.erb
|
54
|
+
- lib/generators/templates/simple.rb
|
55
|
+
- lib/simple/bootstrap/forms.rb
|
56
|
+
- lib/simple/bootstrap/forms/railtie.rb
|
57
|
+
- lib/simple/bootstrap/forms/version.rb
|
58
|
+
homepage: https://github.com/andrewkress/simple-bootstrap-forms
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.7.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Override default rails generators to use bootstrap classes on forms. Bootstrap
|
82
|
+
and other dependencies are not included.
|
83
|
+
test_files: []
|