bh 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/CHANGELOG.md +19 -0
  4. data/README.md +51 -18
  5. data/bh.gemspec +13 -9
  6. data/examples/middleman/.gitignore +18 -0
  7. data/examples/middleman/Gemfile +6 -0
  8. data/examples/middleman/config.rb +1 -0
  9. data/examples/middleman/source/index.html.erb +158 -0
  10. data/examples/padrino/Gemfile +9 -0
  11. data/examples/padrino/app/app.rb +16 -0
  12. data/examples/padrino/app/views/index.html.erb +155 -0
  13. data/examples/padrino/config.ru +5 -0
  14. data/examples/padrino/config/apps.rb +5 -0
  15. data/examples/padrino/config/boot.rb +8 -0
  16. data/examples/rails/.gitignore +12 -0
  17. data/examples/rails/Gemfile +5 -0
  18. data/examples/rails/app/controllers/application_controller.rb +6 -0
  19. data/examples/rails/app/controllers/users_controller.rb +2 -0
  20. data/examples/rails/app/models/user.rb +15 -0
  21. data/examples/rails/app/views/application/index.html.erb +160 -0
  22. data/examples/rails/bin/rails +4 -0
  23. data/examples/rails/config.ru +4 -0
  24. data/examples/rails/config/application.rb +12 -0
  25. data/examples/rails/config/boot.rb +3 -0
  26. data/examples/rails/config/environment.rb +5 -0
  27. data/examples/rails/config/environments/development.rb +7 -0
  28. data/examples/rails/config/routes.rb +4 -0
  29. data/examples/rails/config/secrets.yml +22 -0
  30. data/examples/rails/log/.keep +0 -0
  31. data/gemfiles/Gemfile.rails-3.x +2 -0
  32. data/gemfiles/Gemfile.rails-4.x +2 -0
  33. data/lib/bh.rb +15 -4
  34. data/lib/bh/classes/alert_box.rb +35 -0
  35. data/lib/bh/classes/base.rb +125 -0
  36. data/lib/bh/classes/button.rb +58 -0
  37. data/lib/bh/classes/button_to.rb +33 -0
  38. data/lib/bh/classes/cdn.rb +35 -0
  39. data/lib/bh/classes/dropdown.rb +56 -0
  40. data/lib/bh/classes/icon.rb +34 -0
  41. data/lib/bh/classes/link_to.rb +22 -0
  42. data/lib/bh/classes/modal.rb +68 -0
  43. data/lib/bh/classes/nav.rb +37 -0
  44. data/lib/bh/classes/navbar.rb +78 -0
  45. data/lib/bh/classes/panel.rb +72 -0
  46. data/lib/bh/classes/panel_row.rb +13 -0
  47. data/lib/bh/classes/progress_bar.rb +89 -0
  48. data/lib/bh/classes/stack.rb +19 -0
  49. data/lib/bh/classes/vertical.rb +27 -0
  50. data/lib/bh/core_ext/middleman.rb +24 -0
  51. data/lib/bh/core_ext/padrino.rb +25 -0
  52. data/lib/bh/core_ext/rails/base_helper.rb +21 -0
  53. data/lib/bh/{helpers → core_ext/rails}/form/base_helper.rb +3 -1
  54. data/lib/bh/{helpers → core_ext/rails}/form/check_box_helper.rb +1 -1
  55. data/lib/bh/{helpers → core_ext/rails}/form/field_helper.rb +1 -1
  56. data/lib/bh/{helpers → core_ext/rails}/form/fields_for_helper.rb +1 -1
  57. data/lib/bh/{helpers → core_ext/rails}/form/fieldset_helper.rb +1 -1
  58. data/lib/bh/{helpers → core_ext/rails}/form/file_field_helper.rb +1 -1
  59. data/lib/bh/{helpers → core_ext/rails}/form/legend_helper.rb +1 -1
  60. data/lib/bh/{helpers → core_ext/rails}/form/radio_button_helper.rb +1 -1
  61. data/lib/bh/{helpers → core_ext/rails}/form/select_helper.rb +1 -1
  62. data/lib/bh/{helpers → core_ext/rails}/form/static_control_helper.rb +1 -1
  63. data/lib/bh/{helpers → core_ext/rails}/form/submit_helper.rb +1 -1
  64. data/lib/bh/{form_builders → core_ext/rails}/form_builder.rb +11 -10
  65. data/lib/bh/core_ext/rails/form_for_helper.rb +32 -0
  66. data/lib/bh/core_ext/railtie.rb +27 -0
  67. data/lib/bh/helpers/alert_box_helper.rb +40 -0
  68. data/lib/bh/helpers/button_helper.rb +35 -58
  69. data/lib/bh/helpers/button_to_helper.rb +48 -10
  70. data/lib/bh/helpers/cdn_helper.rb +11 -35
  71. data/lib/bh/helpers/dropdown_helper.rb +29 -62
  72. data/lib/bh/helpers/glyphicon_helper.rb +7 -13
  73. data/lib/bh/helpers/horizontal_helper.rb +35 -0
  74. data/lib/bh/helpers/icon_helper.rb +15 -29
  75. data/lib/bh/helpers/link_to_helper.rb +52 -41
  76. data/lib/bh/helpers/modal_helper.rb +49 -79
  77. data/lib/bh/helpers/nav_helper.rb +25 -40
  78. data/lib/bh/helpers/navbar_helper.rb +36 -170
  79. data/lib/bh/helpers/panel_helper.rb +45 -72
  80. data/lib/bh/helpers/panel_row_helper.rb +20 -38
  81. data/lib/bh/helpers/progress_bar_helper.rb +48 -59
  82. data/lib/bh/helpers/vertical_helper.rb +33 -0
  83. data/lib/bh/version.rb +1 -1
  84. data/lib/bh/views/bh/_alert_dismiss_button.html +4 -0
  85. data/lib/bh/views/bh/_dropdown.html.erb +5 -5
  86. data/lib/bh/views/bh/_dropdown_split.html.erb +5 -5
  87. data/lib/bh/views/bh/_modal.html.erb +5 -8
  88. data/lib/bh/views/bh/_navbar.html.erb +5 -0
  89. data/spec/padrino/button_to_helper.rb +35 -0
  90. data/spec/padrino_spec.rb +28 -0
  91. data/spec/rails/button_to_helper.rb +31 -0
  92. data/spec/{helpers → rails}/form/check_box_helper_spec.rb +3 -3
  93. data/spec/{helpers → rails}/form/field_helper_spec.rb +3 -3
  94. data/spec/{helpers → rails}/form/fields_for_helper_spec.rb +3 -3
  95. data/spec/{helpers → rails}/form/fieldset_helper_spec.rb +3 -3
  96. data/spec/{helpers → rails}/form/file_field_helper_spec.rb +3 -3
  97. data/spec/{helpers → rails}/form/legend_helper_spec.rb +3 -3
  98. data/spec/{helpers → rails}/form/radio_button_helper_spec.rb +3 -3
  99. data/spec/{helpers → rails}/form/select_helper_spec.rb +3 -3
  100. data/spec/{helpers → rails}/form/static_control_helper_spec.rb +3 -3
  101. data/spec/{helpers → rails}/form/submit_helper_spec.rb +3 -3
  102. data/spec/{helpers → rails}/form_for_helper_spec.rb +3 -3
  103. data/spec/rails_helper.rb +25 -0
  104. data/spec/rails_spec.rb +28 -0
  105. data/spec/shared/alert_box_helper.rb +62 -0
  106. data/spec/shared/button_helper.rb +52 -0
  107. data/spec/shared/button_to_helper.rb +42 -0
  108. data/spec/shared/cdn_helper.rb +36 -0
  109. data/spec/shared/dropdown_helper.rb +112 -0
  110. data/spec/shared/glyphicon_helper.rb +21 -0
  111. data/spec/shared/horizontal_helper.rb +37 -0
  112. data/spec/shared/icon_helper.rb +31 -0
  113. data/spec/shared/link_to_helper.rb +62 -0
  114. data/spec/shared/modal_helper.rb +104 -0
  115. data/spec/shared/nav_helper.rb +49 -0
  116. data/spec/shared/navbar_helper.rb +63 -0
  117. data/spec/shared/panel_helper.rb +76 -0
  118. data/spec/shared/panel_row_helper.rb +21 -0
  119. data/spec/shared/progress_bar_helper.rb +103 -0
  120. data/spec/shared/vertical_helper.rb +43 -0
  121. data/spec/spec_helper.rb +6 -29
  122. data/spec/support/matchers.rb +38 -0
  123. data/spec/support/padrino.rb +33 -0
  124. data/spec/support/rails.rb +27 -0
  125. metadata +183 -94
  126. data/config.rb +0 -6
  127. data/lib/bh/helpers/alert_helper.rb +0 -77
  128. data/lib/bh/helpers/base_helper.rb +0 -39
  129. data/lib/bh/helpers/form_for_helper.rb +0 -30
  130. data/lib/bh/middleman.rb +0 -39
  131. data/lib/bh/railtie.rb +0 -42
  132. data/spec/dummy/index.html.erb +0 -60
  133. data/spec/dummy/layouts/default.erb +0 -17
  134. data/spec/helpers/alert_helper_spec.rb +0 -84
  135. data/spec/helpers/button_helper_spec.rb +0 -100
  136. data/spec/helpers/button_to_helper_spec.rb +0 -25
  137. data/spec/helpers/cdn_helper_spec.rb +0 -100
  138. data/spec/helpers/dropdown_helper_spec.rb +0 -146
  139. data/spec/helpers/glyphicon_helper_spec.rb +0 -21
  140. data/spec/helpers/icon_helper_spec.rb +0 -45
  141. data/spec/helpers/link_to_helper_spec.rb +0 -124
  142. data/spec/helpers/modal_helper_spec.rb +0 -133
  143. data/spec/helpers/nav_helper_spec.rb +0 -53
  144. data/spec/helpers/navbar_helper_spec.rb +0 -194
  145. data/spec/helpers/panel_helper_spec.rb +0 -95
  146. data/spec/helpers/panel_row_helper_spec.rb +0 -27
  147. data/spec/helpers/progress_bar_helper_spec.rb +0 -114
