bootstrap-component-helper 0.2.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +39 -0
  4. data/Rakefile +14 -0
  5. data/app/helpers/bootstrap/base_helper.rb +60 -0
  6. data/app/helpers/bootstrap/component_helper.rb +570 -0
  7. data/app/helpers/bootstrap/image_helper.rb +38 -0
  8. data/app/helpers/bootstrap/tab_helper.rb +107 -0
  9. data/app/helpers/bootstrap/table_helper.rb +203 -0
  10. data/app/helpers/bootstrap/typography_helper.rb +109 -0
  11. data/lib/bootstrap-component-helper.rb +10 -0
  12. data/lib/bootstrap/component_helper/engine.rb +11 -0
  13. data/lib/bootstrap/component_helper/version.rb +5 -0
  14. data/lib/generators/bootstrap/component_helper/install/install_generator.rb +40 -0
  15. data/lib/generators/bootstrap/component_helper/install/templates/index.css.scss +7 -0
  16. data/lib/generators/bootstrap/component_helper/install/templates/index.js +3 -0
  17. data/test/dummy/README.rdoc +261 -0
  18. data/test/dummy/Rakefile +7 -0
  19. data/test/dummy/app/assets/images/favicon.ico +0 -0
  20. data/test/dummy/app/assets/javascripts/application.js +17 -0
  21. data/test/dummy/app/assets/javascripts/bootstrap_component_helper/index.js +3 -0
  22. data/test/dummy/app/assets/javascripts/holder.js +658 -0
  23. data/test/dummy/app/assets/javascripts/prettify.js +376 -0
  24. data/test/dummy/app/assets/stylesheets/application.css +156 -0
  25. data/test/dummy/app/assets/stylesheets/bootstrap_component_helper/index.css.scss +7 -0
  26. data/test/dummy/app/assets/stylesheets/prettify.css +55 -0
  27. data/test/dummy/app/controllers/application_controller.rb +3 -0
  28. data/test/dummy/app/controllers/home_controller.rb +5 -0
  29. data/test/dummy/app/helpers/application_helper.rb +2 -0
  30. data/test/dummy/app/models/order.rb +2 -0
  31. data/test/dummy/app/views/home/_flash.html.erb +43 -0
  32. data/test/dummy/app/views/home/_image.html.erb +64 -0
  33. data/test/dummy/app/views/home/_list.html.erb +106 -0
  34. data/test/dummy/app/views/home/_modal.html.erb +230 -0
  35. data/test/dummy/app/views/home/_navbar.html.erb +34 -0
  36. data/test/dummy/app/views/home/_progressbar.html.erb +47 -0
  37. data/test/dummy/app/views/home/_tab.html.erb +118 -0
  38. data/test/dummy/app/views/home/_table.html.erb +212 -0
  39. data/test/dummy/app/views/home/_thumbnails.html.erb +84 -0
  40. data/test/dummy/app/views/home/_typographic.html.erb +52 -0
  41. data/test/dummy/app/views/home/index.html.erb +108 -0
  42. data/test/dummy/app/views/layouts/application.html.erb +66 -0
  43. data/test/dummy/bin/bundle +3 -0
  44. data/test/dummy/bin/rails +4 -0
  45. data/test/dummy/bin/rake +4 -0
  46. data/test/dummy/config.ru +4 -0
  47. data/test/dummy/config/application.rb +17 -0
  48. data/test/dummy/config/boot.rb +10 -0
  49. data/test/dummy/config/database.yml +27 -0
  50. data/test/dummy/config/environment.rb +5 -0
  51. data/test/dummy/config/environments/development.rb +28 -0
  52. data/test/dummy/config/environments/production.rb +80 -0
  53. data/test/dummy/config/environments/test.rb +36 -0
  54. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  56. data/test/dummy/config/initializers/inflections.rb +15 -0
  57. data/test/dummy/config/initializers/mime_types.rb +5 -0
  58. data/test/dummy/config/initializers/secret_token.rb +7 -0
  59. data/test/dummy/config/initializers/session_store.rb +8 -0
  60. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/test/dummy/config/locales/en.bootstrap.yml +18 -0
  62. data/test/dummy/config/locales/en.yml +14 -0
  63. data/test/dummy/config/routes.rb +7 -0
  64. data/test/dummy/db/development.sqlite3 +0 -0
  65. data/test/dummy/db/migrate/20131006012048_create_orders.rb +12 -0
  66. data/test/dummy/db/schema.rb +25 -0
  67. data/test/dummy/db/seeds.rb +3 -0
  68. data/test/dummy/db/test.sqlite3 +0 -0
  69. data/test/dummy/log/development.log +18302 -0
  70. data/test/dummy/log/test.log +1145 -0
  71. data/test/dummy/public/404.html +26 -0
  72. data/test/dummy/public/422.html +26 -0
  73. data/test/dummy/public/500.html +25 -0
  74. data/test/dummy/public/favicon.ico +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sass/0bcc8f0683a417e2802dca2e2526013808c5c34c/application.css.scssc +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sass/0bcc8f0683a417e2802dca2e2526013808c5c34c/components.css.scssc +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_accordion.scssc +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_alerts.scssc +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_breadcrumbs.scssc +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_button-groups.scssc +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_buttons.scssc +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_carousel.scssc +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_close.scssc +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_code.scssc +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_component-animations.scssc +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_dropdowns.scssc +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_forms.scssc +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_grid.scssc +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_hero-unit.scssc +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_labels-badges.scssc +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_layouts.scssc +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_media.scssc +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_mixins.scssc +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_modals.scssc +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_navbar.scssc +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_navs.scssc +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_pager.scssc +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_pagination.scssc +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_popovers.scssc +0 -0
  100. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_progress-bars.scssc +0 -0
  101. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_reset.scssc +0 -0
  102. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_responsive-1200px-min.scssc +0 -0
  103. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_responsive-767px-max.scssc +0 -0
  104. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_responsive-768px-979px.scssc +0 -0
  105. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_responsive-navbar.scssc +0 -0
  106. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_responsive-utilities.scssc +0 -0
  107. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_scaffolding.scssc +0 -0
  108. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_sprites.scssc +0 -0
  109. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_tables.scssc +0 -0
  110. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_thumbnails.scssc +0 -0
  111. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_tooltip.scssc +0 -0
  112. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_type.scssc +0 -0
  113. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_utilities.scssc +0 -0
  114. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_variables.scssc +0 -0
  115. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/_wells.scssc +0 -0
  116. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/bootstrap.scssc +0 -0
  117. data/test/dummy/tmp/cache/assets/development/sass/7eab2e6517a6682722eebb4a5df7152eb329b310/responsive.scssc +0 -0
  118. data/test/dummy/tmp/cache/assets/development/sass/84409d58037c135b28739dd3324e312869e235c7/index.css.scssc +0 -0
  119. data/test/dummy/tmp/cache/assets/development/sass/c4d7e8313a08850ac1c2652d326bf93cea20578b/bootstrap-responsive.scssc +0 -0
  120. data/test/dummy/tmp/cache/assets/development/sass/c4d7e8313a08850ac1c2652d326bf93cea20578b/bootstrap.scssc +0 -0
  121. data/test/dummy/tmp/cache/assets/development/sprockets/03dd2dfd114c5240ab978a5bce1565fd +0 -0
  122. data/test/dummy/tmp/cache/assets/development/sprockets/07ce016699b0337b14f97412576ddf9b +0 -0
  123. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  124. data/test/dummy/tmp/cache/assets/development/sprockets/1482cdaf91da4a3e74c2fee962e57266 +0 -0
  125. data/test/dummy/tmp/cache/assets/development/sprockets/14a3b97c693d6129681bb6c9e63e79b4 +0 -0
  126. data/test/dummy/tmp/cache/assets/development/sprockets/16033f0fe45a392c87dc5f38f59e29e2 +0 -0
  127. data/test/dummy/tmp/cache/assets/development/sprockets/17fd81b14984c81c41a5c231cd905bcc +0 -0
  128. data/test/dummy/tmp/cache/assets/development/sprockets/186b967c502a9346f6b379dfb06fe14f +0 -0
  129. data/test/dummy/tmp/cache/assets/development/sprockets/1dc9e3618cee425126b555221e90226f +0 -0
  130. data/test/dummy/tmp/cache/assets/development/sprockets/262f97b1f0dd574bfff7cc8ecbb9f72e +0 -0
  131. data/test/dummy/tmp/cache/assets/development/sprockets/264e074302048cb000f909f2919a0c9a +0 -0
  132. data/test/dummy/tmp/cache/assets/development/sprockets/29c2f0fd8e3c5f4dcd1332efa4a0371d +0 -0
  133. data/test/dummy/tmp/cache/assets/development/sprockets/2a61f06ae5cf5f6f1d43645b9b219453 +0 -0
  134. data/test/dummy/tmp/cache/assets/development/sprockets/2e18e960f308cca4a1fdb77359d01a6c +0 -0
  135. data/test/dummy/tmp/cache/assets/development/sprockets/2eee36c2ad21295c7e21e18c150d874b +0 -0
  136. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  137. data/test/dummy/tmp/cache/assets/development/sprockets/302cf2e7263ec807edde7ea7f3b65c03 +0 -0
  138. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  139. data/test/dummy/tmp/cache/assets/development/sprockets/3c8c07d37685b45615255078c41e3ce0 +0 -0
  140. data/test/dummy/tmp/cache/assets/development/sprockets/3d2aeae465a641db34a3cea9ba300375 +0 -0
  141. data/test/dummy/tmp/cache/assets/development/sprockets/3e27ccb3d43c940c257f6271a634069e +0 -0
  142. data/test/dummy/tmp/cache/assets/development/sprockets/3ed026ca41b91b839c4dee2c2cc51849 +0 -0
  143. data/test/dummy/tmp/cache/assets/development/sprockets/41dc3aa765e6d4c4a686f88efbd6c68e +0 -0
  144. data/test/dummy/tmp/cache/assets/development/sprockets/41f5ea237dc91ead6f4231e2147f5404 +0 -0
  145. data/test/dummy/tmp/cache/assets/development/sprockets/46fc0f6e8d72a05f2eea42eaed662e5d +0 -0
  146. data/test/dummy/tmp/cache/assets/development/sprockets/470718a7ca39bcb2f1dc6053ffc682c0 +0 -0
  147. data/test/dummy/tmp/cache/assets/development/sprockets/4a3201209795b8621efba2e0ce121a6a +0 -0
  148. data/test/dummy/tmp/cache/assets/development/sprockets/4ed14f9f7b1d5af357ddef644208340e +0 -0
  149. data/test/dummy/tmp/cache/assets/development/sprockets/516cdb0fc494c1a008f5630ee3f83ed9 +0 -0
  150. data/test/dummy/tmp/cache/assets/development/sprockets/52e41d2cb37819e3cbe438707c4693c0 +0 -0
  151. data/test/dummy/tmp/cache/assets/development/sprockets/536039d2b9042f61449290e282854f4d +0 -0
  152. data/test/dummy/tmp/cache/assets/development/sprockets/54857feec0db8fabd9e5bc2c6870cf5f +0 -0
  153. data/test/dummy/tmp/cache/assets/development/sprockets/54cc1257b927751b13f0369969e17440 +0 -0
  154. data/test/dummy/tmp/cache/assets/development/sprockets/61ad5207a209b9787578645a6950698a +0 -0
  155. data/test/dummy/tmp/cache/assets/development/sprockets/630cd0d8a55d825eaba0a90cda91122f +0 -0
  156. data/test/dummy/tmp/cache/assets/development/sprockets/698c4f478493aa93e94a2c32cdd5f1cc +0 -0
  157. data/test/dummy/tmp/cache/assets/development/sprockets/69e06cba85ef043450b628947462887c +0 -0
  158. data/test/dummy/tmp/cache/assets/development/sprockets/6d1b20df06d073df2627c4df640473c2 +0 -0
  159. data/test/dummy/tmp/cache/assets/development/sprockets/6fca826ec75b904f60239bb708e38805 +0 -0
  160. data/test/dummy/tmp/cache/assets/development/sprockets/700827acd727b6fc8361f454c68a5cd7 +0 -0
  161. data/test/dummy/tmp/cache/assets/development/sprockets/754683dc7fa0bebc9ff776512a463c80 +0 -0
  162. data/test/dummy/tmp/cache/assets/development/sprockets/76bde91ae4ac1605f8b2abe1dd436efa +0 -0
  163. data/test/dummy/tmp/cache/assets/development/sprockets/779fd39741d5f4364f4453e6d9db3a8c +0 -0
  164. data/test/dummy/tmp/cache/assets/development/sprockets/7a7d275aba66d0cd4498b2a7d2cc1d33 +0 -0
  165. data/test/dummy/tmp/cache/assets/development/sprockets/7b28ddacb7b45a6b7022eb766e2f9c62 +0 -0
  166. data/test/dummy/tmp/cache/assets/development/sprockets/7ee5964945e32a33395fd4a8b52901f8 +0 -0
  167. data/test/dummy/tmp/cache/assets/development/sprockets/805a755d6887dd3f251ee8d671113a55 +0 -0
  168. data/test/dummy/tmp/cache/assets/development/sprockets/833fa0f8ca6eda2934d5875796ac0ddb +0 -0
  169. data/test/dummy/tmp/cache/assets/development/sprockets/85f13ec6dfd4e1c1d6d4faf5579367e4 +0 -0
  170. data/test/dummy/tmp/cache/assets/development/sprockets/8816657a272738b50d9f339f83602b2b +0 -0
  171. data/test/dummy/tmp/cache/assets/development/sprockets/8ab512c9b33ac90e699b73469d71f061 +0 -0
  172. data/test/dummy/tmp/cache/assets/development/sprockets/8bd5ee2e9abbe312a72a1cec2ea714a7 +0 -0
  173. data/test/dummy/tmp/cache/assets/development/sprockets/8d55d8baa9ba44e3a712be2608138977 +0 -0
  174. data/test/dummy/tmp/cache/assets/development/sprockets/8d675d1f43c56b8b3fb27598f691101f +0 -0
  175. data/test/dummy/tmp/cache/assets/development/sprockets/8f2292d2f2a219537aa2eff8577b38f5 +0 -0
  176. data/test/dummy/tmp/cache/assets/development/sprockets/8fd90c230c6244605a4c7b4bbcf41a21 +0 -0
  177. data/test/dummy/tmp/cache/assets/development/sprockets/9689835f50540dff6e5d5107069dc71d +0 -0
  178. data/test/dummy/tmp/cache/assets/development/sprockets/9c9f438defd3bed7797b13c64eea90c0 +0 -0
  179. data/test/dummy/tmp/cache/assets/development/sprockets/a19b51f4929c5dcbda2aa927080241c1 +0 -0
  180. data/test/dummy/tmp/cache/assets/development/sprockets/a202a5609c41454fcc67a0317b10da90 +0 -0
  181. data/test/dummy/tmp/cache/assets/development/sprockets/a5b779be5a68643653ca723bce23c62c +0 -0
  182. data/test/dummy/tmp/cache/assets/development/sprockets/a899e19256a0845205636938010c6fe5 +0 -0
  183. data/test/dummy/tmp/cache/assets/development/sprockets/ac722b83b79d24471fa10acb05d4f095 +0 -0
  184. data/test/dummy/tmp/cache/assets/development/sprockets/ae0e5ab1590ad2f8651e7f29ab089d0f +0 -0
  185. data/test/dummy/tmp/cache/assets/development/sprockets/b56d14052881f9f2fd665749410513dc +0 -0
  186. data/test/dummy/tmp/cache/assets/development/sprockets/b6ff3a15ed2b320aa100de615d6acaa0 +0 -0
  187. data/test/dummy/tmp/cache/assets/development/sprockets/ba7837a3356c8c0f9d2d4dddd2db4ee2 +0 -0
  188. data/test/dummy/tmp/cache/assets/development/sprockets/bad2a2d10a1446e9b1eebb24bb7976ad +0 -0
  189. data/test/dummy/tmp/cache/assets/development/sprockets/bcca522c6302f184f12fe0e8a7d7e71a +0 -0
  190. data/test/dummy/tmp/cache/assets/development/sprockets/c13fc73ceafa45876a901b3e775b83ae +0 -0
  191. data/test/dummy/tmp/cache/assets/development/sprockets/c72afec6ec61c0d8e5e664998b2d6dd5 +0 -0
  192. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  193. data/test/dummy/tmp/cache/assets/development/sprockets/d1ca5d34c1109f4451c3f675fd522bed +0 -0
  194. data/test/dummy/tmp/cache/assets/development/sprockets/d1e7f297ee2aaac3167da0b6b6575b49 +0 -0
  195. data/test/dummy/tmp/cache/assets/development/sprockets/d66f7358aa43217d389251a399669d37 +0 -0
  196. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  197. data/test/dummy/tmp/cache/assets/development/sprockets/d8d6bcff066ae30f590880ff044badf2 +0 -0
  198. data/test/dummy/tmp/cache/assets/development/sprockets/d90eaeee0ba225714c425461bbfa529d +0 -0
  199. data/test/dummy/tmp/cache/assets/development/sprockets/d9d7f35a4e51c382aed08175c1dd6292 +0 -0
  200. data/test/dummy/tmp/cache/assets/development/sprockets/db5ddc82768b144533c161a80bdeee2d +0 -0
  201. data/test/dummy/tmp/cache/assets/development/sprockets/dbb0a1624b85d0f9d4eaec08c03b8797 +0 -0
  202. data/test/dummy/tmp/cache/assets/development/sprockets/dc4f2c66b13e09c13320f6f21bb7ec6a +0 -0
  203. data/test/dummy/tmp/cache/assets/development/sprockets/dc664a988f31db3737b14c54d193732b +0 -0
  204. data/test/dummy/tmp/cache/assets/development/sprockets/dd7a16eba4646a5a23bb7e5f906abbd3 +0 -0
  205. data/test/dummy/tmp/cache/assets/development/sprockets/e030a7845a28abd00581260c4e8afdcd +0 -0
  206. data/test/dummy/tmp/cache/assets/development/sprockets/e256294192259b5603b8dc971d9d6a11 +0 -0
  207. data/test/dummy/tmp/cache/assets/development/sprockets/e66f24418617ac4a7ee71d67f7545ce3 +0 -0
  208. data/test/dummy/tmp/cache/assets/development/sprockets/e69c8095136c028e535371ef3123cbd1 +0 -0
  209. data/test/dummy/tmp/cache/assets/development/sprockets/ec8a4c9e797155e9996a35bb7f7d7673 +0 -0
  210. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  211. data/test/dummy/tmp/cache/assets/development/sprockets/f88b0e4100827602fa8c4f78b5e7dab3 +0 -0
  212. data/test/dummy/tmp/cache/assets/development/sprockets/f8d0320de120c037ea5d3943c8b76d0c +0 -0
  213. data/test/dummy/tmp/cache/assets/development/sprockets/fde3d3c8658f07dd5aef16cc104c05c9 +0 -0
  214. data/test/dummy/tmp/cache/assets/development/sprockets/ff8ea5d6d7296abe74b47835195461a1 +0 -0
  215. data/test/test_helper.rb +15 -0
  216. data/test/unit/helpers/bootstrap_component_helper_test.rb +92 -0
  217. data/test/unit/helpers/bootstrap_image_helper_test.rb +37 -0
  218. data/test/unit/helpers/bootstrap_tab_helper_test.rb +28 -0
  219. data/test/unit/helpers/bootstrap_typography_helper_test.rb +16 -0
  220. metadata +549 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cfd855cdc1f21cb5e3210fde1e80db3adb6de9bf
