bootstrap_views_generator 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/.gitignore +69 -0
- data/.travis.yml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +100 -0
- data/LICENSE.txt +21 -0
- data/README.md +103 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bootstrap_views_generator.gemspec +40 -0
- data/lib/bootstrap_views_generator.rb +7 -0
- data/lib/bootstrap_views_generator/version.rb +3 -0
- data/lib/generators/bootstrap/config/simple_form.rb +0 -0
- data/lib/generators/bootstrap/install_generator.rb +84 -0
- data/lib/generators/bootstrap/templates/layouts/application.html.erb.tt +36 -0
- data/lib/generators/bootstrap/templates/layouts/application.html.haml.tt +31 -0
- data/lib/generators/bootstrap/templates/layouts/application.html.slim.tt +33 -0
- data/lib/generators/bootstrap/templates/scaffolds/erb/_form.html.erb +20 -0
- data/lib/generators/bootstrap/templates/scaffolds/erb/edit.html.erb.tt +11 -0
- data/lib/generators/bootstrap/templates/scaffolds/erb/index.html.erb.tt +35 -0
- data/lib/generators/bootstrap/templates/scaffolds/erb/new.html.erb.tt +9 -0
- data/lib/generators/bootstrap/templates/scaffolds/erb/show.html.erb.tt +14 -0
- data/lib/generators/bootstrap/templates/scaffolds/haml/_form.html.haml +17 -0
- data/lib/generators/bootstrap/templates/scaffolds/haml/edit.html.haml.tt +6 -0
- data/lib/generators/bootstrap/templates/scaffolds/haml/index.html.haml.tt +22 -0
- data/lib/generators/bootstrap/templates/scaffolds/haml/new.html.haml.tt +4 -0
- data/lib/generators/bootstrap/templates/scaffolds/haml/show.html.haml.tt +15 -0
- data/lib/generators/bootstrap/templates/scaffolds/slim/_form.html.slim +17 -0
- data/lib/generators/bootstrap/templates/scaffolds/slim/edit.html.slim.tt +11 -0
- data/lib/generators/bootstrap/templates/scaffolds/slim/index.html.slim.tt +24 -0
- data/lib/generators/bootstrap/templates/scaffolds/slim/new.html.slim.tt +8 -0
- data/lib/generators/bootstrap/templates/scaffolds/slim/show.html.slim.tt +13 -0
- data/lib/generators/bootstrap/templates/shared/_pagination.html.erb +7 -0
- data/lib/generators/bootstrap/templates/shared/_pagination.html.haml +4 -0
- data/lib/generators/bootstrap/templates/shared/_pagination.html.slim +4 -0
- data/lib/generators/bootstrap/templates/simple_form/_form.html.erb +14 -0
- data/lib/generators/bootstrap/templates/simple_form/_form.html.haml +10 -0
- data/lib/generators/bootstrap/templates/simple_form/_form.html.slim +10 -0
- metadata +146 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: aad44a4e5a224944951234f95967144f2de26a6e9b27d5f031639796ff998e45
|
|
4
|
+
data.tar.gz: d948f59e563b3ff157fd629725277c8b2c09dd4dc6aa35b87a242733b37eae2e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f91716655d420d761d5f1cf449165ca33a89fcd27a53d9756d1d9b3449f3d04df6ec0b9b80bd62a6210be057a72f13629c4fa56fd5cf1e18086695a3c0ff6e36
|
|
7
|
+
data.tar.gz: ab44a7d55c0d921ec701cfb1435346b7404692753a6381fd99d8d4e28739408af1f1cd42f4b337c46978ef26e6244d2be5aa584161331b788003cb02dd07440b
|
data/.gitignore
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config.
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore OS based config files
|
|
11
|
+
*.swp
|
|
12
|
+
*.Thumbs.db
|
|
13
|
+
*.DS_Store
|
|
14
|
+
*/.DS_Store
|
|
15
|
+
.idea/*
|
|
16
|
+
.backup/*
|
|
17
|
+
|
|
18
|
+
# Ignore Rails generated caching files
|
|
19
|
+
.sass-cache/
|
|
20
|
+
.bundle/*
|
|
21
|
+
vendor/bundle/
|
|
22
|
+
vendor/cache/
|
|
23
|
+
cache/*
|
|
24
|
+
dump.rdb
|
|
25
|
+
coverage/*
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Ignore basic notes, docs, etc
|
|
29
|
+
docs/*
|
|
30
|
+
|
|
31
|
+
# Ignore Generated files, that should be build when pushing to production
|
|
32
|
+
public/assets/
|
|
33
|
+
public/javascripts/*.js
|
|
34
|
+
public/packs
|
|
35
|
+
public/stylesheets/*.css
|
|
36
|
+
/node_modules
|
|
37
|
+
|
|
38
|
+
# Ignore the default SQLite database.
|
|
39
|
+
/db/*.sqlite3
|
|
40
|
+
/db/*.sqlite3-journal
|
|
41
|
+
db/database.sqlite.yml
|
|
42
|
+
db/database.oracle.yml
|
|
43
|
+
db/data/seed.rb
|
|
44
|
+
db/scheme.rb
|
|
45
|
+
|
|
46
|
+
# Ignore all logfiles and tempfiles.
|
|
47
|
+
/log/*
|
|
48
|
+
/tmp/*
|
|
49
|
+
!/log/.keep
|
|
50
|
+
!/tmp/.keep
|
|
51
|
+
|
|
52
|
+
# Ignore uploaded files in development
|
|
53
|
+
/storage/*
|
|
54
|
+
!/storage/.keep
|
|
55
|
+
|
|
56
|
+
# Node / Yarn package files
|
|
57
|
+
node_modules/
|
|
58
|
+
yarn-error.log
|
|
59
|
+
|
|
60
|
+
/public/assets
|
|
61
|
+
.byebug_history
|
|
62
|
+
|
|
63
|
+
# Ignore master key for decrypting credentials and more.
|
|
64
|
+
/config/master.key
|
|
65
|
+
|
|
66
|
+
# Ignore application based files
|
|
67
|
+
.idea
|
|
68
|
+
.vagrant
|
|
69
|
+
*.gem
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
bootstrap_views_generator (0.0.4)
|
|
5
|
+
bootstrap (>= 4.0)
|
|
6
|
+
railties (>= 5.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actionpack (5.2.3)
|
|
12
|
+
actionview (= 5.2.3)
|
|
13
|
+
activesupport (= 5.2.3)
|
|
14
|
+
rack (~> 2.0)
|
|
15
|
+
rack-test (>= 0.6.3)
|
|
16
|
+
rails-dom-testing (~> 2.0)
|
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
18
|
+
actionview (5.2.3)
|
|
19
|
+
activesupport (= 5.2.3)
|
|
20
|
+
builder (~> 3.1)
|
|
21
|
+
erubi (~> 1.4)
|
|
22
|
+
rails-dom-testing (~> 2.0)
|
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
24
|
+
activesupport (5.2.3)
|
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
26
|
+
i18n (>= 0.7, < 2)
|
|
27
|
+
minitest (~> 5.1)
|
|
28
|
+
tzinfo (~> 1.1)
|
|
29
|
+
autoprefixer-rails (9.5.1.1)
|
|
30
|
+
execjs
|
|
31
|
+
bootstrap (4.3.1)
|
|
32
|
+
autoprefixer-rails (>= 9.1.0)
|
|
33
|
+
popper_js (>= 1.14.3, < 2)
|
|
34
|
+
sassc-rails (>= 2.0.0)
|
|
35
|
+
builder (3.2.3)
|
|
36
|
+
concurrent-ruby (1.1.5)
|
|
37
|
+
crass (1.0.4)
|
|
38
|
+
erubi (1.8.0)
|
|
39
|
+
execjs (2.7.0)
|
|
40
|
+
ffi (1.10.0)
|
|
41
|
+
i18n (1.6.0)
|
|
42
|
+
concurrent-ruby (~> 1.0)
|
|
43
|
+
loofah (2.2.3)
|
|
44
|
+
crass (~> 1.0.2)
|
|
45
|
+
nokogiri (>= 1.5.9)
|
|
46
|
+
method_source (0.9.2)
|
|
47
|
+
mini_portile2 (2.4.0)
|
|
48
|
+
minitest (5.11.3)
|
|
49
|
+
nokogiri (1.10.3)
|
|
50
|
+
mini_portile2 (~> 2.4.0)
|
|
51
|
+
popper_js (1.14.5)
|
|
52
|
+
rack (2.0.7)
|
|
53
|
+
rack-test (1.1.0)
|
|
54
|
+
rack (>= 1.0, < 3)
|
|
55
|
+
rails-dom-testing (2.0.3)
|
|
56
|
+
activesupport (>= 4.2.0)
|
|
57
|
+
nokogiri (>= 1.6)
|
|
58
|
+
rails-html-sanitizer (1.0.4)
|
|
59
|
+
loofah (~> 2.2, >= 2.2.2)
|
|
60
|
+
railties (5.2.3)
|
|
61
|
+
actionpack (= 5.2.3)
|
|
62
|
+
activesupport (= 5.2.3)
|
|
63
|
+
method_source
|
|
64
|
+
rake (>= 0.8.7)
|
|
65
|
+
thor (>= 0.19.0, < 2.0)
|
|
66
|
+
rake (10.5.0)
|
|
67
|
+
sassc (2.0.1)
|
|
68
|
+
ffi (~> 1.9)
|
|
69
|
+
rake
|
|
70
|
+
sassc-rails (2.1.1)
|
|
71
|
+
railties (>= 4.0.0)
|
|
72
|
+
sassc (>= 2.0)
|
|
73
|
+
sprockets (> 3.0)
|
|
74
|
+
sprockets-rails
|
|
75
|
+
tilt
|
|
76
|
+
sprockets (3.7.2)
|
|
77
|
+
concurrent-ruby (~> 1.0)
|
|
78
|
+
rack (> 1, < 3)
|
|
79
|
+
sprockets-rails (3.2.1)
|
|
80
|
+
actionpack (>= 4.0)
|
|
81
|
+
activesupport (>= 4.0)
|
|
82
|
+
sprockets (>= 3.0.0)
|
|
83
|
+
thor (0.20.3)
|
|
84
|
+
thread_safe (0.3.6)
|
|
85
|
+
tilt (2.0.9)
|
|
86
|
+
tzinfo (1.2.5)
|
|
87
|
+
thread_safe (~> 0.1)
|
|
88
|
+
|
|
89
|
+
PLATFORMS
|
|
90
|
+
ruby
|
|
91
|
+
|
|
92
|
+
DEPENDENCIES
|
|
93
|
+
bootstrap (~> 4.0)
|
|
94
|
+
bootstrap_views_generator!
|
|
95
|
+
bundler (~> 1.17)
|
|
96
|
+
railties (>= 5.2)
|
|
97
|
+
rake (~> 10.0)
|
|
98
|
+
|
|
99
|
+
BUNDLED WITH
|
|
100
|
+
1.17.2
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Brandon Hicks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# BootstrapViewsGenerator
|
|
2
|
+
|
|
3
|
+
 [](http://opensource.org/licenses/MIT) [](http://rubygems.org/gems/bootstrap_views_generator "View this project in Rubygems")
|
|
4
|
+
|
|
5
|
+
This gem is used for generating Bootstrap based scaffold views for your Rails application. They can be Erb, Slim, or HAML. You can include pagination (using Pagy), simple_form (for the form components), and if you'd like you can utilize the meta-tags gems to all dynamic page titles when switching between your view components.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'bootstrap_views_generator', group: :development
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install bootstrap_views_generator
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
Usage:
|
|
27
|
+
rails g bootstrap:install [options]
|
|
28
|
+
|
|
29
|
+
Options:
|
|
30
|
+
Options:
|
|
31
|
+
-t, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
|
|
32
|
+
# Default: erb
|
|
33
|
+
--simpleform # Indicates if simpleform will be used
|
|
34
|
+
# Default: false
|
|
35
|
+
--pagination # Specify if you want to add pagination to the index pages
|
|
36
|
+
# Defaults: false (requires Pagy to use pagination)
|
|
37
|
+
--metatags # If you want the pages titles to use the metatags gem function for the page title
|
|
38
|
+
# Default: false
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Options
|
|
42
|
+
|
|
43
|
+
##### Template Engines
|
|
44
|
+
|
|
45
|
+
Supported Template Engines
|
|
46
|
+
|
|
47
|
+
* ERB
|
|
48
|
+
* HAML
|
|
49
|
+
* Slim
|
|
50
|
+
|
|
51
|
+
**HAML**
|
|
52
|
+
|
|
53
|
+
Make sure you have haml added to your your Gemfile
|
|
54
|
+
```ruby
|
|
55
|
+
gem 'haml-rails'
|
|
56
|
+
|
|
57
|
+
# generate haml views
|
|
58
|
+
rails g bootstrap:install --template_engine=haml
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Slim**
|
|
62
|
+
Make sure you have Slim added to your Gemfile
|
|
63
|
+
```ruby
|
|
64
|
+
gem 'slim-rails'
|
|
65
|
+
|
|
66
|
+
# generate Slim views
|
|
67
|
+
rails g bootstrap:install --template_engine=slim
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Pagination
|
|
71
|
+
|
|
72
|
+
Ensure you have [Pagy](https://github.com/ddnexus/pagy) gem installed
|
|
73
|
+
```ruby
|
|
74
|
+
gem 'pagy'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
#### Meta-Tags
|
|
79
|
+
Ensure you have the [meta-tags](https://github.com/kpumuk/meta-tags) gem installed
|
|
80
|
+
```ruby
|
|
81
|
+
gem 'meta-tags'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Examples
|
|
85
|
+
|
|
86
|
+
Generate bootstrap views with pagination enabled
|
|
87
|
+
```shell
|
|
88
|
+
rails g bootstrap:install --pagination
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Generate bootstrap views with slim and using simple_form
|
|
92
|
+
```shell
|
|
93
|
+
rails g bootstrap:install --template_engine=slim --simpleform
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Extras
|
|
97
|
+
|
|
98
|
+
* If you like to use the [meta-tags](https://github.com/kpumuk/meta-tags) gem to add page titles based on the views.
|
|
99
|
+
* Pagination defaults to using [Pagy](https://github.com/ddnexus/pagy) on the index pages.
|
|
100
|
+
* With [simple_form](https://github.com/plataformatec/simple_form) it is assumed your have already run the simple_form generator for displaying bootstrap based components.
|
|
101
|
+
```shell
|
|
102
|
+
rails generate simple_form:install --bootstrap
|
|
103
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "bootstrap_views_generator"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'bootstrap_views_generator/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'bootstrap_views_generator'
|
|
8
|
+
spec.version = BootstrapViewsGenerator::VERSION
|
|
9
|
+
spec.authors = ['Brandon Hicks']
|
|
10
|
+
spec.email = ['tarellel@gmail.com']
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Bootstrap generators for overwriting the default Rails view generators}
|
|
13
|
+
spec.description = %q{A Rails based generator for creating Bootstrap Views/layouts for for your application}
|
|
14
|
+
spec.homepage = 'https://github.com/tarellel/bootstrap_views_generator'
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
# Going off of minimum version required for Rails_v5.2.3
|
|
18
|
+
spec.required_ruby_version = '>= 2.2.2'
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
22
|
+
else
|
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
24
|
+
"public gem pushes."
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
29
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
31
|
+
end
|
|
32
|
+
spec.bindir = 'exe'
|
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
|
+
spec.require_paths = ['lib']
|
|
35
|
+
|
|
36
|
+
spec.add_runtime_dependency 'bootstrap', '>= 4.0', '< 5'
|
|
37
|
+
spec.add_runtime_dependency 'railties', '>= 5.0'
|
|
38
|
+
spec.add_development_dependency 'bundler', '>= 1.17'
|
|
39
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
|
40
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Bootstrap
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
|
6
|
+
desc 'Overwrite default view scaffolding'
|
|
7
|
+
source_root ::File.expand_path('../templates', __FILE__)
|
|
8
|
+
|
|
9
|
+
class_option :template_engine, type: :string, default: 'erb', aliases: '-t', desc: 'Set template engine to generate the views with'
|
|
10
|
+
# Boolean flags that can be flagged by adding to the generator call ie: --pagination or --metag_tags
|
|
11
|
+
class_option :metatags, type: :boolean, default: false, aliases: "-m", desc: 'If views will assign pages title using metatags gem'
|
|
12
|
+
class_option :pagination, type: :boolean, default: false, aliases: '-p', desc: 'Toggle if pagination will be used with the index view/controller (based off of Pagy)'
|
|
13
|
+
class_option :simpleform, type: :boolean, default: false, aliases: '-sf', desc: 'Enable SimpleForms for the form generating'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def copy_scaffold_views
|
|
17
|
+
%w[edit index show new].each do |file|
|
|
18
|
+
template "scaffolds/#{options[:template_engine]}/#{file}.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/#{file}.html.#{options[:template_engine]}", force: true
|
|
19
|
+
end
|
|
20
|
+
copy_file "scaffolds/#{options[:template_engine]}/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}", force: true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create_layout
|
|
24
|
+
template "layouts/application.html.#{options[:template_engine]}.tt", "app/views/layouts/application.html.#{options[:template_engine]}", force: true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def copy_shared_pagination
|
|
28
|
+
if options[:pagination]
|
|
29
|
+
copy_file "shared/_pagination.html.#{options[:template_engine]}", "app/views/shared/_pagination.html.#{options[:template_engine]}", force: true
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def copy_simpleforms
|
|
34
|
+
if options[:simpleform]
|
|
35
|
+
copy_file "simple_form/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}", force: true
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Inject Bootstrap helpers into teh application_helper file
|
|
40
|
+
def inject_helpers
|
|
41
|
+
helper_str = <<-HELPER
|
|
42
|
+
|
|
43
|
+
# https://gist.github.com/fjahr/b3828b9f4e333e74ba1894687d65e055
|
|
44
|
+
def bootstrap_class_for(flash_type)
|
|
45
|
+
{ success: 'alert-success', error: 'alert-danger', alert: 'alert-warning', notice: 'alert-info' }.stringify_keys[flash_type.to_s] || flash_type.to_s
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def flash_messages(_opts = [])
|
|
49
|
+
return '' unless flash.any?
|
|
50
|
+
|
|
51
|
+
flash.each do |msg_type, message|
|
|
52
|
+
next unless !message.nil? && message.to_s.length.positive?
|
|
53
|
+
|
|
54
|
+
concat(content_tag(:div, message, class: "alert \#{bootstrap_class_for(msg_type)}", role: 'alert') do
|
|
55
|
+
concat content_tag(:button, 'x', class: 'close', data: { dismiss: 'alert' })
|
|
56
|
+
concat message
|
|
57
|
+
end)
|
|
58
|
+
end
|
|
59
|
+
nil
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# for outputting an objects error messages
|
|
63
|
+
def errors_for(object)
|
|
64
|
+
return '' unless object.errors.any?
|
|
65
|
+
|
|
66
|
+
content_tag(:div, class: 'card border-danger') do
|
|
67
|
+
concat(content_tag(:div, class: 'card-header bg-danger text-white') do
|
|
68
|
+
concat "\#{pluralize(object.errors.count, 'error')} prohibited this \#{object.class.name.downcase} from being saved:"
|
|
69
|
+
end)
|
|
70
|
+
concat(content_tag(:ul, class: 'mb-0 list-group list-group-flush') do
|
|
71
|
+
object.errors.full_messages.each do |msg|
|
|
72
|
+
concat content_tag(:li, msg, class: 'list-group-item')
|
|
73
|
+
end
|
|
74
|
+
end)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
HELPER
|
|
78
|
+
|
|
79
|
+
inject_into_file 'app/helpers/application_helper.rb', helper_str, after: "module ApplicationHelper\n"
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta content="IE=Edge" http-equiv="X-UA-Compatible" />
|
|
6
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
7
|
+
<%- if options[:metatags] %>
|
|
8
|
+
<%%= display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>' %>
|
|
9
|
+
<%- else -%>
|
|
10
|
+
<title>Bootstrap template</title>
|
|
11
|
+
<% end -%>
|
|
12
|
+
<%%= csrf_meta_tags %>
|
|
13
|
+
<%%= csp_meta_tag %>
|
|
14
|
+
<%- if options[:skip_turbolinks] -%>
|
|
15
|
+
<%%= stylesheet_link_tag 'application', media: 'all' %>
|
|
16
|
+
<%%= javascript_include_tag 'application' %>
|
|
17
|
+
<%- else -%>
|
|
18
|
+
<%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
|
19
|
+
<%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
20
|
+
<%- end -%>
|
|
21
|
+
<!--IE Polyfill for CSS Elements-->
|
|
22
|
+
<!--HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries-->
|
|
23
|
+
<!--[if lt IE 9]>
|
|
24
|
+
<%%= javascript_include_tag "https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js", "https://oss.maxcdn.com/respond/1.4.2/respond.min.js" %>
|
|
25
|
+
<![endif]-->
|
|
26
|
+
<!--[if lte IE 8]>
|
|
27
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js"></script>
|
|
28
|
+
<![endif]-->
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div class="container-fluid px-3 py-3">
|
|
32
|
+
<%%= flash_messages %>
|
|
33
|
+
<%%= yield %>
|
|
34
|
+
</div>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
!!!
|
|
2
|
+
%html
|
|
3
|
+
%head
|
|
4
|
+
%meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
|
|
5
|
+
%meta{charset: "utf-8"}/
|
|
6
|
+
%meta{content: "IE=Edge", "http-equiv" => "X-UA-Compatible"}/
|
|
7
|
+
%meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
|
|
8
|
+
<%- if options[:metatags] %>
|
|
9
|
+
= display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
|
|
10
|
+
<% else %>
|
|
11
|
+
title Bootstrap template
|
|
12
|
+
<% end %>
|
|
13
|
+
= csrf_meta_tags
|
|
14
|
+
= csp_meta_tag
|
|
15
|
+
<%- if options[:skip_turbolinks] -%>
|
|
16
|
+
= stylesheet_link_tag 'application', media: 'all'
|
|
17
|
+
= javascript_include_tag 'application'
|
|
18
|
+
<%- else -%>
|
|
19
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
|
|
20
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
|
21
|
+
<%- end -%>
|
|
22
|
+
/ IE Polyfill for CSS Elements
|
|
23
|
+
/ HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
|
|
24
|
+
/[if lt IE 9]
|
|
25
|
+
= javascript_include_tag 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js'
|
|
26
|
+
/[if lte IE 8]
|
|
27
|
+
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js'
|
|
28
|
+
%body
|
|
29
|
+
.container-fluid.px-3.py-3
|
|
30
|
+
= flash_messages
|
|
31
|
+
= yield
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html
|
|
3
|
+
head
|
|
4
|
+
meta charset="utf-8"
|
|
5
|
+
meta content="IE=Edge" http-equiv="X-UA-Compatible"
|
|
6
|
+
meta content="width=device-width, initial-scale=1.0" name="viewport"
|
|
7
|
+
<%- if options[:metatags] %>
|
|
8
|
+
= display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
|
|
9
|
+
<% else %>
|
|
10
|
+
title Bootstrap template
|
|
11
|
+
<% end %>
|
|
12
|
+
= csrf_meta_tags
|
|
13
|
+
= csp_meta_tag
|
|
14
|
+
<%- if options[:skip_turbolinks] -%>
|
|
15
|
+
= stylesheet_link_tag 'application', media: 'all'
|
|
16
|
+
= javascript_include_tag 'application'
|
|
17
|
+
<%- else -%>
|
|
18
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
|
|
19
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
|
20
|
+
<%- end -%>
|
|
21
|
+
/! IE Polyfill for CSS Elements
|
|
22
|
+
/! HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
|
|
23
|
+
/[if lt IE 9]
|
|
24
|
+
script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"
|
|
25
|
+
script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"
|
|
26
|
+
/[if lte IE 8]
|
|
27
|
+
// a library PolyFill for earlier IE Versions
|
|
28
|
+
// https://github.com/WebReflection/ie8
|
|
29
|
+
script src="https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js"
|
|
30
|
+
body
|
|
31
|
+
.container-fluid.px-3.py-3
|
|
32
|
+
= flash_messages
|
|
33
|
+
= yield
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%%= form_with(model: @<%= singular_table_name %>, local: true) do |f| %>
|
|
2
|
+
<%%= errors_for(@<%= singular_table_name %>) %>
|
|
3
|
+
|
|
4
|
+
<% attributes.each do |attribute| -%>
|
|
5
|
+
<%- if attribute.field_type == :check_box %>
|
|
6
|
+
<div class="form-check">
|
|
7
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-check-input' %>
|
|
8
|
+
<%%= f.label :<%= attribute.name %> %>
|
|
9
|
+
</div>
|
|
10
|
+
<%- else -%>
|
|
11
|
+
<div class="form-group">
|
|
12
|
+
<%%= f.label :<%= attribute.name %> %>
|
|
13
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control' %>
|
|
14
|
+
</div>
|
|
15
|
+
<% end -%>
|
|
16
|
+
<% end -%>
|
|
17
|
+
<div class="form-group">
|
|
18
|
+
<%%= f.submit class: "btn btn-primary" %>
|
|
19
|
+
</div>
|
|
20
|
+
<%% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
<h1><%%%- title('Editing <%%= singular_table_name.titleize %>') %></h1>
|
|
3
|
+
<%- else -%>
|
|
4
|
+
<h1>Editing <%%= plural_table_name.titleize %></h1>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<%%%= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %> %>
|
|
9
|
+
|
|
10
|
+
<%%%= link_to 'Show', @<%%= singular_table_name %> %> |
|
|
11
|
+
<%%%= link_to 'Back', <%%= index_helper %>_path %>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<%- if options[:pagination] -%>
|
|
2
|
+
<h1><%%%= title('<%%= plural_table_name.titleize %>') %></h1>
|
|
3
|
+
<%- else -%>
|
|
4
|
+
<h1><%%= plural_table_name.titleize %></h1>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
<table class="table table-striped table-hover table-sm">
|
|
8
|
+
<thead>
|
|
9
|
+
<tr>
|
|
10
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
11
|
+
<th scope="col"><%%= attribute.human_name %></th>
|
|
12
|
+
<%% end -%>
|
|
13
|
+
<th colspan="3" scope="col"></th>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
|
|
17
|
+
<tbody>
|
|
18
|
+
<%%% @<%%= plural_table_name %>.each do |<%%= singular_table_name %>| %>
|
|
19
|
+
<tr>
|
|
20
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
21
|
+
<td><%%%= <%%= singular_table_name %>.<%%= attribute.column_name %> %></td>
|
|
22
|
+
<%% end -%>
|
|
23
|
+
<td><%%%= link_to 'Show', <%%= model_resource_name %> %></td>
|
|
24
|
+
<td><%%%= link_to 'Edit', edit_<%%= singular_route_name %>_path(<%%= singular_table_name %>) %></td>
|
|
25
|
+
<td><%%%= link_to 'Destroy', <%%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<%%% end %>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
31
|
+
<%- if options[:pagination] -%>
|
|
32
|
+
<%%%= render 'shared/pagination' %>
|
|
33
|
+
<% end -%>
|
|
34
|
+
<br>
|
|
35
|
+
<%%%= link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
<h1><%%%- title('New <%%= singular_table_name.titleize %>') %></h1>
|
|
3
|
+
<%- else -%>
|
|
4
|
+
<h1>New <%%= plural_table_name.titleize %></h1>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
<%%%= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %> %>
|
|
8
|
+
|
|
9
|
+
<%%%= link_to 'Back', <%%= index_helper %>_path %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
<h1><%%%= title('<%%= singular_table_name.titleize %>') %></h1>
|
|
3
|
+
<%- else -%>
|
|
4
|
+
<h1><%%= plural_table_name.titleize %></h1>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
<dl>
|
|
8
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
9
|
+
<dt><%%= attribute.human_name %>:</dt>
|
|
10
|
+
<dd><%%%= @<%%= singular_table_name %>.<%%= attribute.name %> %></dd>
|
|
11
|
+
<%% end -%>
|
|
12
|
+
</dl>
|
|
13
|
+
<%%%= link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>) %> |
|
|
14
|
+
<%%%= link_to 'Back', <%%= index_helper %>_path %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
= form_for @<%= singular_table_name %>, local: true do |f|
|
|
2
|
+
- if @<%= singular_table_name %>.errors.any?
|
|
3
|
+
= errors_for(@<%= singular_table_name %>)
|
|
4
|
+
|
|
5
|
+
<% attributes.each do |attribute| -%>
|
|
6
|
+
<% if attribute.field_type == :check_box %>
|
|
7
|
+
.form-group.form-check
|
|
8
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-check-input'
|
|
9
|
+
= f.label :<%= attribute.name %>, class: 'form-check-label'
|
|
10
|
+
<% else %>
|
|
11
|
+
.form-group
|
|
12
|
+
= f.label :<%= attribute.name %>
|
|
13
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control'
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end -%>
|
|
16
|
+
.form-group
|
|
17
|
+
= f.submit class: 'btn btn-primary btn-sm'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
%h1= title('<%%= plural_table_name.titleize %>')
|
|
2
|
+
%table.table.table-striped.table-hover.table-sm
|
|
3
|
+
%thead
|
|
4
|
+
%tr
|
|
5
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
6
|
+
%th{scope: "col"} <%%= attribute.human_name %>
|
|
7
|
+
<%% end -%>
|
|
8
|
+
%th{colspan: "3", scope: "col"}
|
|
9
|
+
%tbody
|
|
10
|
+
- @<%%= plural_table_name %>.each do |<%%= singular_table_name %>|
|
|
11
|
+
%tr
|
|
12
|
+
<%% attributes.each do |attribute| -%>
|
|
13
|
+
%td= <%%= singular_table_name %>.<%%= attribute.name %>
|
|
14
|
+
<%% end -%>
|
|
15
|
+
%td= link_to 'Show', <%%= singular_table_name %>
|
|
16
|
+
%td= link_to 'Edit', edit_<%%= singular_table_name %>_path(<%%= singular_table_name %>)
|
|
17
|
+
%td= link_to 'Destroy', <%%= singular_table_name %>, data: { confirm: 'Are you sure?' }, method: :delete
|
|
18
|
+
<% if options[:pagination] -%>
|
|
19
|
+
= render 'shared/pagination'
|
|
20
|
+
<% end -%>
|
|
21
|
+
%br
|
|
22
|
+
= link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
%h1= title('<%%= singular_table_name.titleize %>')
|
|
3
|
+
<%- else -%>
|
|
4
|
+
%h1 <%%= singular_table_name.titleize %>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
%dl
|
|
9
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
10
|
+
%dt <%%= attribute.human_name %>:
|
|
11
|
+
%dd= @<%%= singular_table_name %>.<%%= attribute.name %>
|
|
12
|
+
<%% end -%>
|
|
13
|
+
= link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>)
|
|
14
|
+
|
|
|
15
|
+
= link_to 'Back', <%%= index_helper %>_path
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
= form_for @<%= singular_table_name %>, local: true do |f|
|
|
2
|
+
- if @<%= singular_table_name %>.errors.any?
|
|
3
|
+
= errors_for(@<%= singular_table_name %>)
|
|
4
|
+
|
|
5
|
+
<% attributes.each do |attribute| -%>
|
|
6
|
+
<%- if attribute.field_type == :check_box %>
|
|
7
|
+
.form-group.form-check
|
|
8
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-check-input'
|
|
9
|
+
= f.label :<%= attribute.name %>, class: 'form-check-label'
|
|
10
|
+
<%- else -%>
|
|
11
|
+
.form-group
|
|
12
|
+
= f.label :<%= attribute.name %>
|
|
13
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control'
|
|
14
|
+
<% end -%>
|
|
15
|
+
<% end -%>
|
|
16
|
+
.form-group
|
|
17
|
+
= f.submit class: 'btn btn-primary btn-sm'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
h1 = title('Editing <%%= singular_table_name.titleize %>')
|
|
3
|
+
<%- else -%>
|
|
4
|
+
h1 Editing <%%= plural_table_name.titleize %>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
|
|
8
|
+
|
|
9
|
+
= link_to 'Show', @<%%= singular_table_name %>
|
|
10
|
+
'|
|
|
11
|
+
= link_to 'Back', <%%= index_helper %>_path
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
h1 = title('<%%= plural_table_name.titleize %>')
|
|
2
|
+
|
|
3
|
+
table.table.table-striped.table-hover.table-sm
|
|
4
|
+
thead
|
|
5
|
+
tr
|
|
6
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
7
|
+
th scope="col" <%%= attribute.human_name %>
|
|
8
|
+
<%% end -%>
|
|
9
|
+
th colspan="3" scope="col"
|
|
10
|
+
|
|
11
|
+
tbody
|
|
12
|
+
- @<%%= plural_table_name %>.each do |<%%= singular_table_name %>|
|
|
13
|
+
tr
|
|
14
|
+
<%% attributes.each do |attribute| -%>
|
|
15
|
+
td = <%%= singular_table_name %>.<%%= attribute.name %>
|
|
16
|
+
<%% end -%>
|
|
17
|
+
td = link_to 'Show', <%%= singular_table_name %>
|
|
18
|
+
td = link_to 'Edit', edit_<%%= singular_table_name %>_path(<%%= singular_table_name %>)
|
|
19
|
+
td = link_to 'Destroy', <%%= singular_table_name %>, data: { confirm: 'Are you sure?' }, method: :delete
|
|
20
|
+
<%- if options[:pagination] -%>
|
|
21
|
+
= render 'shared/pagination'
|
|
22
|
+
<% end -%>
|
|
23
|
+
br
|
|
24
|
+
= link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
h1 = title('New <%%= singular_table_name.titleize %>')
|
|
3
|
+
<%- else -%>
|
|
4
|
+
h1 New <%%= plural_table_name.titleize %>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
|
|
7
|
+
= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
|
|
8
|
+
= link_to 'Back', <%%= index_helper %>_path
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%- if options[:metatags] %>
|
|
2
|
+
h1 = title('<%%= singular_table_name.titleize %>')
|
|
3
|
+
<%- else -%>
|
|
4
|
+
h1 <%%= singular_table_name.titleize %>
|
|
5
|
+
<%- end -%>
|
|
6
|
+
dl
|
|
7
|
+
<%% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
8
|
+
dt <%%= attribute.human_name %>:
|
|
9
|
+
dd = @<%%= singular_table_name %>.<%%= attribute.name %>
|
|
10
|
+
<%% end -%>
|
|
11
|
+
= link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>)
|
|
12
|
+
'|
|
|
13
|
+
= link_to 'Back', <%%= index_helper %>_path
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%# frozen_string_literal: true %>
|
|
2
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
|
3
|
+
<%%= errors_for(@<%= singular_table_name %>) %>
|
|
4
|
+
|
|
5
|
+
<div class="form-inputs">
|
|
6
|
+
<%- attributes.each do |attribute| -%>
|
|
7
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
|
8
|
+
<%- end -%>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="form-actions">
|
|
12
|
+
<%%= f.button :submit, class: 'btn-primary' %>
|
|
13
|
+
</div>
|
|
14
|
+
<%% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
= simple_form_for(@<%= singular_table_name %>) do |f|
|
|
2
|
+
= errors_for(@<%= singular_table_name %>)
|
|
3
|
+
|
|
4
|
+
.form-inputs
|
|
5
|
+
<%- attributes.each do |attribute| -%>
|
|
6
|
+
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
|
7
|
+
<%- end -%>
|
|
8
|
+
|
|
9
|
+
.form-actions
|
|
10
|
+
= f.button :submit, class: 'btn-primary'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
= simple_form_for(@<%= singular_table_name %>) do |f|
|
|
2
|
+
= errors_for(@<%= singular_table_name %>)
|
|
3
|
+
|
|
4
|
+
.form-inputs
|
|
5
|
+
<%- attributes.each do |attribute| -%>
|
|
6
|
+
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
|
7
|
+
<%- end -%>
|
|
8
|
+
|
|
9
|
+
.form-actions
|
|
10
|
+
= f.button :submit, class: 'btn-primary'
|
metadata
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bootstrap_views_generator
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Brandon Hicks
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bootstrap
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '4.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: railties
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '5.0'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '5.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: bundler
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '1.17'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '1.17'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rake
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '10.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '10.0'
|
|
75
|
+
description: A Rails based generator for creating Bootstrap Views/layouts for for
|
|
76
|
+
your application
|
|
77
|
+
email:
|
|
78
|
+
- tarellel@gmail.com
|
|
79
|
+
executables: []
|
|
80
|
+
extensions: []
|
|
81
|
+
extra_rdoc_files: []
|
|
82
|
+
files:
|
|
83
|
+
- ".gitignore"
|
|
84
|
+
- ".travis.yml"
|
|
85
|
+
- Gemfile
|
|
86
|
+
- Gemfile.lock
|
|
87
|
+
- LICENSE.txt
|
|
88
|
+
- README.md
|
|
89
|
+
- Rakefile
|
|
90
|
+
- bin/console
|
|
91
|
+
- bin/setup
|
|
92
|
+
- bootstrap_views_generator.gemspec
|
|
93
|
+
- lib/bootstrap_views_generator.rb
|
|
94
|
+
- lib/bootstrap_views_generator/version.rb
|
|
95
|
+
- lib/generators/bootstrap/config/simple_form.rb
|
|
96
|
+
- lib/generators/bootstrap/install_generator.rb
|
|
97
|
+
- lib/generators/bootstrap/templates/layouts/application.html.erb.tt
|
|
98
|
+
- lib/generators/bootstrap/templates/layouts/application.html.haml.tt
|
|
99
|
+
- lib/generators/bootstrap/templates/layouts/application.html.slim.tt
|
|
100
|
+
- lib/generators/bootstrap/templates/scaffolds/erb/_form.html.erb
|
|
101
|
+
- lib/generators/bootstrap/templates/scaffolds/erb/edit.html.erb.tt
|
|
102
|
+
- lib/generators/bootstrap/templates/scaffolds/erb/index.html.erb.tt
|
|
103
|
+
- lib/generators/bootstrap/templates/scaffolds/erb/new.html.erb.tt
|
|
104
|
+
- lib/generators/bootstrap/templates/scaffolds/erb/show.html.erb.tt
|
|
105
|
+
- lib/generators/bootstrap/templates/scaffolds/haml/_form.html.haml
|
|
106
|
+
- lib/generators/bootstrap/templates/scaffolds/haml/edit.html.haml.tt
|
|
107
|
+
- lib/generators/bootstrap/templates/scaffolds/haml/index.html.haml.tt
|
|
108
|
+
- lib/generators/bootstrap/templates/scaffolds/haml/new.html.haml.tt
|
|
109
|
+
- lib/generators/bootstrap/templates/scaffolds/haml/show.html.haml.tt
|
|
110
|
+
- lib/generators/bootstrap/templates/scaffolds/slim/_form.html.slim
|
|
111
|
+
- lib/generators/bootstrap/templates/scaffolds/slim/edit.html.slim.tt
|
|
112
|
+
- lib/generators/bootstrap/templates/scaffolds/slim/index.html.slim.tt
|
|
113
|
+
- lib/generators/bootstrap/templates/scaffolds/slim/new.html.slim.tt
|
|
114
|
+
- lib/generators/bootstrap/templates/scaffolds/slim/show.html.slim.tt
|
|
115
|
+
- lib/generators/bootstrap/templates/shared/_pagination.html.erb
|
|
116
|
+
- lib/generators/bootstrap/templates/shared/_pagination.html.haml
|
|
117
|
+
- lib/generators/bootstrap/templates/shared/_pagination.html.slim
|
|
118
|
+
- lib/generators/bootstrap/templates/simple_form/_form.html.erb
|
|
119
|
+
- lib/generators/bootstrap/templates/simple_form/_form.html.haml
|
|
120
|
+
- lib/generators/bootstrap/templates/simple_form/_form.html.slim
|
|
121
|
+
homepage: https://github.com/tarellel/bootstrap_views_generator
|
|
122
|
+
licenses:
|
|
123
|
+
- MIT
|
|
124
|
+
metadata:
|
|
125
|
+
homepage_uri: https://github.com/tarellel/bootstrap_views_generator
|
|
126
|
+
source_code_uri: https://github.com/tarellel/bootstrap_views_generator
|
|
127
|
+
post_install_message:
|
|
128
|
+
rdoc_options: []
|
|
129
|
+
require_paths:
|
|
130
|
+
- lib
|
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: 2.2.2
|
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0'
|
|
141
|
+
requirements: []
|
|
142
|
+
rubygems_version: 3.0.3
|
|
143
|
+
signing_key:
|
|
144
|
+
specification_version: 4
|
|
145
|
+
summary: Bootstrap generators for overwriting the default Rails view generators
|
|
146
|
+
test_files: []
|