twitter-bootstrap-rails 2.2.8 → 4.0.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.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +229 -322
- data/Rakefile +4 -6
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/javascripts/twitter/bootstrap.js +12 -13
- data/app/assets/javascripts/twitter/bootstrap/affix.js +162 -0
- data/app/assets/javascripts/twitter/bootstrap/alert.js +94 -0
- data/app/assets/javascripts/twitter/bootstrap/button.js +120 -0
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +237 -0
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +211 -0
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +165 -0
- data/app/assets/javascripts/twitter/bootstrap/modal.js +337 -0
- data/app/assets/javascripts/twitter/bootstrap/popover.js +108 -0
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +172 -0
- data/app/assets/javascripts/twitter/bootstrap/tab.js +155 -0
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +514 -0
- data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -890
- data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -146
- data/app/helpers/bootstrap_flash_helper.rb +14 -7
- data/app/helpers/form_errors_helper.rb +22 -0
- data/app/helpers/glyph_helper.rb +12 -6
- data/app/helpers/modal_helper.rb +26 -22
- data/app/helpers/navbar_helper.rb +47 -32
- data/app/helpers/twitter_breadcrumbs_helper.rb +6 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +8 -8
- data/lib/generators/bootstrap/install/install_generator.rb +3 -2
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +3 -4
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +9 -18
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +5 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +27 -48
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +19 -34
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +13 -30
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +4 -2
- data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -2
- data/lib/generators/bootstrap/themed/templates/index.html.slim +6 -5
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -7
- data/lib/generators/bootstrap/themed/templates/show.html.haml +4 -4
- data/lib/generators/bootstrap/themed/templates/show.html.slim +6 -7
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
- data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
- data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
- data/lib/twitter/bootstrap/rails/engine.rb +17 -10
- data/lib/twitter/bootstrap/rails/version.rb +2 -2
- data/spec/lib/breadcrumbs_spec.rb +99 -0
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +12 -4
- data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
- data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
- data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +15 -15
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +207 -173
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +18 -16
- data/spec/spec_helper.rb +11 -1
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5796 -1
- data/vendor/static-source/bootstrap.less +0 -1
- data/vendor/static-source/sprites.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/alerts.less +51 -57
- data/vendor/toolkit/twitter/bootstrap/badges.less +66 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +29 -36
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +167 -152
- data/vendor/toolkit/twitter/bootstrap/buttons.less +107 -169
- data/vendor/toolkit/twitter/bootstrap/carousel.less +177 -65
- data/vendor/toolkit/twitter/bootstrap/close.less +21 -19
- data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +15 -4
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +120 -152
- data/vendor/toolkit/twitter/bootstrap/forms.less +470 -547
- data/vendor/toolkit/twitter/bootstrap/glyphicons.less +305 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
- data/vendor/toolkit/twitter/bootstrap/input-groups.less +171 -0
- data/vendor/toolkit/twitter/bootstrap/jumbotron.less +54 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
- data/vendor/toolkit/twitter/bootstrap/list-group.less +130 -0
- data/vendor/toolkit/twitter/bootstrap/media.less +40 -29
- data/vendor/toolkit/twitter/bootstrap/mixins.less +37 -699
- data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +65 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +30 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/reset-text.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +227 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
- data/vendor/toolkit/twitter/bootstrap/navbar.less +547 -384
- data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
- data/vendor/toolkit/twitter/bootstrap/normalize.less +424 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +45 -34
- data/vendor/toolkit/twitter/bootstrap/pagination.less +71 -105
- data/vendor/toolkit/twitter/bootstrap/panels.less +271 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +66 -68
- data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +40 -75
- data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +131 -23
- data/vendor/toolkit/twitter/bootstrap/tables.less +172 -182
- data/vendor/toolkit/twitter/bootstrap/theme.less +291 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +27 -44
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +58 -27
- data/vendor/toolkit/twitter/bootstrap/type.less +209 -154
- data/vendor/toolkit/twitter/bootstrap/utilities.less +32 -7
- data/vendor/toolkit/twitter/bootstrap/variables.less +784 -216
- data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
- metadata +156 -141
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +0 -399
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -169
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -361
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -787
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
- data/test/lib/breadcrumbs_test.rb +0 -75
- data/test/test_helper.rb +0 -11
- data/vendor/static-source/fontawesome.less +0 -9
- data/vendor/toolkit/fontawesome/bootstrap.less +0 -84
- data/vendor/toolkit/fontawesome/core.less +0 -129
- data/vendor/toolkit/fontawesome/extras.less +0 -93
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +0 -1953
- data/vendor/toolkit/fontawesome/font-awesome.less +0 -33
- data/vendor/toolkit/fontawesome/icons.less +0 -381
- data/vendor/toolkit/fontawesome/mixins.less +0 -48
- data/vendor/toolkit/fontawesome/path.less +0 -14
- data/vendor/toolkit/fontawesome/variables.less +0 -735
- data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
- data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
- data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
- data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
- data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
- data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
- data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -10,13 +10,21 @@ include BadgeLabelHelper
|
|
10
10
|
|
11
11
|
describe BadgeLabelHelper, :type => :helper do
|
12
12
|
it "should return a basic bootstrap badge" do
|
13
|
-
badge('
|
13
|
+
expect(badge('New!').gsub(/\s/, '').downcase)
|
14
|
+
.to eql(BASIC_BADGE.gsub(/\s/, '').downcase)
|
14
15
|
end
|
15
16
|
|
16
17
|
it "should return a bootstrap badge with class" do
|
17
|
-
badge('
|
18
|
+
expect(badge('2', :warning).gsub(/\s/, '').downcase)
|
19
|
+
.to eql(BADGE_WITH_CLASS.gsub(/\s/, '').downcase)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should take a Number as its first parameter" do
|
23
|
+
expect(badge(12).gsub(/\s/, '').downcase)
|
24
|
+
.to eql(BADGE_WITH_NUMBER_PARAM.gsub(/\s/, '').downcase)
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
21
|
-
BASIC_BADGE = %{<span class="badge">
|
22
|
-
BADGE_WITH_CLASS = %{<span class="badge badge-warning">
|
28
|
+
BASIC_BADGE = %{<span class="badge">New!</span>}
|
29
|
+
BADGE_WITH_CLASS = %{<span class="badge badge-warning">2</span>}
|
30
|
+
BADGE_WITH_NUMBER_PARAM = %{<span class="badge">12</span>}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'action_view'
|
4
|
+
require 'active_support'
|
5
|
+
require_relative '../../../app/helpers/bootstrap_flash_helper'
|
6
|
+
|
7
|
+
include ActionView::Helpers
|
8
|
+
include ActionView::Context
|
9
|
+
include BootstrapFlashHelper
|
10
|
+
|
11
|
+
describe BootstrapFlashHelper, type: :helper do
|
12
|
+
before do
|
13
|
+
allow(self).to receive(:uri_state) { :inactive }
|
14
|
+
allow(self).to receive(:root_url) { '/' }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "bootstrap_flash" do
|
18
|
+
it "should not return anything without flashes" do
|
19
|
+
allow(self).to receive(:flash) { {} }
|
20
|
+
|
21
|
+
element = bootstrap_flash
|
22
|
+
|
23
|
+
expect(element).to eql("")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should work with a notice" do
|
27
|
+
allow(self).to receive(:flash) { {notice: "Hello"} }
|
28
|
+
|
29
|
+
element = bootstrap_flash
|
30
|
+
|
31
|
+
expect(element).to have_tag(:div,
|
32
|
+
text: "×Hello",
|
33
|
+
with: {class: "alert fade in alert-success"}) {
|
34
|
+
|
35
|
+
with_tag(:button,
|
36
|
+
text: "×",
|
37
|
+
with: {
|
38
|
+
class: "close",
|
39
|
+
"data-dismiss" => "alert"
|
40
|
+
}
|
41
|
+
)
|
42
|
+
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should work with a notice and an extra class" do
|
47
|
+
allow(self).to receive(:flash) { {notice: "Hello"} }
|
48
|
+
|
49
|
+
element = bootstrap_flash(class: "extra-class")
|
50
|
+
|
51
|
+
expect(element).to have_tag(:div,
|
52
|
+
text: "×Hello",
|
53
|
+
with: {class: "alert fade in alert-success extra-class"}) {
|
54
|
+
|
55
|
+
with_tag(:button,
|
56
|
+
text: "×",
|
57
|
+
with: {
|
58
|
+
class: "close",
|
59
|
+
"data-dismiss" => "alert"
|
60
|
+
}
|
61
|
+
)
|
62
|
+
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should work with a notice and an extra class and an extra attribute" do
|
67
|
+
allow(self).to receive(:flash) { {notice: "Hello"} }
|
68
|
+
|
69
|
+
element = bootstrap_flash(class: "extra-class", "data-no-transition-cache" => true)
|
70
|
+
|
71
|
+
expect(element).to have_tag(:div,
|
72
|
+
text: "×Hello",
|
73
|
+
with: {
|
74
|
+
class: "alert fade in alert-success extra-class",
|
75
|
+
"data-no-transition-cache" => true
|
76
|
+
}) {
|
77
|
+
|
78
|
+
with_tag(:button,
|
79
|
+
text: "×",
|
80
|
+
with: {
|
81
|
+
class: "close",
|
82
|
+
"data-dismiss" => "alert"
|
83
|
+
}
|
84
|
+
)
|
85
|
+
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should escape javascript if not marked as safe by user" do
|
90
|
+
allow(self).to receive(:flash) { {notice: "<script>alert(1)</script>"} }
|
91
|
+
|
92
|
+
element = bootstrap_flash
|
93
|
+
|
94
|
+
expect(element).to have_tag(:div,
|
95
|
+
text: "×<script>alert(1)</script>",
|
96
|
+
with: {class: "alert fade in alert-success"}) {
|
97
|
+
with_tag(:button,
|
98
|
+
text: "×",
|
99
|
+
with: {
|
100
|
+
class: "close",
|
101
|
+
"data-dismiss" => "alert"
|
102
|
+
}
|
103
|
+
)
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should not escape a link if marked as safe by user" do
|
108
|
+
allow(self).to receive(:flash) { {notice: "<a href='example.com'>awesome link!</a>".html_safe} }
|
109
|
+
|
110
|
+
element = bootstrap_flash
|
111
|
+
|
112
|
+
expect(element).to have_tag(:div,
|
113
|
+
text: "×awesome link!",
|
114
|
+
with: {class: "alert fade in alert-success"}) { [
|
115
|
+
with_tag(:button,
|
116
|
+
text: "×",
|
117
|
+
with: {
|
118
|
+
class: "close",
|
119
|
+
"data-dismiss" => "alert"
|
120
|
+
}
|
121
|
+
),
|
122
|
+
with_tag(:a,
|
123
|
+
text: 'awesome link!')
|
124
|
+
]
|
125
|
+
}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'action_view'
|
4
|
+
require 'active_support'
|
5
|
+
require 'rspec/active_model/mocks'
|
6
|
+
|
7
|
+
require_relative '../../../app/helpers/form_errors_helper'
|
8
|
+
|
9
|
+
include ActionView::Helpers
|
10
|
+
include ActionView::Context
|
11
|
+
include FormErrorsHelper
|
12
|
+
|
13
|
+
describe FormErrorsHelper, :type => :helper do
|
14
|
+
|
15
|
+
before do
|
16
|
+
@base_errors = ['base error message', 'nasty error']
|
17
|
+
@base_error = 'one base error'
|
18
|
+
|
19
|
+
|
20
|
+
@title_errors = ["can't be blank", 'is too short (minimum is 5 characters)']
|
21
|
+
@title_error = "can't be blank"
|
22
|
+
|
23
|
+
@errors = double('errors')
|
24
|
+
@new_post = mock_model( 'Post' )
|
25
|
+
allow(@new_post).to receive_messages(:errors => @errors)
|
26
|
+
allow(self).to receive_messages(:post_path => '/post/1')
|
27
|
+
allow(self).to receive_messages(:protect_against_forgery? => false)
|
28
|
+
allow(self).to receive_messages(:polymorphic_path => '')
|
29
|
+
|
30
|
+
@default_class = 'help-block'
|
31
|
+
@default_error_class = 'has-error'
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
describe 'error[:base] is a string' do
|
36
|
+
|
37
|
+
before do
|
38
|
+
allow(@errors).to receive(:[]).with(:base).and_return(@base_error)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should render base error on :base key' do
|
42
|
+
form_for(@new_post) do |builder|
|
43
|
+
expect(builder.error_span(:base)).to have_tag("div.#{@default_error_class}") do
|
44
|
+
with_tag("span.#{@default_class}", :text => @base_error)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
describe 'when there is only one error on base' do
|
53
|
+
|
54
|
+
before do
|
55
|
+
allow(@errors).to receive(:[]).with(:base).and_return(@base_error)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should render base error on :base key' do
|
59
|
+
form_for(@new_post) do |builder|
|
60
|
+
expect(builder.error_span(:base)).to have_tag("div.#{@default_error_class}") do
|
61
|
+
with_tag("span.#{@default_class}", :text => @base_error)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'when there is only one error on title' do
|
69
|
+
|
70
|
+
before do
|
71
|
+
allow(@errors).to receive(:[]).with(:title).and_return(@title_error)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should render base errors join with comma' do
|
75
|
+
form_for(@new_post) do |builder|
|
76
|
+
expect(builder.error_span(:title)).to have_tag("div.#{@default_error_class}") do
|
77
|
+
with_tag("span.#{@default_class}", :text => @title_error)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
describe 'when there is more than one error on title' do
|
86
|
+
|
87
|
+
before do
|
88
|
+
allow(@errors).to receive(:[]).with(:title).and_return(@title_errors)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should render base errors join with comma' do
|
92
|
+
form_for(@new_post) do |builder|
|
93
|
+
expect(builder.error_span(:title)).to have_tag("div.#{@default_error_class}") do
|
94
|
+
with_tag("span.#{@default_class}", :text => @title_errors.join(', '))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
describe 'when there are no errors' do
|
102
|
+
before do
|
103
|
+
allow(@errors).to receive(:[]).with(:title).and_return(nil)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should return nil' do
|
107
|
+
form_for(@new_post) do |builder|
|
108
|
+
expect(builder.error_span(:title)).to be_nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe 'when :error_class option is passed' do
|
114
|
+
let(:error_class) { 'has_warning' }
|
115
|
+
|
116
|
+
before do
|
117
|
+
allow(@errors).to receive(:[]).with(:title).and_return(@title_error)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should render with passed error class " do
|
121
|
+
form_for(@new_post) do |builder|
|
122
|
+
expect(builder.error_span(:title, :error_class => error_class))
|
123
|
+
.to have_tag("div.#{error_class}") do
|
124
|
+
with_tag("span.#{@default_class}", :text => @title_error)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'when :error_class option is passed' do
|
131
|
+
let(:span_class) { 'help-inline' }
|
132
|
+
|
133
|
+
before do
|
134
|
+
allow(@errors).to receive(:[]).with(:title).and_return(@title_error)
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should render with passed error class " do
|
138
|
+
form_for(@new_post) do |builder|
|
139
|
+
expect(builder.error_span(:title, :span_class => span_class))
|
140
|
+
.to have_tag("div.#{@default_error_class}") do
|
141
|
+
with_tag("span.#{span_class}", :text => @title_error)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'action_view'
|
4
|
+
require 'active_support'
|
5
|
+
require_relative '../../../app/helpers/glyph_helper'
|
6
|
+
|
7
|
+
include ActionView::Helpers
|
8
|
+
include ActionView::Context
|
9
|
+
include GlyphHelper
|
10
|
+
|
11
|
+
describe GlyphHelper, :type => :helper do
|
12
|
+
it "should return a basic bootstrap glyph" do
|
13
|
+
expect(glyph(:thumbs_up).gsub(/\s/, '').downcase)
|
14
|
+
.to eql(BASIC_GLYPH.gsub(/\s/, '').downcase)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return a bootstrap glyph with span" do
|
18
|
+
expect(glyph(:thumbs_up, {:tag => :span}).gsub(/\s/, '').downcase)
|
19
|
+
.to eql(GLYPH_WITH_SPAN.gsub(/\s/, '').downcase)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
BASIC_GLYPH = %{<iclass=\"glyphiconglyphicon-thumbs-up\"></i>}
|
24
|
+
GLYPH_WITH_SPAN = %{<spanclass=\"glyphiconglyphicon-thumbs-up\"></span>}
|
@@ -11,49 +11,49 @@ describe ModalHelper, :type => :helper do
|
|
11
11
|
header_without_close = { :show_close => false, :title => 'Modal header' }
|
12
12
|
options = { :id => "modal",
|
13
13
|
:header => header_with_close,
|
14
|
-
:body => 'This is the body',
|
15
|
-
:footer => content_tag(:button, 'Save', :class => 'btn')
|
14
|
+
:body => { content: 'This is the body' },
|
15
|
+
:footer => { content: content_tag(:button, 'Save', :class => 'btn') }
|
16
16
|
}
|
17
17
|
|
18
18
|
it 'returns a complete modal' do
|
19
|
-
modal_dialog(options).gsub(/\n/, "").
|
19
|
+
expect(modal_dialog(options).gsub(/\n/, "")).to eql BASIC_MODAL.gsub(/\n/, "")
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns a modal header with a close button if show_close is true' do
|
23
|
-
modal_header(header_with_close).gsub(/\n/, "").
|
23
|
+
expect(modal_header(header_with_close).gsub(/\n/, "")).to eql MODAL_HEADER_WITH_CLOSE.gsub(/\n/, "")
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'renders a modal header without a close button' do
|
27
|
-
|
27
|
+
expect(modal_header(header_without_close).gsub(/\n/, "")).to eql MODAL_HEADER_WITHOUT_CLOSE.gsub(/\n/, "")
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'renders a close button' do
|
31
|
-
close_button('modal').
|
31
|
+
expect(close_button('modal')).to eql "<button class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>"
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'renders a modal toggle button' do
|
35
|
-
|
35
|
+
expect(modal_toggle('Save', :href => "#modal").gsub(/\n/, "")).to eql MODAL_TOGGLE.gsub(/\n/, "")
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
it 'renders a cancel button' do
|
39
|
+
expect(modal_cancel_button("Cancel", :data => {:dismiss => 'modal'}, :href => "#modal").gsub(/\n/, "")).to eql MODAL_CANCEL_BUTTON.gsub(/\n/, "")
|
40
|
+
end
|
42
41
|
end
|
42
|
+
|
43
43
|
BASIC_MODAL = <<-HTML
|
44
|
-
<div class=\"bootstrap-modal modal
|
44
|
+
<div class=\"bootstrap-modal modal fade\" id=\"modal\"><div class=\"modal-dialog \"><div class=\"modal-content\"><div class=\"modal-header\"><button class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button><h4 class=\"modal-title\">Modal header</h4></div><div class=\"modal-body\">This is the body</div><div class=\"modal-footer\"><button class="btn">Save</button></div></div></div></div>
|
45
45
|
HTML
|
46
46
|
|
47
47
|
MODAL_HEADER_WITHOUT_CLOSE = <<-HTML
|
48
|
-
<div class="modal-header"><
|
48
|
+
<div class="modal-header"><h4 class=\"modal-title\">Modal header</h4></div>
|
49
49
|
HTML
|
50
50
|
|
51
51
|
MODAL_HEADER_WITH_CLOSE = <<-HTML
|
52
|
-
<div class="modal-header"><button class="close" data-dismiss="modal">×</button><
|
52
|
+
<div class="modal-header"><button class="close" data-dismiss="modal" aria-hidden=\"true\">×</button><h4 class=\"modal-title\">Modal header</h4></div>
|
53
53
|
HTML
|
54
54
|
|
55
55
|
MODAL_TOGGLE = <<-HTML
|
56
|
-
<a class="btn" data-toggle="modal" href="#modal">Save</a>
|
56
|
+
<a class="btn btn-default" data-toggle="modal" href="#modal">Save</a>
|
57
57
|
HTML
|
58
58
|
|
59
59
|
MODAL_CANCEL_BUTTON = <<-HTML
|
@@ -11,161 +11,232 @@ include NavbarHelper
|
|
11
11
|
|
12
12
|
describe NavbarHelper, :type => :helper do
|
13
13
|
before do
|
14
|
-
self.
|
15
|
-
self.
|
14
|
+
allow(self).to receive(:uri_state) { :inactive }
|
15
|
+
allow(self).to receive(:root_url) { '/' }
|
16
16
|
end
|
17
17
|
describe "nav_bar" do
|
18
18
|
it "should return a basic bootstrap navbar" do
|
19
|
-
nav_bar.gsub(/\s/, '').downcase
|
19
|
+
expect(nav_bar.gsub(/\s/, '').downcase)
|
20
|
+
.to eql(BASIC_NAVBAR.gsub(/\s/, '').downcase)
|
20
21
|
end
|
21
22
|
|
22
23
|
it "should set the fixed position to top" do
|
23
|
-
nav_bar(:fixed => :top).gsub(/\s/, '').downcase
|
24
|
+
expect(nav_bar(:fixed => :top).gsub(/\s/, '').downcase)
|
25
|
+
.to eql(FIXED_TOP_NAVBAR.gsub(/\s/, '').downcase)
|
24
26
|
end
|
25
27
|
|
26
28
|
it "should set the static position to top" do
|
27
|
-
nav_bar(:static => :top).gsub(/\s/, '').downcase
|
29
|
+
expect(nav_bar(:static => :top).gsub(/\s/, '').downcase)
|
30
|
+
.to eql(STATIC_TOP_NAVBAR.gsub(/\s/, '').downcase)
|
28
31
|
end
|
29
32
|
|
30
33
|
it "should set the fixed position to bottom" do
|
31
|
-
nav_bar(:fixed => :bottom).gsub(/\s/, '').downcase
|
34
|
+
expect(nav_bar(:fixed => :bottom).gsub(/\s/, '').downcase)
|
35
|
+
.to eql(FIXED_BOTTOM_NAVBAR.gsub(/\s/, '').downcase)
|
32
36
|
end
|
33
37
|
|
34
38
|
it "should set the style to inverse" do
|
35
|
-
nav_bar(:inverse => true).gsub(/\s/, '').downcase
|
39
|
+
expect(nav_bar(:inverse => true).gsub(/\s/, '').downcase)
|
40
|
+
.to eql(INVERSE_NAVBAR.gsub(/\s/, '').downcase)
|
36
41
|
end
|
37
42
|
|
38
43
|
it "should add the brand name and link it to the home page" do
|
39
|
-
nav_bar(:brand => "Ninety Ten").gsub(/\s/, '').downcase
|
44
|
+
expect(nav_bar(:brand => "Ninety Ten").gsub(/\s/, '').downcase)
|
45
|
+
.to eql(NAVBAR_WITH_BRAND.gsub(/\s/, '').downcase)
|
40
46
|
end
|
41
47
|
|
42
48
|
it "should be able to set the brand link url" do
|
43
|
-
nav_bar(:brand => "Ninety Ten", :brand_link => "http://www.ninetyten.com").gsub(/\s/, '').downcase
|
44
|
-
|
45
|
-
|
46
|
-
it "should set the container to fluid" do
|
47
|
-
nav_bar(:fluid => :true).gsub(/\s/, '').downcase.should eql(BASIC_NAVBAR_FLUID.gsub(/\s/, '').downcase)
|
49
|
+
expect(nav_bar(:brand => "Ninety Ten", :brand_link => "http://www.ninetyten.com").gsub(/\s/, '').downcase)
|
50
|
+
.to eql(NAVBAR_WITH_BRAND_AND_LINK.gsub(/\s/, '').downcase)
|
48
51
|
end
|
49
52
|
|
50
53
|
it "should add the buttons etc for a responsive layout with no block passed" do
|
51
|
-
nav_bar(:responsive => true).gsub(/\s/, '').downcase.
|
54
|
+
expect(nav_bar(:responsive => true).gsub(/\s/, '').downcase).to eql(RESPONSIVE_NAVBAR.gsub(/\s/, '').downcase)
|
52
55
|
end
|
53
56
|
|
54
57
|
it "should add the buttons etc for a responsive layout with block passed" do
|
55
|
-
nav_bar(:responsive => true) do
|
58
|
+
ele = nav_bar(:responsive => true) do
|
56
59
|
"<p>Passing a block</p>".html_safe
|
57
|
-
end
|
60
|
+
end
|
61
|
+
expect(ele.gsub(/\s/, '').downcase).to eql(RESPONSIVE_NAVBAR_WITH_BLOCK.gsub(/\s/, '').downcase)
|
58
62
|
end
|
59
63
|
|
60
64
|
it "should render contained items" do
|
61
|
-
nav_bar do
|
65
|
+
ele = nav_bar do
|
62
66
|
menu_group do
|
63
67
|
menu_item("Home", "/") + menu_item("Products", "/products")
|
64
68
|
end
|
65
|
-
end
|
69
|
+
end
|
70
|
+
expect(ele.gsub(/\s/, '').downcase).to eql(PLAIN_NAVBAR_WITH_ITEM.gsub(/\s/, '').downcase)
|
66
71
|
end
|
67
72
|
|
68
73
|
it "should still render the brand name even with other options turned on" do
|
69
|
-
nav_bar(:brand => "Something") do
|
74
|
+
ele = nav_bar(:brand => "Something") do
|
70
75
|
menu_group do
|
71
76
|
menu_item "Home", "/"
|
72
77
|
end
|
73
|
-
end
|
78
|
+
end
|
79
|
+
expect(ele.gsub(/\s/, '').downcase).to eql(BRANDED_NAVBAR_WITH_ITEM.gsub(/\s/, '').downcase)
|
74
80
|
end
|
75
81
|
end
|
76
82
|
|
77
83
|
describe "menu_group" do
|
78
84
|
it "should return a ul with the class 'nav'" do
|
79
|
-
menu_group do
|
85
|
+
element = menu_group do
|
80
86
|
menu_item("Home", "/") + menu_item("Products", "/products")
|
81
|
-
end
|
87
|
+
end
|
88
|
+
|
89
|
+
expect(element).to have_tag(:ul, with: {class: "nav navbar-nav"}) {
|
90
|
+
with_tag(:li) {
|
91
|
+
with_tag(:a, text: "Home", with: {href: "/"})
|
92
|
+
}
|
93
|
+
with_tag(:li) {
|
94
|
+
with_tag(:a, text: "Products", with: {href: "/products"})
|
95
|
+
}
|
96
|
+
}
|
82
97
|
end
|
83
98
|
|
84
|
-
it "should return a ul with class .
|
85
|
-
menu_group(:
|
99
|
+
it "should return a ul with class .navbar-left when passed the {pull: :left} option" do
|
100
|
+
element = menu_group(pull: :left) do
|
86
101
|
menu_item("Home", "/")
|
87
|
-
end
|
102
|
+
end
|
103
|
+
|
104
|
+
expect(element).to have_tag(:ul, with: {class: "nav navbar-nav navbar-left"}) {
|
105
|
+
with_tag(:li) {
|
106
|
+
with_tag(:a, text: "Home", with: {href: "/"})
|
107
|
+
}
|
108
|
+
}
|
88
109
|
end
|
89
110
|
end
|
90
111
|
|
91
112
|
describe "menu_item" do
|
92
113
|
it "should return a link within an li tag" do
|
93
|
-
self.
|
94
|
-
|
114
|
+
allow(self).to receive(:current_page?) { false }
|
115
|
+
|
116
|
+
element = menu_item("Home", "/")
|
117
|
+
expect(element).to have_tag(:li) {
|
118
|
+
with_tag(:a, text: "Home", with: { href: "/" })
|
119
|
+
}
|
95
120
|
end
|
121
|
+
|
96
122
|
it "should return the link with class 'active' if on current page" do
|
97
|
-
self.
|
98
|
-
|
123
|
+
allow(self).to receive(:uri_state) { :active }
|
124
|
+
|
125
|
+
element = menu_item("Home", "/")
|
126
|
+
expect(element).to have_tag(:li, with: {class: "active"}) {
|
127
|
+
with_tag(:a, text: "Home", with: { href: "/" })
|
128
|
+
}
|
99
129
|
end
|
130
|
+
|
100
131
|
it "should pass any other options through to the link_to method" do
|
101
|
-
self.
|
102
|
-
|
132
|
+
allow(self).to receive_message_chain("uri_state").and_return(:active)
|
133
|
+
|
134
|
+
element = menu_item("Log out", "/users/sign_out", class: "home_link", method: :delete)
|
135
|
+
expect(element).to have_tag(:li, with: {class: "active"}) {
|
136
|
+
with_tag(:a, text: "Log out", with: {
|
137
|
+
href: "/users/sign_out",
|
138
|
+
class: "home_link",
|
139
|
+
rel: "nofollow",
|
140
|
+
"data-method" => "delete"
|
141
|
+
})
|
142
|
+
}
|
103
143
|
end
|
144
|
+
|
104
145
|
it "should pass a block but no name if a block is present" do
|
105
|
-
self.
|
106
|
-
|
146
|
+
allow(self).to receive(:current_page?) { false }
|
147
|
+
|
148
|
+
element = menu_item("/"){ content_tag("i", "", :class => "icon-home") + " Home" }
|
149
|
+
expect(element).to have_tag(:li) {
|
150
|
+
with_tag(:i, with: { class: "icon-home"})
|
151
|
+
with_tag(:a, text: " Home", with: { href: "/"})
|
152
|
+
}
|
107
153
|
end
|
154
|
+
|
108
155
|
it "should work with just a block" do
|
109
|
-
self.
|
110
|
-
|
156
|
+
allow(self).to receive(:current_page?) { false }
|
157
|
+
|
158
|
+
element = menu_item{ content_tag("i", "", :class => "icon-home") + " Home" }
|
159
|
+
expect(element).to have_tag(:li) {
|
160
|
+
with_tag(:i, with: { class: "icon-home"})
|
161
|
+
with_tag(:a, text: " Home", with: { href: "#"})
|
162
|
+
}
|
111
163
|
end
|
164
|
+
|
112
165
|
it "should return the link with class 'active' if on current page with a block" do
|
113
|
-
self.
|
114
|
-
|
166
|
+
allow(self).to receive(:uri_state) { :active }
|
167
|
+
|
168
|
+
element = menu_item("/"){ content_tag("i", "", :class => "icon-home") + " Home" }
|
169
|
+
expect(element).to have_tag(:li, with: {class: "active"}) {
|
170
|
+
with_tag(:i, with: { class: "icon-home"})
|
171
|
+
with_tag(:a, text: " Home", with: { href: "/"})
|
172
|
+
}
|
115
173
|
end
|
116
174
|
end
|
117
175
|
|
118
176
|
describe "drop_down" do
|
119
177
|
it "should do render the proper drop down code" do
|
120
|
-
drop_down "Products" do
|
178
|
+
ele = drop_down "Products" do
|
121
179
|
menu_item "Latest", "/"
|
122
|
-
end
|
180
|
+
end
|
181
|
+
expect(ele).to have_tag(:li, with: {class: 'dropdown'})
|
182
|
+
expect(ele).to have_tag(:a, with: {class: 'dropdown-toggle'})
|
123
183
|
end
|
124
184
|
end
|
125
185
|
|
126
186
|
describe "drop_down_with_submenu" do
|
127
187
|
it "should do render the proper drop down code" do
|
128
|
-
drop_down_with_submenu "Products" do
|
129
|
-
|
130
|
-
|
188
|
+
ele = drop_down_with_submenu "Products" do
|
189
|
+
drop_down_submenu "Latest" do
|
190
|
+
menu_item "Option1", "/"
|
191
|
+
end
|
131
192
|
end
|
132
|
-
|
193
|
+
expect(ele).to have_tag(:li, with: {class: 'dropdown'})
|
194
|
+
expect(ele).to have_tag(:a, with: {class: 'dropdown-toggle'})
|
195
|
+
expect(ele).to have_tag(:ul, with: {class: 'dropdown-menu'})
|
133
196
|
end
|
134
197
|
end
|
135
198
|
|
136
199
|
describe "menu_divider" do
|
137
200
|
it "should render <li class='divider-vertical'></li>" do
|
138
|
-
menu_divider.
|
201
|
+
expect(menu_divider).to match '<li class="divider-vertical"></li>'
|
139
202
|
end
|
140
203
|
end
|
141
204
|
|
142
205
|
describe "menu_text" do
|
143
206
|
it "should render text within p tags with class 'navbar-text" do
|
144
|
-
menu_text("Strapline!").
|
207
|
+
expect(menu_text("Strapline!")).to match("<p class=\"navbar-text\">Strapline!</p>")
|
145
208
|
end
|
146
209
|
|
147
210
|
it "should be able to be pulled right or left" do
|
148
|
-
menu_text("I am being pulled right", :pull => :right).
|
211
|
+
expect(menu_text("I am being pulled right", :pull => :right)).to match("<p class=\"pull-right navbar-text\">I am being pulled right</p>")
|
149
212
|
end
|
150
213
|
|
151
214
|
it "should be able to cope with arbitrary options being passed to the p tag" do
|
152
|
-
menu_text("I am classy!", :class => "classy", :id => "classy_text").
|
215
|
+
expect(menu_text("I am classy!", :class => "classy", :id => "classy_text")).to match("<p class=\"classy navbar-text\" id=\"classy_text\">I am classy!</p>")
|
153
216
|
end
|
154
217
|
|
155
218
|
it "should be able to cope with a block too" do
|
156
|
-
menu_text
|
157
|
-
|
158
|
-
|
219
|
+
ele = menu_text("I have been rendered programmatically!")
|
220
|
+
expect(ele).to have_tag(:p, with: {class: "navbar-text"})
|
221
|
+
expect(ele).to match "I have been rendered programmatically!"
|
159
222
|
end
|
160
223
|
end
|
161
224
|
|
162
225
|
describe "rendering forms ok" do
|
163
226
|
it "should not escape anything unexpectedly" do
|
164
|
-
|
165
|
-
|
166
|
-
|
227
|
+
expect(
|
228
|
+
nav_bar do
|
229
|
+
form_tag "/", :method => 'get' do |f|
|
230
|
+
f.text_field :search, "stub"
|
231
|
+
end
|
167
232
|
end
|
168
|
-
|
233
|
+
).to have_tag(:form)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "default navbar" do
|
238
|
+
it "renders a navbar" do
|
239
|
+
expect(nav_bar { 'foo' }).to have_tag(:nav, with: { class: 'navbar navbar-default', role: 'navigation' }, text: /foo/)
|
169
240
|
end
|
170
241
|
end
|
171
242
|
|
@@ -174,167 +245,132 @@ end
|
|
174
245
|
# HTML output
|
175
246
|
|
176
247
|
BASIC_NAVBAR = <<-HTML
|
177
|
-
<
|
178
|
-
<div class="
|
179
|
-
<div class="container">
|
180
|
-
</div>
|
248
|
+
<nav class="navbar navbar-default" role="navigation">
|
249
|
+
<div class="container">
|
181
250
|
</div>
|
182
|
-
</
|
251
|
+
</nav>
|
183
252
|
HTML
|
184
253
|
|
185
254
|
FIXED_TOP_NAVBAR = <<-HTML
|
186
|
-
<
|
187
|
-
<div class="
|
188
|
-
<div class="container">
|
189
|
-
</div>
|
255
|
+
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
256
|
+
<div class="container">
|
190
257
|
</div>
|
191
|
-
</
|
258
|
+
</nav>
|
192
259
|
HTML
|
193
260
|
|
194
261
|
STATIC_TOP_NAVBAR = <<-HTML
|
195
|
-
<
|
196
|
-
<div class="
|
197
|
-
<div class="container">
|
198
|
-
</div>
|
262
|
+
<nav class="navbar navbar-default navbar-static-top" role="navigation">
|
263
|
+
<div class="container">
|
199
264
|
</div>
|
200
|
-
</
|
265
|
+
</nav>
|
201
266
|
HTML
|
202
267
|
|
203
268
|
FIXED_BOTTOM_NAVBAR = <<-HTML
|
204
|
-
<
|
205
|
-
<div class="
|
206
|
-
<div class="container">
|
207
|
-
</div>
|
269
|
+
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
|
270
|
+
<div class="container">
|
208
271
|
</div>
|
209
|
-
</
|
272
|
+
</nav>
|
210
273
|
HTML
|
211
274
|
|
212
275
|
INVERSE_NAVBAR = <<-HTML
|
213
|
-
<
|
214
|
-
<div class="
|
215
|
-
<div class="container">
|
216
|
-
</div>
|
217
|
-
</div>
|
218
|
-
</div>
|
219
|
-
HTML
|
220
|
-
|
221
|
-
BASIC_NAVBAR_FLUID= <<-HTML
|
222
|
-
<div class="navbar">
|
223
|
-
<div class="navbar-inner">
|
224
|
-
<div class="container-fluid">
|
225
|
-
</div>
|
276
|
+
<nav class="navbar navbar-default navbar-inverse" role="navigation">
|
277
|
+
<div class="container">
|
226
278
|
</div>
|
227
|
-
</
|
279
|
+
</nav>
|
228
280
|
HTML
|
229
281
|
|
230
282
|
NAVBAR_WITH_BRAND = <<-HTML
|
231
|
-
<
|
232
|
-
<div class="
|
233
|
-
<
|
234
|
-
|
235
|
-
|
236
|
-
</a>
|
237
|
-
</div>
|
283
|
+
<nav class="navbar navbar-default" role="navigation">
|
284
|
+
<div class="container">
|
285
|
+
<a class="navbar-brand" href="/">
|
286
|
+
Ninety Ten
|
287
|
+
</a>
|
238
288
|
</div>
|
239
|
-
</
|
289
|
+
</nav>
|
240
290
|
HTML
|
241
291
|
|
242
292
|
NAVBAR_WITH_BRAND_AND_LINK = <<-HTML
|
243
|
-
<
|
244
|
-
<div class="
|
245
|
-
<
|
246
|
-
|
247
|
-
|
248
|
-
</a>
|
249
|
-
</div>
|
293
|
+
<nav class="navbar navbar-default" role="navigation">
|
294
|
+
<div class="container">
|
295
|
+
<a class="navbar-brand" href="http://www.ninetyten.com">
|
296
|
+
Ninety Ten
|
297
|
+
</a>
|
250
298
|
</div>
|
251
|
-
</
|
299
|
+
</nav>
|
252
300
|
HTML
|
253
301
|
|
254
302
|
RESPONSIVE_NAVBAR = <<-HTML
|
255
|
-
<
|
256
|
-
<div class="
|
257
|
-
<div class="
|
258
|
-
<
|
303
|
+
<nav class="navbar navbar-default" role="navigation">
|
304
|
+
<div class="container">
|
305
|
+
<div class="navbar-header">
|
306
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
307
|
+
<span class="sr-only">Toggle Navigation</span>
|
259
308
|
<span class="icon-bar"></span>
|
260
309
|
<span class="icon-bar"></span>
|
261
310
|
<span class="icon-bar"></span>
|
262
|
-
</
|
263
|
-
|
264
|
-
|
311
|
+
</button>
|
312
|
+
</div>
|
313
|
+
<div class="navbar-collapse collapse">
|
265
314
|
</div>
|
266
315
|
</div>
|
267
|
-
</
|
316
|
+
</nav>
|
268
317
|
HTML
|
269
318
|
|
270
319
|
RESPONSIVE_NAVBAR_WITH_BLOCK = <<-HTML
|
271
|
-
<
|
272
|
-
<div class="
|
273
|
-
<div class="
|
274
|
-
<
|
320
|
+
<nav class="navbar navbar-default" role="navigation">
|
321
|
+
<div class="container">
|
322
|
+
<div class="navbar-header">
|
323
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
324
|
+
<span class="sr-only">Toggle Navigation</span>
|
275
325
|
<span class="icon-bar"></span>
|
276
326
|
<span class="icon-bar"></span>
|
277
327
|
<span class="icon-bar"></span>
|
278
|
-
</
|
279
|
-
|
280
|
-
|
281
|
-
|
328
|
+
</button>
|
329
|
+
</div>
|
330
|
+
<div class="navbar-collapse collapse">
|
331
|
+
<p>Passing a block</p>
|
282
332
|
</div>
|
283
333
|
</div>
|
284
|
-
</
|
334
|
+
</nav>
|
285
335
|
HTML
|
286
336
|
|
287
337
|
PLAIN_NAVBAR_WITH_ITEM = <<-HTML
|
288
|
-
<
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
</div>
|
301
|
-
</div>
|
338
|
+
<nav class="navbar navbar-default" role="navigation">
|
339
|
+
<div class="container">
|
340
|
+
<ul class="nav navbar-nav">
|
341
|
+
<li>
|
342
|
+
<a href="/">Home</a>
|
343
|
+
</li>
|
344
|
+
<li>
|
345
|
+
<a href="/products">Products</a>
|
346
|
+
</li>
|
347
|
+
</ul>
|
348
|
+
</div>
|
349
|
+
</nav>
|
302
350
|
HTML
|
303
351
|
|
304
352
|
BRANDED_NAVBAR_WITH_ITEM = <<-HTML
|
305
|
-
<
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
</div>
|
318
|
-
</div>
|
353
|
+
<nav class="navbar navbar-default" role="navigation">
|
354
|
+
<div class="container">
|
355
|
+
<a class="navbar-brand" href="/">
|
356
|
+
Something
|
357
|
+
</a>
|
358
|
+
<ul class="nav navbar-nav">
|
359
|
+
<li>
|
360
|
+
<a href="/">Home</a>
|
361
|
+
</li>
|
362
|
+
</ul>
|
363
|
+
</div>
|
364
|
+
</nav>
|
319
365
|
HTML
|
320
366
|
|
321
367
|
DROPDOWN_MENU = <<-HTML
|
322
|
-
<li class="dropdown">
|
323
|
-
<a href="#"
|
324
|
-
class="dropdown-toggle"
|
325
|
-
data-toggle="dropdown">
|
326
|
-
Products
|
327
|
-
<b class="caret"></b>
|
328
|
-
</a>
|
329
|
-
<ul class="dropdown-menu">
|
330
|
-
<li><a href="/">Latest</a></li>
|
331
|
-
</ul>
|
332
|
-
</li>
|
368
|
+
<li class="dropdown"> <a class="dropdown-toggle"data-toggle="dropdown"href="#"> Products <b class="caret"></b> </a> <ul class="dropdown-menu"> <li><a href="/">Latest</a></li> </ul> </li>
|
333
369
|
HTML
|
334
370
|
|
335
371
|
DROPDOWN_MENU_WITH_SUBMENU = <<-HTML
|
336
372
|
<li class="dropdown">
|
337
|
-
<a
|
373
|
+
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Products <b class="caret"></b></a>
|
338
374
|
<ul class="dropdown-menu">
|
339
375
|
<li class="dropdown-submenu">
|
340
376
|
<a href="">Latest</a>
|
@@ -347,16 +383,14 @@ DROPDOWN_MENU_WITH_SUBMENU = <<-HTML
|
|
347
383
|
HTML
|
348
384
|
|
349
385
|
PLAIN_NAVBAR_WITH_FORM = <<-HTML
|
350
|
-
<
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
</div>
|
361
|
-
</div>
|
386
|
+
<nav class=\"navbar navbar-default\"role=\"navigation\">
|
387
|
+
<div class=\"container\">
|
388
|
+
<form accept-charset=\"utf-8\" action=\"/\" method=\"get\">
|
389
|
+
<div style=\"display:none\">
|
390
|
+
<input name=\"utf8\" type=\"hidden\" value=\"✓\"/>
|
391
|
+
</div>
|
392
|
+
<input id=\"search_stub\" name=\"search[stub]\" type=\"text\"/>
|
393
|
+
</form>
|
394
|
+
</div>
|
395
|
+
</nav>
|
362
396
|
HTML
|