4
+ data.tar.gz: 0bc8b94f06ca5aca763e64bb12b660528389568c
5
+ SHA512:
6
+ metadata.gz: abd7741bcec9de4520e14d751cad4935e263c6ba28131451045efb8ce27664734aa4ca299badd851c83dbf58b209afad6a1f56397556ea2d01d1754376c78a12
7
+ data.tar.gz: fe5a70fbc1f3ac66dcf76e480f3928b817e3fb53eceaeea6f62b5594599696ab1651359f2085ee06a1abb95608b914229994a6a016d1a0507fd2f363ec75ac86
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 bigxiang
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Bootstrap Component Helper
2
+
3
+ This is a simple gem that wraps some components of Bootstrap. It provides unified components using helpers, faces to someone isn't very familiar with HTML and CSS or doesn't like using them throughout the pages such as some CRM projects.
4
+
5
+ It's compatible with Rails 4+ and Bootstrap 2.3.2.
6
+
7
+ ## Installation
8
+
9
+ **Notice**: This gem has included [bootstrap-sass](https://github.com/thomas-mcdonald/bootstrap-sass) and [bootstrap-modal-rails](https://github.com/vicentereig/bootstrap-modal-rails) for you.
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'bootstrap-component-helper', '~> 0.2.3'
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Add assets
20
+
21
+ Execute the installation generator:
22
+
23
+ $ rails g bootstrap:component_helper:install
24
+
25
+ ## Usage
26
+
27
+ Visit [Examples](http://bigxiang.github.io/bootstrap-component-helper) and read the comments of app/helpers/*.rb, A dummy Rails project had been added to test directory. In order to use it:
28
+
29
+ 1. `$ cd test/dummy`
30
+ 2. `$ rails s`
31
+ 3. access `http://localhost:3000` to view examples locally.
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'lib'
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
12
+
13
+
14
+ task :default => :test
@@ -0,0 +1,60 @@
1
+ #coding: utf-8
2
+ module Bootstrap
3
+ module BaseHelper
4
+ include ComponentHelper
5
+ include ImageHelper
6
+ include TabHelper
7
+ include TableHelper
8
+ include TypographyHelper
9
+
10
+ # Public: Simplify a div tag.
11
+ #
12
+ # options - Options can be accepted by div tag.
13
+ # block - The content of the div tag, can be other helpers or HTML tags
14
+ # or just strings.
15
+ #
16
+ # Examples
17
+ #
18
+ # div(class: 'hero-unit')
19
+ # # => <div class="hero-unit"></div>
20
+ #
21
+ #
22
+ # = div(class: 'hero-unit') do
23
+ # %h1 Hello World
24
+ # # => <div class="hero-unit"><h1>Hello World</h1></div>
25
+ #
26
+ # Returns the content wrapped by a div tag.
27
+ def div(options = {}, &block)
28
+ content_tag('div', nil, options) do
29
+ capture(&block) if block_given?
30
+ end
31
+ end
32
+
33
+ # Public: Merge a new class into class option or ext_class option
34
+ #
35
+ # new_class - the class string which needs to be merged to the existed
36
+ # options.
37
+ # options - the options ( default: {} )
38
+ #
39
+ # Examples
40
+ #
41
+ # merge_predef_class('nav nav-tabs', { id: 'tabs' })
42
+ # # => { id: 'tabs', class: 'nav nav-tabs' }
43
+ #
44
+ # merge_predef_class('nav nav-tabs', { id: 'tabs', class: 'foo' })
45
+ # # => { id: 'tabs', class: 'foo nav nav-tabs' }
46
+ #
47
+ # Returns the options argument itself.
48
+ def merge_predef_class(new_class, options = {})
49
+ existed_class = options[:class] || options[:ext_class]
50
+
51
+ if existed_class.blank?
52
+ options[:class] = new_class
53
+ else
54
+ existed_class << " #{new_class}"
55
+ end
56
+
57
+ options
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,570 @@
1
+ module Bootstrap
2
+ module ComponentHelper
3
+
4
+ # Dropdown menus not implemented
5
+
6
+ # Public: Button group, combine buttons as a group
7
+ #
8
+ # tag - Symbol or String. Html tag of button group. ( default: :div )
9
+ # vertical - Boolean. Buttons align vertically. ( default: false )
10
+ # options - Other options can be accepted by the tag specified.
11
+ # ( default: {} )
12
+ # block - The content of a button group, usually are several links with
13
+ # button styles.
14
+ #
15
+ # Examples
16
+ #
17
+ # = bg do
18
+ # = link_to('button 1', '#', class: 'btn')
19
+ # = link_to('button 2', '#', class: 'btn')
20
+ # = link_to('button 3', '#', class: 'btn')
21
+ #
22
+ # Returns the whole button group.
23
+ def btn_group(tag: :div, vertical: false, **options, &block)
24
+ class_str = 'btn-group'
25
+ class_str << ' btn-group-vertical' if vertical
26
+
27
+ content_tag(tag, nil, merge_predef_class(class_str, options), &block)
28
+ end
29
+
30
+ alias_method :bg, :btn_group
31
+
32
+ # Public: Button toolbar, combine button groups as a toolbar.
33
+ #
34
+ #
35
+ # tag - Symbol or String. Html tag of the toolbar. ( default: :div )
36
+ # options - Other options can be accepted by the tag specified.
37
+ # ( default: {} )
38
+ # block - The content of the toolbar, usually are several button groups
39
+ # or buttons.
40
+ #
41
+ # Examples
42
+ #
43
+ # = bt do
44
+ # = bg do
45
+ # = link_to('button 1', '#', class: 'btn')
46
+ # = link_to('button 2', '#', class: 'btn')
47
+ # = link_to('button 3', '#', class: 'btn')
48
+ # = bg do
49
+ # = link_to('button 4', '#', class: 'btn')
50
+ # = link_to('button 5', '#', class: 'btn')
51
+ # = link_to('button 6', '#', class: 'btn')
52
+ #
53
+ # Return the whole button toolbar.
54
+ def btn_toolbar(tag: :div, **options, &block)
55
+ content_tag(tag, nil, merge_predef_class('btn-toolbar', options), &block)
56
+ end
57
+
58
+ alias_method :bt, :btn_toolbar
59
+
60
+ # Button dropdown menus not implemented
61
+ # Split button dropdowns not implemented
62
+ # Dropup menus not implemented
63
+
64
+ # Public: Bootstrap navigator that can be used in navbar or used as
65
+ # tabs or pills. It wraps the list helper. Generate ul and li tags
66
+ # as navigator.
67
+ #
68
+ # type - String. Represent the type of the nav. If it's nil or an
69
+ # empty string, the nav would be a common nav, usually be used
70
+ # in a navbar. If it's tabs or pills, then the nav has its own
71
+ # style. ( default: '' )
72
+ # stacked - Boolean. Shows whether the nav is sorted stacked.
73
+ # ( default: false )
74
+ # li_options - Default options of all li tag.
75
+ # options - Other options can be accepted by ul.
76
+ # block - The content of a nav.
77
+ #
78
+ # Examples
79
+ #
80
+ # = nav do |item|
81
+ # = item.add(link_to('link 1', '#'))
82
+ # = item.add(link_to('link 2', '#'))
83
+ # = item.add(link_to('link 3', '#'))
84
+ # # => <ul class="nav nav-">
85
+ # <li><a href="#">link 1</a></li>
86
+ # <li><a href="#">link 2</a></li>
87
+ # <li><a href="#">link 3</a></li>
88
+ # </ul>
89
+ #
90
+ # = nav(type: 'tabs') do |item|
91
+ # = item.add(link_to('link 1', '#'))
92
+ # = item.add(link_to('link 2', '#'))
93
+ # = item.add(link_to('link 3', '#'))
94
+ # # => <ul class="nav nav-tabs">
95
+ # <li><a href="#">link 1</a></li>
96
+ # <li><a href="#">link 2</a></li>
97
+ # <li><a href="#">link 3</a></li>
98
+ # </ul>
99
+ #
100
+ # Returns the whole nav.
101
+ def nav(type: '', stacked: false, **options, &block)
102
+ nav_class = 'nav'
103
+
104
+ if type.blank? || %w(tabs pills).include?(type)
105
+ nav_class << " nav-#{type}"
106
+ else
107
+ raise "Error nav type, must be in tabs and pills."
108
+ end
109
+
110
+ nav_class << ' nav-stacked' if stacked
111
+
112
+ list(merge_predef_class(nav_class, options), &block)
113
+ end
114
+
115
+ # Public: Bootstrap navbar. Only implements the navbar at the top of the
116
+ # page.
117
+ #
118
+ #
119
+ # fixed - Boolean. If set to false, the navbar wouldn't be shown at the
120
+ # top of the page always while scrolling the page.
121
+ # ( default: true )
122
+ # fluid - Boolean. If set to false, the navbar uses a fixed layout for its
123
+ # content. ( default: true )
124
+ # inverse - Boolean. Whether inverses the background color of the navbar.
125
+ # options - Other options can be accepted by navbar.
126
+ # block - the content of a navbar, usually are navs and logos.
127
+ #
128
+ # Examples
129
+ #
130
+ # = navbar do
131
+ # = link_to('Title', '#', class: 'brand')
132
+ # = nav do
133
+ # = link_to('link 1', '#')
134
+ # = link_to('link 2', '#')
135
+ # = link_to('link 3', '#')
136
+ # # => <div class="navbar navbar-fixed-top">
137
+ # <div class="navbar-inner">
138
+ # <a href="#" class="brand">Title</a>
139
+ # <ul class="nav nav-">
140
+ # <li><a href="#">link 1</a></li>
141
+ # <li><a href="#">link 2</a></li>
142
+ # <li><a href="#">link 3</a></li>
143
+ # </ul>
144
+ # </div>
145
+ # </div>
146
+ #
147
+ # = navbar(fluid: false) do
148
+ # = link_to('Title', '#', class: 'brand')
149
+ # = nav do
150
+ # = link_to('link 1', '#')
151
+ # = link_to('link 2', '#')
152
+ # = link_to('link 3', '#')
153
+ # # => <div class="navbar navbar-fixed-top">
154
+ # <div class="navbar-inner">
155
+ # <div class="container">
156
+ # <a href="#" class="brand">Title</a>
157
+ # <ul class="nav nav-">
158
+ # <li><a href="#">link 1</a></li>
159
+ # <li><a href="#">link 2</a></li>
160
+ # <li><a href="#">link 3</a></li>
161
+ # </ul>
162
+ # </div>
163
+ # </div>
164
+ # </div>
165
+ #
166
+ # Return the whole navbar
167
+ def navbar(fluid: true, inverse: false, fixed: true, **options, &block)
168
+ navbar_class = %w(navbar)
169
+
170
+ if fixed
171
+ navbar_class << 'navbar-fixed-top'
172
+ else
173
+ navbar_class << 'navbar-static-top'
174
+ end
175
+
176
+ navbar_class << 'navbar-inverse' if inverse
177
+
178
+
179
+ div(merge_predef_class(navbar_class.join(' '), options)) do
180
+ div(class: 'navbar-inner') do
181
+ if fluid
182
+ capture(&block) if block_given?
183
+ else
184
+ div(class: 'container') do
185
+ capture(&block) if block_given?
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end
191
+
192
+ # Breadcrumbs not implemented
193
+
194
+ # Public: Bootstrap labels.
195
+ #
196
+ # text - String. Label text.
197
+ # type - String. A string of success, warning, important, info or inverse
198
+ # ( default: 'default' )
199
+ # tag - Symbol or String. Html tag of the label. ( default: 'span' )
200
+ # options - Other options can be accepted by the tag specified.
201
+ #
202
+ # Examples
203
+ #
204
+ # l("I'm a label")
205
+ # # => <span class="label label-default">I'm a label</span>
206
+ #
207
+ # l("I'm a label", type: 'success')
208
+ # # => <span class="label label-success">I'm a label</span>
209
+ #
210
+ # l("I'm a label", style: 'color: #999;')
211
+ # # => <span class="label label-default" style="color: #999;">
212
+ # I'm a label
213
+ # </span>
214
+ #
215
+ # Returns the label html.
216
+ def l(text, type: 'default', tag: 'span', **options)
217
+ content_tag(tag, text, merge_predef_class("label label-#{type.to_s}", options))
218
+ end
219
+
220
+ # Public: Bootstrap badges.
221
+ #
222
+ # text - String. badge text.
223
+ # type - String. A string of success, warning, important, info or inverse
224
+ # ( default: 'default' )
225
+ # tag - Symbol or String. Html tag of the badge. ( default: 'span' )
226
+ # options - Other options can be accepted by the tag specified.
227
+ #
228
+ # Examples
229
+ #
230
+ # b("I'm a badge")
231
+ # # => <span class="badge badge-default">I'm a badge</span>
232
+ #
233
+ # b("I'm a label", type: 'success')
234
+ # # => <span class="badge badge-success">I'm a badge</span>
235
+ #
236
+ # b("I'm a label", style: 'color: #999;')
237
+ # # => <span class="badge badge-default" style="color: #999;">
238
+ # I'm a badge
239
+ # </span>
240
+ #
241
+ # Returns the badge html.
242
+ def badge(text, type: 'default', tag: 'span', **options)
243
+ content_tag(tag, text, merge_predef_class("badge badge-#{type.to_s}", options))
244
+ end
245
+
246
+ alias_method :b, :badge
247
+
248
+ # Public: Thumbnails grids of images, videos, text, and more.
249
+ #
250
+ # options - Options can be accepted by ul.
251
+ # block - The content of thumbnails, usually are several thumbnail holders
252
+ #
253
+ # Example
254
+ #
255
+ # = tns do
256
+ # = th(3) do
257
+ # = tn do
258
+ # = image_tag('hello.png')
259
+ # %h3 Title
260
+ # %p Description
261
+ # # => <ul class="thumbnails">
262
+ # <li class="span3">
263
+ # <div class="thumbnail">
264
+ # <img src="/assets/hello.png">
265
+ # <h3>Title</h3>
266
+ # <p>Description</p>
267
+ # </div>
268
+ # </li>
269
+ # </ul>
270
+ #
271
+ # Returns the whole thumbnails
272
+ def thumbnails(options = {}, &block)
273
+ content_tag('ul', nil, merge_predef_class('thumbnails', options)) do
274
+ capture(&block) if block_given?
275
+ end
276
+ end
277
+
278
+ # Public: Thumbnail holders, represented by li, used in thumbnails helper.
279
+ #
280
+ # span - Integer. Width of thumbnail, 1-12. ( default: 12 )
281
+ # options - Options can be accepted by li.
282
+ # block - The content of thumbnail holder, usually is a thumbnail.
283
+ #
284
+ # Examples
285
+ # See thumbnails helper.
286
+ def thumbnail_holder(span = 12, options = {}, &block)
287
+ content_tag('li', nil, merge_predef_class("span#{span}", options)) do
288
+ capture(&block) if block_given?
289
+ end
290
+ end
291
+
292
+ # Public: Thumbnail element.
293
+ #
294
+ # tag - Symbol or String. HTML tag of thumbnail. ( default: :div )
295
+ # options - Options can be accepted by the tag specified.
296
+ def thumbnail(tag: :div, **options, &block)
297
+ content_tag(tag, nil, merge_predef_class('thumbnail', options)) do
298
+ capture(&block)
299
+ end
300
+ end
301
+
302
+ alias_method :tns, :thumbnails
303
+ alias_method :th, :thumbnail_holder
304
+ alias_method :tn, :thumbnail
305
+
306
+ # Public: Bootstrap alerts. For success, warning, and error messages.
307
+ #
308
+ # message - String. The message of alert.
309
+ # type - Symbol or String. Type of alerts: error, warning, success,
310
+ # info. ( default: :info )
311
+ # blocked - Boolean. Add padding-top and padding-bottom to alert.
312
+ # ( default: false )
313
+ # closable - Boolean. Add a close button to alert. ( default: true )
314
+ # options - Other options that can be accepted by div.
315
+ # block - Content of the alert. It can be a string or a HTML block.
316
+ #
317
+ # Examples
318
+ #
319
+ # f(message: 'Hello World')
320
+ # # => <div class="alert alert-info">
321
+ # <a href="#" class="close" data-dismiss="alert">&times;</a>
322
+ # Hello World
323
+ # </div>
324
+ #
325
+ # f(message: 'Hello World', type: :success, block: true)
326
+ # # => <div class="alert alert-success alert-block">
327
+ # <a href="#" class="close" data-dismiss="alert">&times;</a>
328
+ # Hello World
329
+ # </div>
330
+ #
331
+ # = f do
332
+ # %h3 Hello World
333
+ # %p foo bar
334
+ # # => <div class="alert alert-info">
335
+ # <a href="#" class="close" data-dismiss="alert">&times;</a>
336
+ # <h3>Hello World</h3>
337
+ # <p>foo bar</p>
338
+ # </div>
339
+ #
340
+ # Returns the whole alert.
341
+ def f(message: '', type: :info, blocked: false, closable: true, **options, &block)
342
+ flash_class = 'alert'
343
+ flash_class << " alert-#{type.to_s}"
344
+ flash_class << ' alert-block' if blocked
345
+
346
+ content_tag(:div, nil, merge_predef_class(flash_class, options)) do
347
+ content = ''
348
+ content << '<a href="#" class="close" data-dismiss="alert">&times;</a>' if closable
349
+ if block_given?
350
+ content << capture(&block)
351
+ else
352
+ content << message if message.present?
353
+ end
354
+ content.html_safe
355
+ end
356
+ end
357
+
358
+ # Public: Bootstrap progress bars.
359
+ #
360
+ # type - String. Type of progress bar. It can be success, warning,
361
+ # danger, info. ( default: '' )
362
+ # percentage - Integer. Progress of the progress bar. 0 - 100.
363
+ # ( default: 0 )
364
+ # conent - String. Text of the progress bar. It will be shown in the
365
+ # center of the bar. ( default: '' )
366
+ # bar_options - Other options can be accepted by div.
367
+ # striped - Boolean. Uses a gradient to create a striped effect. Not
368
+ # available in IE7-8. ( default: false )
369
+ # active - Boolean. Add .active to .progress-striped to animate the
370
+ # stripes right to left. Not available in all versions of IE.
371
+ # ( default: false )
372
+ # in_table - Boolean. If progress is in a table, set the margin-bottom
373
+ # to zero. ( default: false )
374
+ # options - Other options that can be acctpted by div.
375
+ # block - The content of the progress. If a block has been passed,
376
+ # the arguments of type, percentage, content, bar_options
377
+ # would be ignored. The block should contain one or more
378
+ # progress bars.
379
+ #
380
+ # Examples
381
+ #
382
+ # pg(type: 'success', percentage: 25, striped: true)
383
+ # # => <div class="progress progress-striped">
384
+ # <div class="bar bar-success" style="width: 25%">
385
+ # </div>
386
+ # </div>
387
+ #
388
+ # = pg do
389
+ # = pb(type: 'success', percentage: 25)
390
+ # = pb(type: 'info', percentage: 25)
391
+ # # => <div class="progress">
392
+ # <div class="bar bar-success" style="width: 25%">
393
+ # </div>
394
+ # <div class="bar bar-info" style="width: 25%">
395
+ # </div>
396
+ # </div>
397
+ #
398
+ # Return the whole progress component.
399
+ def progress(type: '',
400
+ percentage: 0,
401
+ content: '',
402
+ bar_options: {},
403
+ active: false,
404
+ striped: false,
405
+ in_table: false,
406
+ **options,
407
+ &block)
408
+
409
+ progress_class = "progress"
410
+ progress_class << " progress-striped" if striped
411
+ progress_class << " active" if active
412
+
413
+ options[:style] ||= ""
414
+ options[:style] << "margin-bottom: 0;" if in_table
415
+
416
+ div(merge_predef_class(progress_class, options)) do
417
+ content = ''
418
+ if block_given?
419
+ content << capture(&block)
420
+ else
421
+ content << progress_bar(bar_options.reverse_merge!(type: type,
422
+ percentage: percentage, content: content))
423
+ end
424
+ content.html_safe
425
+ end
426
+ end
427
+
428
+ alias_method :pg, :progress
429
+
430
+ def progress_bar(type: '', percentage: 0, content: '', **options)
431
+ bar_class = "bar bar-#{type.to_s}"
432
+
433
+ options[:style] ||= ""
434
+ options[:style] << "width: #{percentage.to_i}%;"
435
+ content_tag('div', content, merge_predef_class(bar_class, options))
436
+ end
437
+
438
+ alias_method :pb, :progress_bar
439
+
440
+ # Miscellaneous Lightweight utility components
441
+
442
+ # Public: Bootstrap modal component, wraps bootstrap-modal-rails gem to
443
+ # provide more features, see http://jschr.github.io/bootstrap-modal
444
+ #
445
+ #
446
+ # id - String. HTML id attribute of the modal component.
447
+ # header_text - String. Text would be shown on the top of the modal.
448
+ # header - String. Header of modal, a html string replaces
449
+ # default header.
450
+ # footer_text - String. Text would be shown on the bottom button of
451
+ # the modal. ( default: 'Close' )
452
+ # footer - String. Footer of modal, a html string replaces default
453
+ # footer.
454
+ # width - Integer. Width of modal.
455
+ # static - Boolean. Static Background with Animation. ( default: true )
456
+ # fullwidth - Boolean. Show full width modal. ( default: false )
457
+ # long - Boolean. Show very long modal. ( default: false )
458
+ # options - Other options can be accepted by div.
459
+ # block - HTML block shows the content of the modal.
460
+ #
461
+ # Examples
462
+ #
463
+ #
464
+ # Returns the whole modal.
465
+ def modal(id,
466
+ header_text,
467
+ header: "<button type='button' data-dismiss='modal' class='close'>&times;</button><h3>#{header_text}</h3>",
468
+ footer_text: nil,
469
+ footer: "<button class='btn' data-dismiss='modal' type='button'>#{footer_text||'Close'}</button>",
470
+ width: nil,
471
+ static: true,
472
+ fullwidth: false,
473
+ long: false,
474
+ **options,
475
+ &block)
476
+
477
+ options.merge!(:'data-backdrop' => 'static', :'data-keyboard' => 'false') if static
478
+ options.merge!(:'data-replace' => 'true') if long
479
+ options.merge!(:'data-width' => width) if width
480
+ options.merge!(id: id)
481
+
482
+ div(merge_predef_class("modal hide fade #{fullwidth ? 'container' : ''}", options)) do
483
+ content = ''
484
+ content << div(class: 'modal-header') do
485
+ header.html_safe
486
+ end
487
+ content << div(class: 'modal-body') do
488
+ capture(&block) if block_given?
489
+ end
490
+ content << div(class: 'modal-footer') do
491
+ footer.html_safe
492
+ end
493
+ content.html_safe
494
+ end
495
+ end
496
+
497
+ # Public: Show a link which can toggle the modal.
498
+ #
499
+ # modal_id - String. HTML id attribute of the modal which should be opened.
500
+ # text - String. Text of the trigger.
501
+ # type - String. 'a' or 'b', 'a' shows link style, 'b' shows button
502
+ # style. ( default: 'a' )
503
+ # icon - String or Array. Glyph icon of trigger. Just like glyph_icon
504
+ # helper.
505
+ # options - Other options can be accepted by link.
506
+ #
507
+ # Examples
508
+ #
509
+ # modal_trigger('modal', 'Click Me')
510
+ # # => <a href="#modal" id="trigger-modal" data-toggle="modal">
511
+ # Click Me
512
+ # </a>
513
+ #
514
+ # modal_trigger('modal', 'Click Me', type: 'b', icon: 'plus')
515
+ # # => <a href="#modal" id="trigger-modal" data-toggle="modal"
516
+ # class="btn">
517
+ # <i class="icon-plus"></i>
518
+ # Click Me
519
+ # </a>
520
+ #
521
+ # Returns a link which can open the modal.
522
+ def modal_trigger(modal_id,
523
+ text,
524
+ type: 'a',
525
+ icon: nil,
526
+ **options)
527
+ options.merge!(id: "trigger-#{modal_id}")
528
+ options.merge!(:'data-toggle' => 'modal')
529
+
530
+ merge_predef_class('btn', options) if type == 'b'
531
+
532
+ link_to("##{modal_id}", options) do
533
+ content = ''
534
+ content << glyph_icon(icon) if icon
535
+ content << text
536
+ content.html_safe
537
+ end
538
+ end
539
+
540
+ # Public: Show a link which can toggle the modal and the modal itself.
541
+ #
542
+ # id - String. HTML id attribute of the modal which should be
543
+ # opened.
544
+ # header_text - String. Text would be shown on the top of the modal.
545
+ # trigger_text - String. Text of the trigger.
546
+ # options - Options can be accepted by modal, see modal helper.
547
+ # trigger_options - Options can be accepted by modal trigger, see
548
+ # modal_trigger helper.
549
+ # block - HTML block shows the content of the modal.
550
+ #
551
+ # Examples
552
+ #
553
+ #
554
+ # Returns a link with a modal would be opened by this link.
555
+ def modal_with_trigger(id,
556
+ header_text,
557
+ trigger_text,
558
+ options = {},
559
+ trigger_options = {},
560
+ &block)
561
+
562
+ content = modal(id, header_text, options) do
563
+ capture(&block) if block_given?
564
+ end
565
+
566
+ content << modal_trigger(id, trigger_text, trigger_options)
567
+ content.html_safe
568
+ end
569
+ end
570
+ end