twitter-bootstrap-rails 2.2.8 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +229 -322
  3. data/Rakefile +4 -6
  4. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  5. data/app/assets/fonts/glyphicons-halflings-regular.svg +288 -0
  6. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  7. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  8. data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  9. data/app/assets/javascripts/twitter/bootstrap.js +12 -13
  10. data/app/assets/javascripts/twitter/bootstrap/affix.js +162 -0
  11. data/app/assets/javascripts/twitter/bootstrap/alert.js +94 -0
  12. data/app/assets/javascripts/twitter/bootstrap/button.js +120 -0
  13. data/app/assets/javascripts/twitter/bootstrap/carousel.js +237 -0
  14. data/app/assets/javascripts/twitter/bootstrap/collapse.js +211 -0
  15. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +165 -0
  16. data/app/assets/javascripts/twitter/bootstrap/modal.js +337 -0
  17. data/app/assets/javascripts/twitter/bootstrap/popover.js +108 -0
  18. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +172 -0
  19. data/app/assets/javascripts/twitter/bootstrap/tab.js +155 -0
  20. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +514 -0
  21. data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
  22. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -890
  23. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -146
  24. data/app/helpers/bootstrap_flash_helper.rb +14 -7
  25. data/app/helpers/form_errors_helper.rb +22 -0
  26. data/app/helpers/glyph_helper.rb +12 -6
  27. data/app/helpers/modal_helper.rb +26 -22
  28. data/app/helpers/navbar_helper.rb +47 -32
  29. data/app/helpers/twitter_breadcrumbs_helper.rb +6 -2
  30. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +8 -8
  31. data/lib/generators/bootstrap/install/install_generator.rb +3 -2
  32. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +3 -4
  33. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +9 -18
  34. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +5 -0
  35. data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
  36. data/lib/generators/bootstrap/layout/templates/layout.html.erb +27 -48
  37. data/lib/generators/bootstrap/layout/templates/layout.html.haml +19 -34
  38. data/lib/generators/bootstrap/layout/templates/layout.html.slim +13 -30
  39. data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
  40. data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
  41. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
  42. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
  43. data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
  44. data/lib/generators/bootstrap/themed/templates/index.html.erb +4 -2
  45. data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -2
  46. data/lib/generators/bootstrap/themed/templates/index.html.slim +6 -5
  47. data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
  48. data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -7
  49. data/lib/generators/bootstrap/themed/templates/show.html.haml +4 -4
  50. data/lib/generators/bootstrap/themed/templates/show.html.slim +6 -7
  51. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
  52. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
  53. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
  54. data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
  55. data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
  56. data/lib/twitter/bootstrap/rails/engine.rb +17 -10
  57. data/lib/twitter/bootstrap/rails/version.rb +2 -2
  58. data/spec/lib/breadcrumbs_spec.rb +99 -0
  59. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +12 -4
  60. data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
  61. data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
  62. data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
  63. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +15 -15
  64. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +207 -173
  65. data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +18 -16
  66. data/spec/spec_helper.rb +11 -1
  67. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5796 -1
  68. data/vendor/static-source/bootstrap.less +0 -1
  69. data/vendor/static-source/sprites.less +1 -1
  70. data/vendor/toolkit/twitter/bootstrap/alerts.less +51 -57
  71. data/vendor/toolkit/twitter/bootstrap/badges.less +66 -0
  72. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +29 -36
  73. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
  74. data/vendor/toolkit/twitter/bootstrap/button-groups.less +167 -152
  75. data/vendor/toolkit/twitter/bootstrap/buttons.less +107 -169
  76. data/vendor/toolkit/twitter/bootstrap/carousel.less +177 -65
  77. data/vendor/toolkit/twitter/bootstrap/close.less +21 -19
  78. data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
  79. data/vendor/toolkit/twitter/bootstrap/component-animations.less +15 -4
  80. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +120 -152
  81. data/vendor/toolkit/twitter/bootstrap/forms.less +470 -547
  82. data/vendor/toolkit/twitter/bootstrap/glyphicons.less +305 -0
  83. data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
  84. data/vendor/toolkit/twitter/bootstrap/input-groups.less +171 -0
  85. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +54 -0
  86. data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
  87. data/vendor/toolkit/twitter/bootstrap/list-group.less +130 -0
  88. data/vendor/toolkit/twitter/bootstrap/media.less +40 -29
  89. data/vendor/toolkit/twitter/bootstrap/mixins.less +37 -699
  90. data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
  91. data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +9 -0
  92. data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
  93. data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +65 -0
  94. data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
  95. data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
  96. data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
  97. data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
  98. data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
  99. data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
  100. data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
  101. data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
  102. data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
  103. data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +30 -0
  104. data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
  105. data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
  106. data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
  107. data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +24 -0
  108. data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
  109. data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
  110. data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
  111. data/vendor/toolkit/twitter/bootstrap/mixins/reset-text.less +18 -0
  112. data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
  113. data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
  114. data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
  115. data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
  116. data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
  117. data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +9 -0
  118. data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
  119. data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +227 -0
  120. data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
  121. data/vendor/toolkit/twitter/bootstrap/navbar.less +547 -384
  122. data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
  123. data/vendor/toolkit/twitter/bootstrap/normalize.less +424 -0
  124. data/vendor/toolkit/twitter/bootstrap/pager.less +45 -34
  125. data/vendor/toolkit/twitter/bootstrap/pagination.less +71 -105
  126. data/vendor/toolkit/twitter/bootstrap/panels.less +271 -0
  127. data/vendor/toolkit/twitter/bootstrap/popovers.less +66 -68
  128. data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
  129. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +40 -75
  130. data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +35 -0
  131. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
  132. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +131 -23
  133. data/vendor/toolkit/twitter/bootstrap/tables.less +172 -182
  134. data/vendor/toolkit/twitter/bootstrap/theme.less +291 -0
  135. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +27 -44
  136. data/vendor/toolkit/twitter/bootstrap/tooltip.less +58 -27
  137. data/vendor/toolkit/twitter/bootstrap/type.less +209 -154
  138. data/vendor/toolkit/twitter/bootstrap/utilities.less +32 -7
  139. data/vendor/toolkit/twitter/bootstrap/variables.less +784 -216
  140. data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
  141. metadata +156 -141
  142. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  143. data/app/assets/fonts/fontawesome-webfont.svg +0 -399
  144. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  145. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  146. data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  147. data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  148. data/app/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
  149. data/app/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
  150. data/app/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
  151. data/app/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
  152. data/app/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
  153. data/app/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -169
  154. data/app/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
  155. data/app/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
  156. data/app/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
  157. data/app/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
  158. data/app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -361
  159. data/app/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
  160. data/app/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
  161. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -787
  162. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
  163. data/test/lib/breadcrumbs_test.rb +0 -75
  164. data/test/test_helper.rb +0 -11
  165. data/vendor/static-source/fontawesome.less +0 -9
  166. data/vendor/toolkit/fontawesome/bootstrap.less +0 -84
  167. data/vendor/toolkit/fontawesome/core.less +0 -129
  168. data/vendor/toolkit/fontawesome/extras.less +0 -93
  169. data/vendor/toolkit/fontawesome/font-awesome-ie7.less +0 -1953
  170. data/vendor/toolkit/fontawesome/font-awesome.less +0 -33
  171. data/vendor/toolkit/fontawesome/icons.less +0 -381
  172. data/vendor/toolkit/fontawesome/mixins.less +0 -48
  173. data/vendor/toolkit/fontawesome/path.less +0 -14
  174. data/vendor/toolkit/fontawesome/variables.less +0 -735
  175. data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
  176. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
  177. data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
  178. data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
  179. data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
  180. data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
  181. data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
  182. data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
  183. data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
  184. data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
  185. data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -1,10 +1,12 @@
