bootstrap-sass-extras 0.0.6 → 0.0.7
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 +4 -4
- data/.travis.yml +7 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +115 -97
- data/README.md +39 -0
- data/Rakefile +11 -1
- data/app/helpers/nav_helper.rb +33 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +2 -2
- data/app/helpers/url_helper.rb +25 -0
- data/lib/bootstrap-sass-extras/engine.rb +2 -0
- data/lib/bootstrap-sass-extras/version.rb +1 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +6 -6
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +6 -6
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +6 -6
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +6 -6
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +6 -6
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +5 -5
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +5 -5
- 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 +7 -7
- data/lib/generators/bootstrap/themed/templates/index.html.haml +6 -6
- data/lib/generators/bootstrap/themed/templates/index.html.slim +6 -6
- 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 +2 -2
- data/lib/generators/bootstrap/themed/templates/show.html.erb +9 -9
- data/lib/generators/bootstrap/themed/templates/show.html.haml +9 -10
- data/lib/generators/bootstrap/themed/templates/show.html.slim +4 -4
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +4 -4
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
- data/spec/dummy/README.rdoc +15 -248
- data/spec/dummy/Rakefile +1 -2
- 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 +3 -36
- 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 +1 -1
- data/spec/helpers/bootstrap_flash_helper_spec.rb +5 -5
- data/spec/helpers/bootstrap_viewport_meta_helper_spec.rb +4 -4
- data/spec/helpers/button_to_helper_spec.rb +19 -0
- data/spec/helpers/glyph_helper_spec.rb +1 -1
- data/spec/helpers/nav_helper_spec.rb +56 -0
- data/spec/helpers/twitter_breadcrumbs_helper_spec.rb +18 -10
- data/spec/spec_helper.rb +1 -1
- metadata +52 -27
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/db/schema.rb +0 -16
- data/spec/dummy/script/rails +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4937b4abaaa8a0e580656bf8b6a64043f5f7b653
|
|
4
|
+
data.tar.gz: b435215d1f1eff03e7a9be230ff6316856c0cf52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f0b443310d60a9e33f20b2eccd8a4b574bc2d6335f0aa2205c2f0070cc0dce9c7a0e5aa283381ed87666900c8892095a38e1f2e39695f944ca2ed804ad1cf81
|
|
7
|
+
data.tar.gz: 01910047148af5c7d284887c8d5532aece5381a46aff058a91b056d6ff42d2581021e4202a9f3b066753b3fce54b6f1fb0970a430307b4dd0a055e97a196a2e0
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Release 0.0.7
|
|
4
|
+
|
|
5
|
+
* Added the ability to specify a custom view path for breadcrumbs [@fredwu][]
|
|
6
|
+
* Put locale arg for String#pluralize in the view templates [@kayhide][]
|
|
7
|
+
* Fix .haml themed template show.html.haml [@mskubenich][]
|
|
8
|
+
* Augment button_to to generate the `btn` Bootstrap class. [@lowjoel][]
|
|
9
|
+
* Given the nav helper, generate the appropriate Bootstrap tabs markup. [@lowjoel][]
|
|
10
|
+
* Allow pills and tabs to be used in the same manner. [@lowjoel][]
|
|
11
|
+
|
|
3
12
|
## Release 0.0.6
|
|
4
13
|
|
|
5
14
|
* Update to bootstrap 3.0
|
|
@@ -29,6 +38,10 @@
|
|
|
29
38
|
* Initial version
|
|
30
39
|
|
|
31
40
|
|
|
41
|
+
[@lowjoel]: https://github.com/lowjoel
|
|
42
|
+
[@mskubenich]: https://github.com/mskubenich
|
|
43
|
+
[@kayhide]: https://github.com/kayhide
|
|
44
|
+
[@fredwu]: https://github.com/fredwu
|
|
32
45
|
[@jonwaghorn]: https://github.com/jonwaghorn
|
|
33
46
|
[@pdobb]: https://github.com/pdobb
|
|
34
47
|
[@dabit]: https://github.com/dabit
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,120 +1,138 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bootstrap-sass-extras (0.0.
|
|
4
|
+
bootstrap-sass-extras (0.0.7)
|
|
5
5
|
rails (>= 3.1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: http://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actionmailer (
|
|
11
|
-
actionpack (=
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
actionmailer (4.2.6)
|
|
11
|
+
actionpack (= 4.2.6)
|
|
12
|
+
actionview (= 4.2.6)
|
|
13
|
+
activejob (= 4.2.6)
|
|
14
|
+
mail (~> 2.5, >= 2.5.4)
|
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
16
|
+
actionpack (4.2.6)
|
|
17
|
+
actionview (= 4.2.6)
|
|
18
|
+
activesupport (= 4.2.6)
|
|
19
|
+
rack (~> 1.6)
|
|
20
|
+
rack-test (~> 0.6.2)
|
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
23
|
+
actionview (4.2.6)
|
|
24
|
+
activesupport (= 4.2.6)
|
|
25
|
+
builder (~> 3.1)
|
|
17
26
|
erubis (~> 2.7.0)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
activemodel (
|
|
24
|
-
activesupport (=
|
|
25
|
-
builder (~> 3.
|
|
26
|
-
activerecord (
|
|
27
|
-
activemodel (=
|
|
28
|
-
activesupport (=
|
|
29
|
-
arel (~>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
debugger-linecache (~> 1.2.0)
|
|
42
|
-
coderay (1.1.0)
|
|
43
|
-
columnize (0.3.6)
|
|
44
|
-
debugger-linecache (1.2.0)
|
|
45
|
-
diff-lcs (1.1.3)
|
|
27
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
29
|
+
activejob (4.2.6)
|
|
30
|
+
activesupport (= 4.2.6)
|
|
31
|
+
globalid (>= 0.3.0)
|
|
32
|
+
activemodel (4.2.6)
|
|
33
|
+
activesupport (= 4.2.6)
|
|
34
|
+
builder (~> 3.1)
|
|
35
|
+
activerecord (4.2.6)
|
|
36
|
+
activemodel (= 4.2.6)
|
|
37
|
+
activesupport (= 4.2.6)
|
|
38
|
+
arel (~> 6.0)
|
|
39
|
+
activesupport (4.2.6)
|
|
40
|
+
i18n (~> 0.7)
|
|
41
|
+
json (~> 1.7, >= 1.7.7)
|
|
42
|
+
minitest (~> 5.1)
|
|
43
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
44
|
+
tzinfo (~> 1.1)
|
|
45
|
+
arel (6.0.3)
|
|
46
|
+
builder (3.2.2)
|
|
47
|
+
coderay (1.1.1)
|
|
48
|
+
concurrent-ruby (1.0.1)
|
|
49
|
+
diff-lcs (1.2.5)
|
|
46
50
|
erubis (2.7.0)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
json (1.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
globalid (0.3.6)
|
|
52
|
+
activesupport (>= 4.1.0)
|
|
53
|
+
i18n (0.7.0)
|
|
54
|
+
json (1.8.3)
|
|
55
|
+
loofah (2.0.3)
|
|
56
|
+
nokogiri (>= 1.5.9)
|
|
57
|
+
mail (2.6.3)
|
|
58
|
+
mime-types (>= 1.16, < 3)
|
|
54
59
|
method_source (0.8.2)
|
|
55
|
-
mime-types (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
mime-types (2.99.1)
|
|
61
|
+
mini_portile2 (2.0.0)
|
|
62
|
+
minitest (5.8.4)
|
|
63
|
+
nokogiri (1.6.7.2)
|
|
64
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
65
|
+
pry (0.10.3)
|
|
66
|
+
coderay (~> 1.1.0)
|
|
67
|
+
method_source (~> 0.8.1)
|
|
61
68
|
slop (~> 3.4)
|
|
62
|
-
rack (1.4
|
|
63
|
-
rack-
|
|
64
|
-
rack (>= 0.4)
|
|
65
|
-
rack-ssl (1.3.3)
|
|
66
|
-
rack
|
|
67
|
-
rack-test (0.6.2)
|
|
69
|
+
rack (1.6.4)
|
|
70
|
+
rack-test (0.6.3)
|
|
68
71
|
rack (>= 1.0)
|
|
69
|
-
rails (
|
|
70
|
-
actionmailer (=
|
|
71
|
-
actionpack (=
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
rails (4.2.6)
|
|
73
|
+
actionmailer (= 4.2.6)
|
|
74
|
+
actionpack (= 4.2.6)
|
|
75
|
+
actionview (= 4.2.6)
|
|
76
|
+
activejob (= 4.2.6)
|
|
77
|
+
activemodel (= 4.2.6)
|
|
78
|
+
activerecord (= 4.2.6)
|
|
79
|
+
activesupport (= 4.2.6)
|
|
80
|
+
bundler (>= 1.3.0, < 2.0)
|
|
81
|
+
railties (= 4.2.6)
|
|
82
|
+
sprockets-rails
|
|
83
|
+
rails-deprecated_sanitizer (1.0.3)
|
|
84
|
+
activesupport (>= 4.2.0.alpha)
|
|
85
|
+
rails-dom-testing (1.0.7)
|
|
86
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
|
87
|
+
nokogiri (~> 1.6.0)
|
|
88
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
|
89
|
+
rails-html-sanitizer (1.0.3)
|
|
90
|
+
loofah (~> 2.0)
|
|
91
|
+
railties (4.2.6)
|
|
92
|
+
actionpack (= 4.2.6)
|
|
93
|
+
activesupport (= 4.2.6)
|
|
81
94
|
rake (>= 0.8.7)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
rspec-
|
|
97
|
-
rspec-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
thor (>= 0.18.1, < 2.0)
|
|
96
|
+
rake (11.1.1)
|
|
97
|
+
rspec-core (3.4.4)
|
|
98
|
+
rspec-support (~> 3.4.0)
|
|
99
|
+
rspec-expectations (3.4.0)
|
|
100
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
101
|
+
rspec-support (~> 3.4.0)
|
|
102
|
+
rspec-mocks (3.4.1)
|
|
103
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
104
|
+
rspec-support (~> 3.4.0)
|
|
105
|
+
rspec-rails (3.4.2)
|
|
106
|
+
actionpack (>= 3.0, < 4.3)
|
|
107
|
+
activesupport (>= 3.0, < 4.3)
|
|
108
|
+
railties (>= 3.0, < 4.3)
|
|
109
|
+
rspec-core (~> 3.4.0)
|
|
110
|
+
rspec-expectations (~> 3.4.0)
|
|
111
|
+
rspec-mocks (~> 3.4.0)
|
|
112
|
+
rspec-support (~> 3.4.0)
|
|
113
|
+
rspec-support (3.4.1)
|
|
114
|
+
slop (3.6.0)
|
|
115
|
+
sprockets (3.5.2)
|
|
116
|
+
concurrent-ruby (~> 1.0)
|
|
117
|
+
rack (> 1, < 3)
|
|
118
|
+
sprockets-rails (3.0.4)
|
|
119
|
+
actionpack (>= 4.0)
|
|
120
|
+
activesupport (>= 4.0)
|
|
121
|
+
sprockets (>= 3.0.0)
|
|
122
|
+
sqlite3 (1.3.11)
|
|
123
|
+
thor (0.19.1)
|
|
124
|
+
thread_safe (0.3.5)
|
|
125
|
+
tzinfo (1.2.2)
|
|
126
|
+
thread_safe (~> 0.1)
|
|
111
127
|
|
|
112
128
|
PLATFORMS
|
|
113
129
|
ruby
|
|
114
130
|
|
|
115
131
|
DEPENDENCIES
|
|
116
132
|
bootstrap-sass-extras!
|
|
117
|
-
byebug
|
|
118
133
|
pry
|
|
119
134
|
rspec-rails
|
|
120
135
|
sqlite3
|
|
136
|
+
|
|
137
|
+
BUNDLED WITH
|
|
138
|
+
1.11.2
|
data/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
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
|
+
|
|
8
10
|
## Note
|
|
9
11
|
|
|
10
12
|
From version 0.0.6, only support bootstrap 3. If you want to use bootstrap 2, please use version 0.0.5.
|
|
@@ -158,6 +160,12 @@ You can wrap the breadcrumbs in an HTML element by using the block form like thi
|
|
|
158
160
|
# </div>
|
|
159
161
|
```
|
|
160
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
|
+
|
|
161
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.
|
|
162
170
|
|
|
163
171
|
```ruby
|
|
@@ -177,6 +185,37 @@ clear_breadcrumbs
|
|
|
177
185
|
# => nil
|
|
178
186
|
```
|
|
179
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
|
+
<% end %>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The `tabs` helper declares that a tab component is being used. Alternatively, the `pills` helper can
|
|
213
|
+
be used in the same manner. Other classes can be specified in the `class` hash argument, the `nav`
|
|
214
|
+
class need not be specified.
|
|
215
|
+
|
|
216
|
+
The `nav_to` helper accepts the same methods that the `link_to` helper accepts, but also
|
|
217
|
+
automatically applies the `active` class to the active link.
|
|
218
|
+
|
|
180
219
|
### Glyph Helper
|
|
181
220
|
|
|
182
221
|
```erb
|
data/Rakefile
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
|
+
|
|
5
|
+
desc "Run all examples"
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
7
|
+
#t.rspec_path = 'bin/rspec'
|
|
8
|
+
t.rspec_opts = %w[--color]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
task :default => [:spec]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module NavHelper
|
|
2
|
+
NAV_CLASS = 'nav'.freeze
|
|
3
|
+
NAV_TABS_CLASS = 'nav-tabs'.freeze
|
|
4
|
+
NAV_PILLS_CLASS = 'nav-pills'.freeze
|
|
5
|
+
NAV_CLASSES = [NAV_TABS_CLASS, NAV_PILLS_CLASS]
|
|
6
|
+
|
|
7
|
+
def nav(options = {}, type = NAV_TABS_CLASS, &block)
|
|
8
|
+
options, type = {}, options unless options.is_a?(Hash)
|
|
9
|
+
options[:class] ||= []
|
|
10
|
+
options[:class] = [*options[:class]]
|
|
11
|
+
options[:class].unshift(NAV_CLASS) unless options[:class].include?(NAV_CLASS)
|
|
12
|
+
options[:class] << type unless NAV_CLASSES.any? { |c| options[:class].include?(c) }
|
|
13
|
+
|
|
14
|
+
content_or_options_with_block = options if block_given?
|
|
15
|
+
content_tag(:ul, content_or_options_with_block, options, &block)
|
|
16
|
+
end
|
|
17
|
+
alias_method(:tabs, :nav)
|
|
18
|
+
|
|
19
|
+
def pills(*args, &block)
|
|
20
|
+
nav(*args, NAV_PILLS_CLASS, &block)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def nav_to(name = nil, options = nil, html_options = nil, &block)
|
|
24
|
+
url_options = block_given? ? name : options
|
|
25
|
+
url_options ||= {}
|
|
26
|
+
|
|
27
|
+
tab_class = current_page?(url_options) ? 'active' : nil
|
|
28
|
+
|
|
29
|
+
content_tag(:li, role: 'presentation', class: tab_class) do
|
|
30
|
+
link_to(name, options, html_options, &block)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module TwitterBreadcrumbsHelper
|
|
2
|
-
def render_breadcrumbs(&block)
|
|
2
|
+
def render_breadcrumbs(options = {}, &block)
|
|
3
3
|
return unless breadcrumbs?
|
|
4
|
-
content = render 'bootstrap_sass_extras/breadcrumbs'
|
|
4
|
+
content = render(options[:partial] || 'bootstrap_sass_extras/breadcrumbs')
|
|
5
5
|
if block_given?
|
|
6
6
|
capture(content, &block)
|
|
7
7
|
else
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module UrlHelper
|
|
2
|
+
BUTTON_CLASSES = ['btn-default', 'btn-primary', 'btn-success', 'btn-info', 'btn-warning',
|
|
3
|
+
'btn-danger', 'btn-link'].freeze
|
|
4
|
+
|
|
5
|
+
def self.included(class_)
|
|
6
|
+
class_.class_eval do
|
|
7
|
+
def button_to(*args, &proc)
|
|
8
|
+
args << nil if args.length < 2
|
|
9
|
+
args << {} if args.length < 3
|
|
10
|
+
button_to_with_bootstrap(*args, &proc)
|
|
11
|
+
super(*args, &proc)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def button_to_with_bootstrap(name = nil, options = nil, html_options = {}, &block)
|
|
17
|
+
html_options[:class] ||= []
|
|
18
|
+
html_options[:class] = [*html_options[:class]]
|
|
19
|
+
|
|
20
|
+
html_options[:class].unshift('btn') unless html_options[:class].include?('btn')
|
|
21
|
+
if html_options[:class].select { |cls| UrlHelper::BUTTON_CLASSES.include?(cls) }.empty?
|
|
22
|
+
html_options[:class] << 'btn-default'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -8,7 +8,9 @@ module BootstrapSassExtras
|
|
|
8
8
|
ActionController::Base.send :helper, GlyphHelper
|
|
9
9
|
ActionController::Base.send :helper, BadgeHelper
|
|
10
10
|
ActionController::Base.send :helper, ModalHelper
|
|
11
|
+
ActionController::Base.send :helper, NavHelper
|
|
11
12
|
ActionController::Base.send :helper, TwitterBreadcrumbsHelper
|
|
13
|
+
ActionController::Base.send :helper, UrlHelper
|
|
12
14
|
ActionController::Base.send :include, BootstrapSassExtras::BreadCrumbs
|
|
13
15
|
end
|
|
14
16
|
end
|