bootstrap-sass-extras 0.0.3 → 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 +5 -5
- data/.travis.yml +9 -0
- data/CHANGELOG.md +48 -5
- data/Gemfile +4 -1
- data/Gemfile.lock +147 -87
- data/README.md +142 -34
- data/Rakefile +11 -1
- data/app/helpers/badge_helper.rb +13 -0
- data/app/helpers/bootstrap_flash_helper.rb +18 -10
- data/app/helpers/bootstrap_viewport_meta_helper.rb +27 -0
- data/app/helpers/glyph_helper.rb +10 -7
- data/app/helpers/modal_helper.rb +19 -15
- data/app/helpers/nav_helper.rb +40 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +8 -2
- data/app/helpers/url_helper.rb +28 -0
- data/app/views/bootstrap_sass_extras/_breadcrumbs.html.erb +6 -0
- data/bootstrap-sass-extras.gemspec +1 -0
- data/lib/bootstrap-sass-extras/breadcrumbs.rb +57 -0
- data/lib/bootstrap-sass-extras/engine.rb +6 -0
- data/lib/bootstrap-sass-extras/version.rb +1 -1
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +1 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +39 -57
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +27 -45
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +27 -46
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +6 -6
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +11 -9
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +9 -8
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +9 -9
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +2 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +2 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +2 -2
- data/lib/generators/bootstrap/themed/templates/index.html.erb +16 -14
- data/lib/generators/bootstrap/themed/templates/index.html.haml +11 -7
- data/lib/generators/bootstrap/themed/templates/index.html.slim +13 -11
- data/lib/generators/bootstrap/themed/templates/new.html.erb +2 -2
- data/lib/generators/bootstrap/themed/templates/new.html.haml +2 -2
- data/lib/generators/bootstrap/themed/templates/new.html.slim +3 -3
- data/lib/generators/bootstrap/themed/templates/show.html.erb +19 -17
- data/lib/generators/bootstrap/themed/templates/show.html.haml +12 -12
- data/lib/generators/bootstrap/themed/templates/show.html.slim +12 -11
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +9 -7
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +6 -5
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +6 -6
- data/spec/dummy/README.rdoc +15 -248
- data/spec/dummy/Rakefile +1 -2
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/{mailers/.gitkeep → assets/images/.keep} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +4 -6
- data/spec/dummy/app/assets/stylesheets/application.css +6 -4
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/{models/.gitkeep → controllers/concerns/.keep} +0 -0
- data/spec/dummy/{lib/assets/.gitkeep → app/mailers/.keep} +0 -0
- data/spec/dummy/{log/.gitkeep → app/models/.keep} +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/application/_custom_breadcrumbs.html.erb +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +2 -2
- data/spec/dummy/config/application.rb +1 -37
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/database.yml +8 -8
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +19 -14
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -6
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +23 -25
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +54 -13
- data/spec/dummy/public/422.html +54 -13
- data/spec/dummy/public/500.html +53 -12
- data/spec/helpers/badge_helper_spec.rb +16 -0
- data/spec/helpers/bootstrap_flash_helper_spec.rb +52 -12
- data/spec/helpers/bootstrap_viewport_meta_helper_spec.rb +17 -0
- data/spec/helpers/button_to_helper_spec.rb +33 -0
- data/spec/helpers/glyph_helper_spec.rb +15 -0
- data/spec/helpers/nav_helper_spec.rb +79 -0
- data/spec/helpers/twitter_breadcrumbs_helper_spec.rb +161 -0
- data/spec/spec_helper.rb +1 -1
- metadata +69 -30
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +0 -14
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/script/rails +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 83b3f7ce19029b2f212c749c14e38b51c11ca5478e3f8a8a04494c8644880aa9
|
|
4
|
+
data.tar.gz: 45dc961f7f3616e4e933fb4231855f1c689f2764049e5f7b6ca1ca518fb4cb46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab324f770c30db9789a28a3ee3f3956103ee456f030811f93233c5655fc856ffc5f9648fb1075bdb75461fc61dd0e0ecdaaa5902d9111fb352ad28276c8612a7
|
|
7
|
+
data.tar.gz: d9e551e802d1859661320e1ca9a2ef217c8ab64c92880110197421e8e7b999853ce4537acb632deaf596fca52a7347f9535ecc09a843310136584acb3a1b3b79
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Release 0.1.0
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
- Avoid dangerous calling of methods [@dlackty][]
|
|
6
|
+
- Fix Travis CI [@dlackty][]
|
|
7
|
+
- Add nav_to option to force active state [@sharshenov][]
|
|
8
|
+
- use `before_action` over `before_filter` [@cantonic][]
|
|
9
|
+
- Treat space-separated class names the same as arrays of class names in
|
|
10
|
+
button_to_with_bootstrap [@marcp][]
|
|
11
|
+
- Freeze ALERT_TYPES_MAP to save allocations
|
|
12
|
+
|
|
13
|
+
## Release 0.0.7
|
|
14
|
+
|
|
15
|
+
- Added the ability to specify a custom view path for breadcrumbs [@fredwu][]
|
|
16
|
+
- Put locale arg for String#pluralize in the view templates [@kayhide][]
|
|
17
|
+
- Fix .haml themed template show.html.haml [@mskubenich][]
|
|
18
|
+
- Augment button_to to generate the `btn` Bootstrap class. [@lowjoel][]
|
|
19
|
+
- Given the nav helper, generate the appropriate Bootstrap tabs markup.
|
|
20
|
+
[@lowjoel][]
|
|
21
|
+
- Allow pills and tabs to be used in the same manner. [@lowjoel][]
|
|
22
|
+
|
|
23
|
+
## Release 0.0.6
|
|
24
|
+
|
|
25
|
+
- Update to bootstrap 3.0
|
|
26
|
+
- Add a `badge(badge_count)` helper by [@pdobb][]
|
|
27
|
+
- Clean up codes by [@pdobb][]
|
|
28
|
+
|
|
29
|
+
## Release 0.0.5
|
|
30
|
+
|
|
31
|
+
- Adjust bootstrap_flash to match bootstrap alerts by [@jonwaghorn][]
|
|
32
|
+
- Rails Form Helper for Bootstrap META tag by [@dabit][]
|
|
33
|
+
|
|
34
|
+
## Release 0.0.4
|
|
35
|
+
|
|
36
|
+
- Fix BreadCrumbs Helper
|
|
37
|
+
|
|
38
|
+
## Release 0.0.3
|
|
39
|
+
|
|
40
|
+
- Add glyph, model and breadcrumbs helpers
|
|
41
|
+
- Update templates
|
|
7
42
|
|
|
8
43
|
## Release 0.0.2
|
|
9
44
|
|
|
10
|
-
|
|
45
|
+
- Add layout and views generators
|
|
11
46
|
|
|
12
47
|
## Release 0.0.1
|
|
13
48
|
|
|
14
|
-
|
|
49
|
+
- Initial version
|
|
50
|
+
|
|
51
|
+
[@lowjoel]: https://github.com/lowjoel
|
|
52
|
+
[@mskubenich]: https://github.com/mskubenich
|
|
53
|
+
[@kayhide]: https://github.com/kayhide
|
|
54
|
+
[@fredwu]: https://github.com/fredwu
|
|
55
|
+
[@jonwaghorn]: https://github.com/jonwaghorn
|
|
56
|
+
[@pdobb]: https://github.com/pdobb
|
|
57
|
+
[@dabit]: https://github.com/dabit
|
data/Gemfile
CHANGED
|
@@ -3,4 +3,7 @@ source "http://rubygems.org"
|
|
|
3
3
|
# Declare your gem's dependencies in bootstrap-sass-extras.gemspec.
|
|
4
4
|
# Bundler will treat runtime dependencies like base dependencies, and
|
|
5
5
|
# development dependencies will be added by default to the :development group.
|
|
6
|
-
gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# gem 'byebug'
|
|
9
|
+
gem 'pry'
|
data/Gemfile.lock
CHANGED
|
@@ -1,107 +1,167 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bootstrap-sass-extras (0.0
|
|
4
|
+
bootstrap-sass-extras (0.1.0)
|
|
5
5
|
rails (>= 3.1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: http://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
actionpack (= 3.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
10
|
+
actioncable (6.0.3.1)
|
|
11
|
+
actionpack (= 6.0.3.1)
|
|
12
|
+
nio4r (~> 2.0)
|
|
13
|
+
websocket-driver (>= 0.6.1)
|
|
14
|
+
actionmailbox (6.0.3.1)
|
|
15
|
+
actionpack (= 6.0.3.1)
|
|
16
|
+
activejob (= 6.0.3.1)
|
|
17
|
+
activerecord (= 6.0.3.1)
|
|
18
|
+
activestorage (= 6.0.3.1)
|
|
19
|
+
activesupport (= 6.0.3.1)
|
|
20
|
+
mail (>= 2.7.1)
|
|
21
|
+
actionmailer (6.0.3.1)
|
|
22
|
+
actionpack (= 6.0.3.1)
|
|
23
|
+
actionview (= 6.0.3.1)
|
|
24
|
+
activejob (= 6.0.3.1)
|
|
25
|
+
mail (~> 2.5, >= 2.5.4)
|
|
26
|
+
rails-dom-testing (~> 2.0)
|
|
27
|
+
actionpack (6.0.3.1)
|
|
28
|
+
actionview (= 6.0.3.1)
|
|
29
|
+
activesupport (= 6.0.3.1)
|
|
30
|
+
rack (~> 2.0, >= 2.0.8)
|
|
31
|
+
rack-test (>= 0.6.3)
|
|
32
|
+
rails-dom-testing (~> 2.0)
|
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
34
|
+
actiontext (6.0.3.1)
|
|
35
|
+
actionpack (= 6.0.3.1)
|
|
36
|
+
activerecord (= 6.0.3.1)
|
|
37
|
+
activestorage (= 6.0.3.1)
|
|
38
|
+
activesupport (= 6.0.3.1)
|
|
39
|
+
nokogiri (>= 1.8.5)
|
|
40
|
+
actionview (6.0.3.1)
|
|
41
|
+
activesupport (= 6.0.3.1)
|
|
42
|
+
builder (~> 3.1)
|
|
43
|
+
erubi (~> 1.4)
|
|
44
|
+
rails-dom-testing (~> 2.0)
|
|
45
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
46
|
+
activejob (6.0.3.1)
|
|
47
|
+
activesupport (= 6.0.3.1)
|
|
48
|
+
globalid (>= 0.3.6)
|
|
49
|
+
activemodel (6.0.3.1)
|
|
50
|
+
activesupport (= 6.0.3.1)
|
|
51
|
+
activerecord (6.0.3.1)
|
|
52
|
+
activemodel (= 6.0.3.1)
|
|
53
|
+
activesupport (= 6.0.3.1)
|
|
54
|
+
activestorage (6.0.3.1)
|
|
55
|
+
actionpack (= 6.0.3.1)
|
|
56
|
+
activejob (= 6.0.3.1)
|
|
57
|
+
activerecord (= 6.0.3.1)
|
|
58
|
+
marcel (~> 0.3.1)
|
|
59
|
+
activesupport (6.0.3.1)
|
|
60
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
61
|
+
i18n (>= 0.7, < 2)
|
|
62
|
+
minitest (~> 5.1)
|
|
63
|
+
tzinfo (~> 1.1)
|
|
64
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
65
|
+
builder (3.2.4)
|
|
66
|
+
coderay (1.1.2)
|
|
67
|
+
concurrent-ruby (1.1.6)
|
|
68
|
+
crass (1.0.6)
|
|
69
|
+
diff-lcs (1.3)
|
|
70
|
+
erubi (1.9.0)
|
|
71
|
+
globalid (0.4.2)
|
|
72
|
+
activesupport (>= 4.2.0)
|
|
73
|
+
i18n (1.8.2)
|
|
74
|
+
concurrent-ruby (~> 1.0)
|
|
75
|
+
loofah (2.5.0)
|
|
76
|
+
crass (~> 1.0.2)
|
|
77
|
+
nokogiri (>= 1.5.9)
|
|
78
|
+
mail (2.7.1)
|
|
79
|
+
mini_mime (>= 0.1.1)
|
|
80
|
+
marcel (0.3.3)
|
|
81
|
+
mimemagic (~> 0.3.2)
|
|
82
|
+
method_source (0.9.2)
|
|
83
|
+
mimemagic (0.3.5)
|
|
84
|
+
mini_mime (1.0.2)
|
|
85
|
+
mini_portile2 (2.4.0)
|
|
86
|
+
minitest (5.14.1)
|
|
87
|
+
nio4r (2.5.4)
|
|
88
|
+
nokogiri (1.10.9)
|
|
89
|
+
mini_portile2 (~> 2.4.0)
|
|
90
|
+
pry (0.12.2)
|
|
91
|
+
coderay (~> 1.1.0)
|
|
92
|
+
method_source (~> 0.9.0)
|
|
93
|
+
rack (2.2.2)
|
|
94
|
+
rack-test (1.1.0)
|
|
95
|
+
rack (>= 1.0, < 3)
|
|
96
|
+
rails (6.0.3.1)
|
|
97
|
+
actioncable (= 6.0.3.1)
|
|
98
|
+
actionmailbox (= 6.0.3.1)
|
|
99
|
+
actionmailer (= 6.0.3.1)
|
|
100
|
+
actionpack (= 6.0.3.1)
|
|
101
|
+
actiontext (= 6.0.3.1)
|
|
102
|
+
actionview (= 6.0.3.1)
|
|
103
|
+
activejob (= 6.0.3.1)
|
|
104
|
+
activemodel (= 6.0.3.1)
|
|
105
|
+
activerecord (= 6.0.3.1)
|
|
106
|
+
activestorage (= 6.0.3.1)
|
|
107
|
+
activesupport (= 6.0.3.1)
|
|
108
|
+
bundler (>= 1.3.0)
|
|
109
|
+
railties (= 6.0.3.1)
|
|
110
|
+
sprockets-rails (>= 2.0.0)
|
|
111
|
+
rails-dom-testing (2.0.3)
|
|
112
|
+
activesupport (>= 4.2.0)
|
|
113
|
+
nokogiri (>= 1.6)
|
|
114
|
+
rails-html-sanitizer (1.3.0)
|
|
115
|
+
loofah (~> 2.3)
|
|
116
|
+
railties (6.0.3.1)
|
|
117
|
+
actionpack (= 6.0.3.1)
|
|
118
|
+
activesupport (= 6.0.3.1)
|
|
119
|
+
method_source
|
|
71
120
|
rake (>= 0.8.7)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
121
|
+
thor (>= 0.20.3, < 2.0)
|
|
122
|
+
rake (13.0.1)
|
|
123
|
+
rspec-core (3.8.2)
|
|
124
|
+
rspec-support (~> 3.8.0)
|
|
125
|
+
rspec-expectations (3.8.4)
|
|
126
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
127
|
+
rspec-support (~> 3.8.0)
|
|
128
|
+
rspec-mocks (3.8.1)
|
|
129
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
130
|
+
rspec-support (~> 3.8.0)
|
|
131
|
+
rspec-rails (3.8.2)
|
|
82
132
|
actionpack (>= 3.0)
|
|
83
133
|
activesupport (>= 3.0)
|
|
84
134
|
railties (>= 3.0)
|
|
85
|
-
rspec-core (~>
|
|
86
|
-
rspec-expectations (~>
|
|
87
|
-
rspec-mocks (~>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
135
|
+
rspec-core (~> 3.8.0)
|
|
136
|
+
rspec-expectations (~> 3.8.0)
|
|
137
|
+
rspec-mocks (~> 3.8.0)
|
|
138
|
+
rspec-support (~> 3.8.0)
|
|
139
|
+
rspec-support (3.8.2)
|
|
140
|
+
sprockets (4.0.2)
|
|
141
|
+
concurrent-ruby (~> 1.0)
|
|
142
|
+
rack (> 1, < 3)
|
|
143
|
+
sprockets-rails (3.2.2)
|
|
144
|
+
actionpack (>= 4.0)
|
|
145
|
+
activesupport (>= 4.0)
|
|
146
|
+
sprockets (>= 3.0.0)
|
|
147
|
+
sqlite3 (1.4.1)
|
|
148
|
+
thor (1.0.1)
|
|
149
|
+
thread_safe (0.3.6)
|
|
150
|
+
tzinfo (1.2.7)
|
|
151
|
+
thread_safe (~> 0.1)
|
|
152
|
+
websocket-driver (0.7.3)
|
|
153
|
+
websocket-extensions (>= 0.1.0)
|
|
154
|
+
websocket-extensions (0.1.5)
|
|
155
|
+
zeitwerk (2.3.0)
|
|
100
156
|
|
|
101
157
|
PLATFORMS
|
|
102
158
|
ruby
|
|
103
159
|
|
|
104
160
|
DEPENDENCIES
|
|
105
161
|
bootstrap-sass-extras!
|
|
162
|
+
pry
|
|
106
163
|
rspec-rails
|
|
107
164
|
sqlite3
|
|
165
|
+
|
|
166
|
+
BUNDLED WITH
|
|
167
|
+
1.17.2
|
data/README.md
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
[1]: https://github.com/thomas-mcdonald/bootstrap-sass
|
|
6
6
|
[2]: https://github.com/seyhunak/twitter-bootstrap-rails
|
|
7
7
|
|
|
8
|
+
[](https://travis-ci.org/doabit/bootstrap-sass-extras)
|
|
9
|
+
|
|
10
|
+
## Note
|
|
11
|
+
|
|
12
|
+
From version 0.0.6, only support bootstrap 3. If you want to use bootstrap 2, please use version 0.0.5.
|
|
13
|
+
|
|
8
14
|
## Installation
|
|
9
15
|
|
|
10
16
|
Add this line to your application's Gemfile:
|
|
@@ -28,65 +34,86 @@ Generate locale
|
|
|
28
34
|
|
|
29
35
|
Usage:
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
```ruby
|
|
38
|
+
rails g bootstrap:install
|
|
39
|
+
```
|
|
34
40
|
|
|
35
41
|
Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
Usage:
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
```ruby
|
|
47
|
+
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
|
|
48
|
+
```
|
|
43
49
|
|
|
44
50
|
Example of a fixed layout:
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
```ruby
|
|
53
|
+
rails g bootstrap:layout application fixed
|
|
54
|
+
```
|
|
49
55
|
|
|
50
56
|
Example of a responsive layout:
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
```ruby
|
|
59
|
+
rails g bootstrap:layout application fluid
|
|
60
|
+
```
|
|
55
61
|
|
|
56
62
|
Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
|
|
57
63
|
|
|
58
64
|
|
|
59
65
|
Usage:
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
```ruby
|
|
68
|
+
rails g bootstrap:themed [RESOURCE_NAME]
|
|
69
|
+
```
|
|
64
70
|
|
|
65
71
|
Example:
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
```ruby
|
|
74
|
+
rails g scaffold Post title:string description:text
|
|
75
|
+
rake db:migrate
|
|
76
|
+
rails g bootstrap:themed Posts
|
|
77
|
+
```
|
|
71
78
|
|
|
72
79
|
Notice the plural usage of the resource to generate bootstrap:themed.
|
|
73
80
|
|
|
74
81
|
## Using Helpers
|
|
75
82
|
|
|
83
|
+
### Viewport Meta Helper
|
|
84
|
+
Add the viewport meta helper `<%= viewport_meta_tag %>` to your layout
|
|
85
|
+
(built-in with layout generator) to render the required meta tag for Bootstrap:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<meta content="width=device-width,initial-scale=1.0" name="viewport" />
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
You can change the content value by passing a hash as an argument:
|
|
92
|
+
|
|
93
|
+
```erb
|
|
94
|
+
<%= viewport_meta_tag(:maximum_scale => "1.0") %>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Renders:
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0" name="viewport" />
|
|
101
|
+
```
|
|
102
|
+
|
|
76
103
|
### Flash helper
|
|
77
104
|
Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
|
|
78
105
|
|
|
79
106
|
### Modal Helper
|
|
80
107
|
You can create modals easily using the following example. The header, body, and footer all accept content_tag or plain html.
|
|
81
|
-
The href of the button to launch the modal must
|
|
82
|
-
|
|
83
|
-
```ruby
|
|
84
|
-
<%= content_tag :a, "Modal", :href => "#modal", :class => 'btn', :data => {:toggle => modal'} %>
|
|
108
|
+
The href of the button to launch the modal must match the id of the modal dialog.
|
|
85
109
|
|
|
110
|
+
```erb
|
|
111
|
+
<%= modal_toggle 'Modal', dialog: '#modal'%>
|
|
86
112
|
<%= modal_dialog :id => "modal",
|
|
87
|
-
:header => { :show_close => true, :
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
:header => { :show_close => true, :title => 'Modal header' },
|
|
114
|
+
:body => 'This is the body',
|
|
115
|
+
:footer => content_tag(:button, 'Save', :class => 'btn btn-primary')
|
|
116
|
+
%>
|
|
90
117
|
```
|
|
91
118
|
|
|
92
119
|
### Breadcrumbs Helpers
|
|
@@ -94,8 +121,6 @@ The href of the button to launch the modal must matche the id of the modal dialo
|
|
|
94
121
|
*Notice* If your application is using [breadcrumbs-on-rails](https://github.com/weppos/breadcrumbs_on_rails) you will have a namespace collision with the add_breadcrumb method.
|
|
95
122
|
You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.
|
|
96
123
|
|
|
97
|
-
Add breadcrumbs helper `<%= render_breadcrumbs %>` to your layout.
|
|
98
|
-
|
|
99
124
|
```ruby
|
|
100
125
|
class ApplicationController
|
|
101
126
|
add_breadcrumb :index, :root_path
|
|
@@ -112,18 +137,101 @@ class ExamplesController < ApplicationController
|
|
|
112
137
|
def show
|
|
113
138
|
@example = Example.find params[:id]
|
|
114
139
|
add_breadcrumb @example.name, example_path(@example)
|
|
115
|
-
|
|
140
|
+
add_breadcrumb :show, example_path(@example)
|
|
116
141
|
end
|
|
117
142
|
end
|
|
118
143
|
```
|
|
119
144
|
|
|
120
|
-
|
|
145
|
+
Finally, add the `<%= render_breadcrumbs %>` helper to your layout.
|
|
146
|
+
|
|
147
|
+
You can wrap the breadcrumbs in an HTML element by using the block form like this:
|
|
148
|
+
|
|
149
|
+
```erb
|
|
150
|
+
<%= render_breadcrumbs do |breadcrumbs| %>
|
|
151
|
+
<%= content_tag(:div, breadcrumbs, class: "container") %>
|
|
152
|
+
<% end %>
|
|
153
|
+
|
|
154
|
+
# =>
|
|
155
|
+
# <div class="container">
|
|
156
|
+
# <ol class="breadcrumb">
|
|
157
|
+
# <li> ... </li>
|
|
158
|
+
# <li class="active"> ... </li>
|
|
159
|
+
# </ol>
|
|
160
|
+
# </div>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
You can also optionally specify which custom view partial you would like to use for rendering the breadcrumbs:
|
|
164
|
+
|
|
165
|
+
```erb
|
|
166
|
+
<%= render_breadcrumbs partial: 'path/to/custom/breadcrumbs' %>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
There are also a few interface methods available for working with the internal breadcrumbs hashes. The following methods are available in controllers and views.
|
|
121
170
|
|
|
122
171
|
```ruby
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# =>
|
|
172
|
+
# Given previously added breadcrumbs:
|
|
173
|
+
|
|
174
|
+
breadcrumbs?
|
|
175
|
+
# => true
|
|
176
|
+
|
|
177
|
+
breadcrumb_names
|
|
178
|
+
# => ["example", "show"]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The following method is available to controllers only.
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
clear_breadcrumbs
|
|
185
|
+
# => nil
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Nav Helper
|
|
189
|
+
|
|
190
|
+
To render the Bootstrap example:
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<ul class="nav nav-tabs">
|
|
194
|
+
<li role="presentation" class="active"><a href="/">Home</a></li>
|
|
195
|
+
<li role="presentation"><a href="/profile">Profile</a></li>
|
|
196
|
+
<li role="presentation"><a href="/messages">Messages</a></li>
|
|
197
|
+
</ul>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
In your views:
|
|
201
|
+
|
|
202
|
+
```erb
|
|
203
|
+
<%= nav do %>
|
|
204
|
+
<%= nav_to('Home', root_path) %>
|
|
205
|
+
<%= nav_to(profile_path) do %>
|
|
206
|
+
Profile
|
|
207
|
+
<% end %>
|
|
208
|
+
<%= nav_to('Messages', controller: users, action: :messages) %>
|
|
209
|
+
<%= nav_to('Forced active state', some_path, active: true) %>
|
|
210
|
+
<% end %>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The `tabs` helper declares that a tab component is being used. Alternatively, the `pills` helper can
|
|
214
|
+
be used in the same manner. Other classes can be specified in the `class` hash argument, the `nav`
|
|
215
|
+
class need not be specified.
|
|
216
|
+
|
|
217
|
+
The `nav_to` helper accepts the same methods that the `link_to` helper accepts, but also
|
|
218
|
+
automatically applies the `active` class to the active link.
|
|
219
|
+
|
|
220
|
+
### Glyph Helper
|
|
221
|
+
|
|
222
|
+
```erb
|
|
223
|
+
<%= glyph(:star) %>
|
|
224
|
+
# => <span class="glyphicon glyphicon-star"></span>
|
|
225
|
+
|
|
226
|
+
<%= glyph(:star, :paperclip) %>
|
|
227
|
+
# => <span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-paperclip"></span>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Badge Helper
|
|
231
|
+
|
|
232
|
+
```erb
|
|
233
|
+
<%= badge(2) %>
|
|
234
|
+
# => <span class="badge">2</span>
|
|
127
235
|
```
|
|
128
236
|
|
|
129
237
|
## Contributing
|