1
- = form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f|
1
+ = form_for @<%= resource_name %>, html: { class: "form form-horizontal <%= resource_name %>" } do |f|
2
2
  <%- columns.each do |column| -%>
3
- .control-group
4
- = f.label :<%= column.name %>, :class => 'control-label'
5
- .controls
6
- = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
3
+ .form-group
4
+ = f.label :<%= column.name %>, class: 'control-label col-lg-2'
5
+ .col-lg-10
6
+ = f.<%= column.field_type %> :<%= column.name %>, class: 'form-control', required: true
7
+ = f.error_span(:<%= column.name %>)
7
8
  <%- end -%>
8
- .form-actions
9
- = f.submit nil, :class => 'btn btn-primary'
10
- = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
9
+ .form-group
10
+ .col-lg-offset-2.col-lg-10
11
+ = f.submit nil,class: 'btn btn-primary'
12
+ = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
@@ -1,11 +1,13 @@
1
- = form_for @<%= resource_name %>, :html => { :class => "form-horizontal" } do |f|
1
+ = form_for @<%= resource_name %>, html: { class: "form form-horizontal <%= resource_name %>" } do |f|
2
2
  <%- columns.each do |column| -%>
3
- .control-group
4
- = f.label :<%= column.name %>, :class => 'control-label'
5
- .controls
6
- = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
3
+ .form-group
4
+ = f.label :<%= column.name %>, :class => 'control-label col-lg-2'
5
+ .col-lg-10
6
+ = f.<%= column.field_type %> :<%= column.name %>, :class => 'form-control'
7
+ = f.error_span(:<%= column.name %>)
7
8
  <%- end -%>