@@ -1,27 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'spec_helper'
4
- require 'bh/helpers/panel_row_helper'
5
- include Bh::PanelRowHelper
6
-
7
- describe 'panel_row' do
8
- describe 'without a block' do
9
- specify 'shows an empty row' do
10
- expect(panel_row).to include '<div class="row">'
11
- end
12
- end
13
-
14
- describe 'with a block' do
15
- describe 'that does not include panels' do
16
- specify 'shows the content of the block in a row' do
17
- expect(panel_row { 'content' }).to include 'content'
18
- end
19
- end
20
-
21
- describe 'that includes panels and the :column_class option' do
22
- specify 'wraps each panel in a column <div> with the given class' do
23
- expect(panel_row(column_class: 'col-sm-12') { panel body: 'content' }).to include '<div class="col-sm-12">'
24
- end
25
- end
26
- end
27
- end
@@ -1,114 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'spec_helper'
4
- require 'bh/helpers/progress_bar_helper'
5
-
6
- include Bh::ProgressBarHelper
7
-
8
- describe 'progress_bar' do
9
- context 'without options' do
10
- let(:html) { progress_bar }
11
-
12
- it 'displays an empty progress bar' do
13
- expect(html).to include '<div class="progress">'
14
- end
15
- end
16
-
17
- context 'with a hash of options' do
18
- let(:html) { progress_bar options.merge(percentage: 30) }
19
- let(:options) { {} }
20
-
21
- it 'displays one progress bar for the given value' do
22
- expect(html).to include '<div aria-valuemax="100" aria-valuemin="0" aria-valuenow="30" class="progress-bar" role="progressbar" style="width: 30%">'
23
- end
24
-
25
- describe 'given the :label option' do
26
- specify 'is not set, hides the label' do
27
- expect(html).to include '<span class="sr-only">30%</span>'
28
- end
29
-
30
- context 'is set to false, hides the label' do
31
- let(:options) { {label: false }}
32
- it { expect(html).to include '<span class="sr-only">30%</span>' }
33
- end
34
-
35
- context 'is set to true, displays a label matching the percentage' do
36
- let(:options) { {label: true }}
37
- it { expect(html).to include '30%</div>' }
38
- end
39
-
40
- context 'is a string, displays the string as the label' do
41
- let(:options) { {label: "Thirty percent" }}
42
- it { expect(html).to include 'Thirty percent</div>' }
43
- end
44
- end
45
-
46
- describe 'given the :context option' do
47
- specify 'is not set, shows a default bar' do
48
- expect(html).to include 'class="progress-bar"'
49
- end
50
-
51
- context 'is set to :success, shows a "success" bar' do
52
- let(:options) { {context: :success} }
53
- it { expect(html).to include 'class="progress-bar progress-bar-success"' }
54
- end
55
-
56
- context 'is set to :info, shows a "info" bar' do
57
- let(:options) { {context: :info} }
58
- it { expect(html).to include 'class="progress-bar progress-bar-info"' }
59
- end
60
-
61
- context 'is set to :warning, shows a "warning" bar' do
62
- let(:options) { {context: :warning} }
63
- it { expect(html).to include 'class="progress-bar progress-bar-warning"' }
64
- end
65
-
66
- context 'is set to :danger, shows a "danger" bar' do
67
- let(:options) { {context: :danger} }
68
- it { expect(html).to include 'class="progress-bar progress-bar-danger"' }
69
- end
70
- end
71
-
72
- describe 'given the :striped option' do
73
- specify 'is not set, shows a solid color bar' do
74
- expect(html).to include 'class="progress-bar"'
75
- end
76
-
77
- context 'is set to false, shows a solid color bar' do
78
- let(:options) { {striped: false} }
79
- it { expect(html).to include 'class="progress-bar"' }
80
- end
81
-
82
- context 'is set to true, shows a striped color bar' do
83
- let(:options) { {striped: true} }
84
- it { expect(html).to include 'class="progress-bar progress-bar-striped"' }
85
- end
86
- end
87
-
88
- describe 'given the :animated option' do
89
- specify 'is not set, shows a static color bar' do
90
- expect(html).to include 'class="progress-bar"'
91
- end
92
-
93
- context 'is set to false, shows a static color bar' do
94
- let(:options) { {animated: false} }
95
- it { expect(html).to include 'class="progress-bar"' }
96
- end
97
-
98
- context 'is set to true, shows an animated color bar' do
99
- let(:options) { {animated: true} }
100
- it { expect(html).to include 'class="progress-bar progress-bar-striped active"' }
101
- end
102
- end
103
- end
104
-
105
- context 'with an array of options' do
106
- let(:html) { progress_bar [options_bar_1, options_bar_2] }
107
- let(:options_bar_1) { {percentage: 20, context: :success, label: true} }
108
- let(:options_bar_2) { {percentage: 30, animated: true, label: 'Current'} }
109
-
110
- it 'displays a group of stacked progress bars with their options' do
111
- expect(html).to match %r{^<div class="progress"><div.+aria-valuenow="20" class="progress-bar progress-bar-success".+style="width: 20%">20% \(success\)</div>\n<div.+aria-valuenow="30" class="progress-bar progress-bar-striped active".+style="width: 30%">Current</div></div>$}m
112
- end
113
- end
114
- end