8
- .form-actions
9
- = f.submit nil, :class => 'btn btn-primary'
10
- '
11
- = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
9
+ .form-group
10
+ .col-lg-offset-2.col-lg-10
11
+ = f.submit nil, :class => 'btn btn-primary'
12
+ '
13
+ = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
- div class="page-header"
2
+ .page-header
3
3
  h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -22,13 +22,15 @@
22
22
  <%- end -%>
23
23
  <td><%%=l <%= resource_name %>.created_at %></td>
24
24
  <td>
25
+ <%%= link_to t('.show', :default => t("helpers.links.show")),
26
+ <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs' %>
25
27
  <%%= link_to t('.edit', :default => t("helpers.links.edit")),
26
- edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini' %>
28
+ edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs' %>
27
29
  <%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
28
30
  <%= singular_controller_routing_path %>_path(<%= resource_name %>),
29
31
  :method => :delete,
30
32
  :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
31
- :class => 'btn btn-mini btn-danger' %>
33
+ :class => 'btn btn-xs btn-danger' %>
32
34
  </td>
33
35
  </tr>
34
36
  <%% end %>
@@ -19,7 +19,8 @@
19
19
  <%- end -%>
20
20
  %td=l <%= resource_name %>.created_at
21
21
  %td
22
- = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
23
- = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-mini btn-danger'
22
+ = link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs'
23
+ = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs'
24
+ = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-xs btn-danger'
24
25
 
25
26
  = link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
@@ -1,7 +1,7 @@
1
1
  - model_class = <%= resource_name.classify %>
2
- div class="page-header"
2
+ .page-header
3
3
  h1=t '.title', :default => model_class.model_name.human.pluralize.titleize
4
- table class="table table-striped"
4
+ table.table.table-striped
5
5
  thead
6
6
  tr
7
7
  th= model_class.human_attribute_name(:id)
@@ -19,9 +19,10 @@ table class="table table-striped"
19
19
  <%- end -%>
20
20
  td=l <%= resource_name %>.created_at
21
21
  td
22
- = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
22
+ = link_to t('.show', :default => t("helpers.links.show")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs'
23
23
  '
24
- = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-mini btn-danger'
24
+ = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-default btn-xs'
25
+ '
26
+ = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-xs btn-danger'
25
27
 
26
28
  = link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
27
-
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
- div class="page-header"
2
+ .page-header
3
3
  h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -10,14 +10,12 @@
10
10
  <%- end -%>
11
11
  </dl>
12
12
 
13
- <div class="form-actions">
14
- <%%= link_to t('.back', :default => t("helpers.links.back")),
15
- <%= controller_routing_path %>_path, :class => 'btn' %>
16
- <%%= link_to t('.edit', :default => t("helpers.links.edit")),
17
- edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn' %>
18
- <%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
13
+ <%%= link_to t('.back', :default => t("helpers.links.back")),
14
+ <%= controller_routing_path %>_path, :class => 'btn btn-default' %>
15
+ <%%= link_to t('.edit', :default => t("helpers.links.edit")),
16
+ edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-default' %>
17
+ <%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
19
18
  <%= singular_controller_routing_path %>_path(@<%= resource_name %>),
20
19
  :method => 'delete',
21
20
  :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
22
21
  :class => 'btn btn-danger' %>
23
- </div>
@@ -9,7 +9,7 @@
9
9
  = @<%= resource_name %>.<%= column.name %>
10
10
  <%- end -%>
11
11
 
12
- .form-actions
13
- = link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn'
14
- = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
15
- = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
12
+
13
+ = link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
14
+ = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-default'
15
+ = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
@@ -1,5 +1,5 @@
1
1
  - model_class = <%= resource_name.classify %>
2
- div class="page-header"
2
+ .page-header
3
3
  h1=t '.title', :default => model_class.model_name.human.titleize
4
4
 
5
5
  <%- columns.each do |column| -%>
@@ -9,9 +9,8 @@ p
9
9
  = @<%= resource_name %>.<%= column.name %>
10
10
  <%- end -%>
11
11
 
12
- .form-actions
13
- = link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn'
14
- '
15
- = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
16
- '
17
- = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
12
+ = link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
13
+ '
14
+ = link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn btn-default'
15
+ '
16
+ = link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
@@ -1,14 +1,14 @@
1
1
  <%%= simple_form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f| %>
2
2
  <%- columns.each do |column| -%>
3
3
  <%%= f.input :<%= column.name %> %>
4
+ <%%= error_span(@<%= resource_name %>[:<%= column.name %>]) %>
4
5
  <%- end -%>
5
6
  <%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
6
7
  <%%= f.button :wrapped, :cancel => <%= controller_routing_path %>_path %>
7
8
  <%- else -%>
8
- <div class="form-actions">
9
- <%%= f.button :submit, :class => 'btn-primary' %>
10
- <%%= link_to t('.cancel', :default => t("helpers.links.cancel")),
11
- <%= controller_routing_path %>_path, :class => 'btn' %>
12
- </div>
9
+
10
+ <%%= f.button :submit, :class => 'btn-primary' %>
11
+ <%%= link_to t('.cancel', :default => t("helpers.links.cancel")),
12
+ <%= controller_routing_path %>_path, :class => 'btn btn-default' %>
13
13
  <%- end -%>
14
14
  <%% end %>
@@ -1,11 +1,11 @@
1
1
  = simple_form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f|
2
2
  <%- columns.each do |column| -%>
3
3
  = f.input :<%= column.name %>
4
+ = f.error_span :<%= column.name %>
4
5
  <%- end -%>
5
6
  <%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
6
7
  = f.button :wrapped, :cancel => <%= controller_routing_path %>_path
7
8
  <%- else -%>
8
- .form-actions
9
- = f.button :submit, :class => 'btn-primary'
10
- = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
9
+ = f.button :submit, :class => 'btn-primary'
10
+ = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
11
11
  <%- end -%>
@@ -1,12 +1,12 @@
1
1
  = simple_form_for @<%= resource_name %>, :html => { :class => "form-horizontal" } do |f|
2
2
  <%- columns.each do |column| -%>
3
3
  = f.input :<%= column.name %>
4
+ = error_span(@<%= resource_name %>[:<%= column.name %>])
4
5
  <%- end -%>
5
6
  <%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
6
7
  = f.button :wrapped, :cancel => <%= controller_routing_path %>_path
7
8
  <%- else -%>
8
- .form-actions
9
- = f.button :submit, :class => 'btn-primary'
10
- '
11
- = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
9
+ = f.button :submit, :class => 'btn-primary'
10
+ '
11
+ = link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn btn-default'
12
12
  <%- end -%>
@@ -31,11 +31,11 @@ module Bootstrap
31
31
  end
32
32
 
33
33
  def controller_routing_path
34
- @controller_routing_path
34
+ ActiveModel::Naming.route_key(@model_name.constantize)
35
35
  end
36
36
 
37
37
  def singular_controller_routing_path
38
- @controller_routing_path.singularize
38
+ ActiveModel::Naming.singular_route_key(@model_name.constantize)
39
39
  end
40
40
 
41
41
  def model_name
@@ -0,0 +1,69 @@
1
+ module Twitter
2
+ module Bootstrap
3
+
4
+ # Keep current method calls as is using aliases
5
+ module Breadcrumbs
6
+ extend ActiveSupport::Concern
7
+ included do
8
+ # Used to provide compatibility with breadcrumbs-on-rails gem, if detected
9
+ # breadcrumbs controller methods won't be overridden.
10
+ if defined?(::BreadcrumbsOnRails)
11
+ ::Rails.logger.info <<-EOT.squish
12
+ BreadcrumbsOnRails detected it won't be overridden. To use methods from this gem you need to call them
13
+ using bootstrap prefix i.e. add_bootstrap_breadcrumb and render_bootstrap_breadcrumbs.
14
+ EOT
15
+ else
16
+ # Provide backward compatibility with existing code
17
+ alias_method :add_breadcrumb, :add_bootstrap_breadcrumb
18
+ class << self
19
+ alias_method :add_breadcrumb, :add_bootstrap_breadcrumb
20
+ end
21
+ end
22
+ end
23
+
24
+ module ClassMethods
25
+ def add_bootstrap_breadcrumb(name, url = '', options = {})
26
+ options.merge! :klass => self.name
27
+ before_filter options do |controller|
28
+ controller.send :add_bootstrap_breadcrumb, name, url, options
29
+ end
30
+ end
31
+ end
32
+
33
+ protected
34
+
35
+ def add_bootstrap_breadcrumb(name, url = '', options = {})
36
+ @__bs_breadcrumbs ||= []
37
+
38
+ class_name = options.delete(:klass) || self.class.name
39
+
40
+ if name.is_a? Symbol
41
+ if url.blank?
42
+ url_helper = :"#{name}_path"
43
+ url = url_helper if respond_to?(url_helper)
44
+ end
45
+
46
+ name = translate_breadcrumb name, class_name
47
+ end
48
+
49
+ unless name.is_a? String
50
+ url = polymorphic_path name if url.blank?
51
+ name = name.to_s
52
+ end
53
+
54
+ url = eval(url.to_s) if url.is_a?(Symbol) && url =~ /_path|_url|@/
55
+
56
+ @__bs_breadcrumbs << {:name => name, :url => url, :options => options}
57
+ end
58
+
59
+ def translate_breadcrumb(name, class_name)
60
+ scope = [:breadcrumbs]
61
+ namespace = class_name.underscore.split('/')
62
+ namespace.last.sub!('_controller', '')
63
+ scope += namespace
64
+
65
+ I18n.t name, :scope => scope
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,9 +1,11 @@
1
1
  require 'rails'
2
2
 
3
- require File.dirname(__FILE__) + '/twitter-bootstrap-breadcrumbs.rb'
4
- require File.dirname(__FILE__) + '/../../../../app/helpers/flash_block_helper.rb'
5
- require File.dirname(__FILE__) + '/../../../../app/helpers/modal_helper.rb'
6
- require File.dirname(__FILE__) + '/../../../../app/helpers/navbar_helper.rb'
3
+ require_relative 'breadcrumbs.rb'
4
+ require_relative '../../../../app/helpers/flash_block_helper.rb'
5
+ require_relative '../../../../app/helpers/modal_helper.rb'
6
+ require_relative '../../../../app/helpers/navbar_helper.rb'
7
+ require_relative '../../../../app/helpers/bootstrap_flash_helper.rb'
8
+ require_relative '../../../../app/helpers/form_errors_helper.rb'
7
9
 
8
10
  module Twitter
9
11
  module Bootstrap
@@ -19,13 +21,18 @@ module Twitter
19
21
 
20
22
  initializer 'twitter-bootstrap-rails.setup_helpers' do |app|
21
23
  app.config.to_prepare do
22
- ActionController::Base.send :include, BreadCrumbs
23
- ActionController::Base.send :helper, FlashBlockHelper
24
- ActionController::Base.send :helper, ModalHelper
25
- ActionController::Base.send :helper, NavbarHelper
26
- ActionController::Base.send :helper, BadgeLabelHelper
27
- #ActionController::Base.send :helper_method, :render_breadcrumbs
24
+ ActionController::Base.send :include, Breadcrumbs
28
25
  end
26
+ [FlashBlockHelper,
27
+ BootstrapFlashHelper,
28
+ ModalHelper,
29
+ NavbarHelper,
30
+ BadgeLabelHelper].each do |h|
31
+ app.config.to_prepare do
32
+ ActionController::Base.send :helper, h
33
+ end
34
+ end
35
+ ActionView::Helpers::FormBuilder.send :include, FormErrorsHelper
29
36
  end
30
37
  end
31
38
  end
@@ -1,7 +1,7 @@
1
1
  module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
- VERSION = "2.2.8"
4
+ VERSION = "4.0.0"
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -0,0 +1,99 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twitter::Bootstrap::Breadcrumbs do
4
+ class TestModel
5
+ include ActiveModel::Model
6
+
7
+ def to_s
8
+ "test_model"
9
+ end
10
+ end
11
+
12
+ class BaseTestController < AbstractController::Base
13
+ include Twitter::Bootstrap::Breadcrumbs
14
+ include AbstractController::Callbacks
15
+ include AbstractController::UrlFor
16
+
17
+ add_breadcrumb 'base', '/base'
18
+ add_breadcrumb :base_i18n, '/base_i18n'
19
+
20
+ def breadcrumbs
21
+ @__bs_breadcrumbs
22
+ end
23
+ end
24
+
25
+ class TestController < BaseTestController
26
+ add_breadcrumb 'class', '/class'
27
+ add_breadcrumb :class_i18n, '/class_i18n'
28
+
29
+ def show
30
+ add_breadcrumb 'instance', '/instance'
31
+ add_breadcrumb :instance_i18n, '/instance_i18n'
32
+
33
+ test_model = TestModel.new
34
+ add_breadcrumb test_model
35
+
36
+ add_breadcrumb :symbolized
37
+ add_breadcrumb :show
38
+ end
39
+
40
+ def symbolized_path
41
+ '/symbolized'
42
+ end
43
+
44
+ def test_models_path
45
+ '/test_model'
46
+ end
47
+ end
48
+
49
+ describe 'Breadcrumbs generation' do
50
+
51
+ before do
52
+ options = { :scope => [:breadcrumbs, 'test'] }
53
+ [:class_i18n, :instance_i18n, :show, :symbolized].each do |name|
54
+ I18n.expects(:t).with(name, options).returns(name.to_s)
55
+ end
56
+
57
+ name = :base_i18n
58
+ options = { :scope => [:breadcrumbs, 'base_test'] }
59
+ I18n.expects(:t).with(name, options).returns(name)
60
+
61
+ @controller = TestController.new
62
+ @controller.process(:show)
63
+ end
64
+
65
+ it "have breadcrumbs" do
66
+ [:base, :base_i18n, :class, :class_i18n, :instance, :instance_i18n, :test_model, :symbolized].each do |name|
67
+ path = "/#{name}"
68
+ idx = @controller.breadcrumbs.index { |b| b[:name] == name.to_s && b[:url] == path }
69
+ expect(idx).to be, -> { name }
70
+ end
71
+
72
+ idx = @controller.breadcrumbs.index { |b| b[:name] == "show" && b[:url] == '' }
73
+ expect(idx).to be
74
+ end
75
+ end
76
+
77
+ describe 'BreadcrumbsOnRails compatibility' do
78
+ class SomeController < AbstractController::Base
79
+ end
80
+ let(:logger) { double('logger').as_null_object }
81
+ before { allow(::Rails).to receive(:logger).and_return(logger) }
82
+
83
+ context 'when BreadcrumbsOnRails is defined' do
84
+ before do
85
+ stub_const('BreadcrumbsOnRails', 1)
86
+ expect(defined?(::BreadcrumbsOnRails)).to be_truthy
87
+ expect(logger).to receive(:info).with /BreadcrumbsOnRails detected/
88
+ SomeController.send(:include, Twitter::Bootstrap::Breadcrumbs)
89
+ end
90
+
91
+ it 'does not define aliases' do
92
+ expect(SomeController).to respond_to :add_bootstrap_breadcrumb
93
+ expect(SomeController).not_to respond_to :add_breadcrumb
94
+ end
95
+ end
96
+
97
+ end
98
+
99
+ end