bootstrap-component-helper 0.2.3.2

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.
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,10 @@
1
+ require "bootstrap/component_helper/version"
2
+ require "bootstrap/component_helper/engine"
3
+
4
+ require 'bootstrap-sass'
5
+ require 'bootstrap-modal-rails'
6
+
7
+ module Bootstrap
8
+ module ComponentHelper
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module Bootstrap
2
+ module ComponentHelper
3
+ class Engine < ::Rails::Engine
4
+ initializer 'bootstrap-component-helper.action_controller' do |app|
5
+ ActiveSupport.on_load :action_controller do
6
+ helper ::Bootstrap::BaseHelper
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Bs
2
+ module Helper
3
+ VERSION = '0.2.3.2'
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'rails/generators'
2
+
3
+ module Bootstrap
4
+ module ComponentHelper
5
+ module Generators
6
+ class InstallGenerator < ::Rails::Generators::Base
7
+
8
+ desc "This generator installs Bootstrap Helper to Asset Pipeline"
9
+
10
+ source_root File.expand_path("../templates", __FILE__)
11
+
12
+ def add_assets
13
+
14
+ copy_file "index.css.scss", "app/assets/stylesheets/bootstrap_component_helper/index.css.scss"
15
+ copy_file "index.js", "app/assets/javascripts/bootstrap_component_helper/index.js"
16
+
17
+ js_manifest = 'app/assets/javascripts/application.js'
18
+
19
+ if File.exist?(js_manifest)
20
+ insert_into_file js_manifest, :before => "//= require_tree .\n" do
21
+ <<-JS
22
+ //= require bootstrap_component_helper
23
+ JS
24
+ end
25
+ end
26
+
27
+ css_manifest = 'app/assets/stylesheets/application.css'
28
+
29
+ if File.exist?(css_manifest)
30
+ insert_into_file css_manifest, :before => " *= require_self\n" do
31
+ <<-CSS
32
+ *= require bootstrap_component_helper
33
+ CSS
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ /*
2
+ *= require_self
3
+ *= require bootstrap-modal
4
+ */
5
+
6
+ @import "bootstrap";
7
+ @import 'bootstrap-responsive';
@@ -0,0 +1,3 @@
1
+ //= require bootstrap
2
+ //= require bootstrap-modal
3
+ //= require bootstrap-modalmanager
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | | |-- images
161
+ | | |-- javascripts
162
+ | | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | |-- assets
177
+ | `-- tasks
178
+ |-- log
179
+ |-- public
180
+ |-- script
181
+ |-- test
182
+ | |-- fixtures
183
+ | |-- functional
184
+ | |-- integration
185
+ | |-- performance
186
+ | `-- unit
187
+ |-- tmp
188
+ | `-- cache
189
+ | `-- assets
190
+ `-- vendor
191
+ |-- assets
192
+ | |-- javascripts
193
+ | `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,17 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap_component_helper
16
+ //= require holder
17
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ //= require bootstrap
2
+ //= require bootstrap-modal
3
+ //= require bootstrap-modalmanager
@@ -0,0 +1,658 @@
1
+ /*!
2
+
3
+ Holder - 2.3.2 - client side image placeholders
4
+ (c) 2012-2014 Ivan Malopinsky / http://imsky.co
5
+
6
+ Provided under the MIT License.
7
+ Commercial use requires attribution.
8
+
9
+ */
10
+ var Holder = Holder || {};
11
+ (function (app, win) {
12
+ var system_config = {
13
+ use_svg: false,
14
+ use_canvas: false,
15
+ use_fallback: false
16
+ };
17
+ var instance_config = {};
18
+ var preempted = false;
19
+ canvas = document.createElement('canvas');
20
+ var dpr = 1, bsr = 1;
21
+ var resizable_images = [];
22
+
23
+ if (!canvas.getContext) {
24
+ system_config.use_fallback = true;
25
+ } else {
26
+ if (canvas.toDataURL("image/png")
27
+ .indexOf("data:image/png") < 0) {
28
+ //Android doesn't support data URI
29
+ system_config.use_fallback = true;
30
+ } else {
31
+ var ctx = canvas.getContext("2d");
32
+ }
33
+ }
34
+
35
+ if(!!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect){
36
+ system_config.use_svg = true;
37
+ system_config.use_canvas = false;
38
+ }
39
+
40
+ if(!system_config.use_fallback){
41
+ dpr = window.devicePixelRatio || 1,
42
+ bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
43
+ }
44
+
45
+ var ratio = dpr / bsr;
46
+
47
+ var settings = {
48
+ domain: "holder.js",
49
+ images: "img",
50
+ bgnodes: ".holderjs",
51
+ themes: {
52
+ "gray": {
53
+ background: "#eee",
54
+ foreground: "#aaa",
55
+ size: 12
56
+ },
57
+ "social": {
58
+ background: "#3a5a97",
59
+ foreground: "#fff",
60
+ size: 12
61
+ },
62
+ "industrial": {
63
+ background: "#434A52",
64
+ foreground: "#C2F200",
65
+ size: 12
66
+ },
67
+ "sky": {
68
+ background: "#0D8FDB",
69
+ foreground: "#fff",
70
+ size: 12
71
+ },
72
+ "vine": {
73
+ background: "#39DBAC",
74
+ foreground: "#1E292C",
75
+ size: 12
76
+ },
77
+ "lava": {
78
+ background: "#F8591A",
79
+ foreground: "#1C2846",
80
+ size: 12
81
+ }
82
+ },
83
+ stylesheet: ""
84
+ };
85
+ app.flags = {
86
+ dimensions: {
87
+ regex: /^(\d+)x(\d+)$/,
88
+ output: function (val) {
89
+ var exec = this.regex.exec(val);
90
+ return {
91
+ width: +exec[1],
92
+ height: +exec[2]
93
+ }
94
+ }
95
+ },
96
+ fluid: {
97
+ regex: /^([0-9%]+)x([0-9%]+)$/,
98
+ output: function (val) {
99
+ var exec = this.regex.exec(val);
100
+ return {
101
+ width: exec[1],
102
+ height: exec[2]
103
+ }
104
+ }
105
+ },
106
+ colors: {
107
+ regex: /#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,
108
+ output: function (val) {
109
+ var exec = this.regex.exec(val);
110
+ return {
111
+ size: settings.themes.gray.size,
112
+ foreground: "#" + exec[2],
113
+ background: "#" + exec[1]
114
+ }
115
+ }
116
+ },
117
+ text: {
118
+ regex: /text\:(.*)/,
119
+ output: function (val) {
120
+ return this.regex.exec(val)[1];
121
+ }
122
+ },
123
+ font: {
124
+ regex: /font\:(.*)/,
125
+ output: function (val) {
126
+ return this.regex.exec(val)[1];
127
+ }
128
+ },
129
+ auto: {
130
+ regex: /^auto$/
131
+ },
132
+ textmode: {
133
+ regex: /textmode\:(.*)/,
134
+ output: function(val){
135
+ return this.regex.exec(val)[1];
136
+ }
137
+ }
138
+ }
139
+
140
+ function text_size(width, height, template) {
141
+ height = parseInt(height, 10);
142
+ width = parseInt(width, 10);
143
+ var bigSide = Math.max(height, width)
144
+ var smallSide = Math.min(height, width)
145
+ var scale = 1 / 12;
146
+ var newHeight = Math.min(smallSide * 0.75, 0.75 * bigSide * scale);
147
+ return {
148
+ height: Math.round(Math.max(template.size, newHeight))
149
+ }
150
+ }
151
+
152
+ var svg_el = (function(){
153
+ //Prevent IE <9 from initializing SVG renderer
154
+ if(!window.XMLSerializer) return;
155
+ var serializer = new XMLSerializer();
156
+ var svg_ns = "http://www.w3.org/2000/svg"
157
+ var svg = document.createElementNS(svg_ns, "svg");
158
+ //IE throws an exception if this is set and Chrome requires it to be set
159
+ if(svg.webkitMatchesSelector){
160
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg")
161
+ }
162
+ var bg_el = document.createElementNS(svg_ns, "rect")
163
+ var text_el = document.createElementNS(svg_ns, "text")
164
+ var textnode_el = document.createTextNode(null)
165
+ text_el.setAttribute("text-anchor", "middle")
166
+ text_el.appendChild(textnode_el)
167
+ svg.appendChild(bg_el)
168
+ svg.appendChild(text_el)
169
+
170
+ return function(props){
171
+ svg.setAttribute("width",props.width);
172
+ svg.setAttribute("height", props.height);
173
+ bg_el.setAttribute("width", props.width);
174
+ bg_el.setAttribute("height", props.height);
175
+ bg_el.setAttribute("fill", props.template.background);
176
+ text_el.setAttribute("x", props.width/2)
177
+ text_el.setAttribute("y", props.height/2)
178
+ textnode_el.nodeValue=props.text
179
+ text_el.setAttribute("style", css_properties({
180
+ "fill": props.template.foreground,
181
+ "font-weight": "bold",
182
+ "font-size": props.text_height+"px",
183
+ "font-family":props.font,
184
+ "dominant-baseline":"central"
185
+ }))
186
+ return serializer.serializeToString(svg)
187
+ }
188
+ })()
189
+
190
+ function css_properties(props){
191
+ var ret = [];
192
+ for(p in props){
193
+ if(props.hasOwnProperty(p)){
194
+ ret.push(p+":"+props[p])
195
+ }
196
+ }
197
+ return ret.join(";")
198
+ }
199
+
200
+ function draw_canvas(args) {
201
+ var ctx = args.ctx,
202
+ dimensions = args.dimensions,
203
+ template = args.template,
204
+ ratio = args.ratio,
205
+ holder = args.holder,
206
+ literal = holder.textmode == "literal",
207
+ exact = holder.textmode == "exact";
208
+
209
+ var ts = text_size(dimensions.width, dimensions.height, template);
210
+ var text_height = ts.height;
211
+ var width = dimensions.width * ratio,
212
+ height = dimensions.height * ratio;
213
+ var font = template.font ? template.font : "Arial,Helvetica,sans-serif";
214
+ canvas.width = width;
215
+ canvas.height = height;
216
+ ctx.textAlign = "center";
217
+ ctx.textBaseline = "middle";
218
+ ctx.fillStyle = template.background;
219
+ ctx.fillRect(0, 0, width, height);
220
+ ctx.fillStyle = template.foreground;
221
+ ctx.font = "bold " + text_height + "px " + font;
222
+ var text = template.text ? template.text : (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
223
+ if (literal) {
224
+ var dimensions = holder.dimensions;
225
+ text = dimensions.width + "x" + dimensions.height;
226
+ }
227
+ else if(exact && holder.exact_dimensions){
228
+ var dimensions = holder.exact_dimensions;
229
+ text = (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
230
+ }
231
+ var text_width = ctx.measureText(text).width;
232
+ if (text_width / width >= 0.75) {
233
+ text_height = Math.floor(text_height * 0.75 * (width / text_width));
234
+ }
235
+ //Resetting font size if necessary
236
+ ctx.font = "bold " + (text_height * ratio) + "px " + font;
237
+ ctx.fillText(text, (width / 2), (height / 2), width);
238
+ return canvas.toDataURL("image/png");
239
+ }
240
+
241
+ function draw_svg(args){
242
+ var dimensions = args.dimensions,
243
+ template = args.template,
244
+ holder = args.holder,
245
+ literal = holder.textmode == "literal",
246
+ exact = holder.textmode == "exact";
247
+
248
+ var ts = text_size(dimensions.width, dimensions.height, template);
249
+ var text_height = ts.height;
250
+ var width = dimensions.width,
251
+ height = dimensions.height;
252
+
253
+ var font = template.font ? template.font : "Arial,Helvetica,sans-serif";
254
+ var text = template.text ? template.text : (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
255
+
256
+ if (literal) {
257
+ var dimensions = holder.dimensions;
258
+ text = dimensions.width + "x" + dimensions.height;
259
+ }
260
+ else if(exact && holder.exact_dimensions){
261
+ var dimensions = holder.exact_dimensions;
262
+ text = (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
263
+ }
264
+ var string = svg_el({
265
+ text: text,
266
+ width:width,
267
+ height:height,
268
+ text_height:text_height,
269
+ font:font,
270
+ template:template
271
+ })
272
+ return "data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(string)));
273
+ }
274
+
275
+ function draw(args) {
276
+ if(instance_config.use_canvas && !instance_config.use_svg){
277
+ return draw_canvas(args);
278
+ }
279
+ else{
280
+ return draw_svg(args);
281
+ }
282
+ }
283
+
284
+ function render(mode, el, holder, src) {
285
+ var dimensions = holder.dimensions,
286
+ theme = holder.theme,
287
+ text = holder.text ? decodeURIComponent(holder.text) : holder.text;
288
+ var dimensions_caption = dimensions.width + "x" + dimensions.height;
289
+ theme = (text ? extend(theme, {
290
+ text: text
291
+ }) : theme);
292
+ theme = (holder.font ? extend(theme, {
293
+ font: holder.font
294
+ }) : theme);
295
+ el.setAttribute("data-src", src);
296
+ holder.theme = theme;
297
+ el.holder_data = holder;
298
+
299
+ if (mode == "image") {
300
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
301
+ if (instance_config.use_fallback || !holder.auto) {
302
+ el.style.width = dimensions.width + "px";
303
+ el.style.height = dimensions.height + "px";
304
+ }
305
+ if (instance_config.use_fallback) {
306
+ el.style.backgroundColor = theme.background;
307
+ } else {
308
+ el.setAttribute("src", draw({ctx: ctx, dimensions: dimensions, template: theme, ratio:ratio, holder: holder}));
309
+
310
+ if(holder.textmode && holder.textmode == "exact"){
311
+ resizable_images.push(el);
312
+ resizable_update(el);
313
+ }
314
+
315
+ }
316
+ } else if (mode == "background") {
317
+ if (!instance_config.use_fallback) {
318
+ el.style.backgroundImage = "url(" + draw({ctx:ctx, dimensions: dimensions, template: theme, ratio: ratio, holder: holder}) + ")";
319
+ el.style.backgroundSize = dimensions.width + "px " + dimensions.height + "px";
320
+ }
321
+ } else if (mode == "fluid") {
322
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
323
+ if (dimensions.height.slice(-1) == "%") {
324
+ el.style.height = dimensions.height
325
+ } else if(holder.auto == null || !holder.auto){
326
+ el.style.height = dimensions.height + "px"
327
+ }
328
+ if (dimensions.width.slice(-1) == "%") {
329
+ el.style.width = dimensions.width
330
+ } else if(holder.auto == null || !holder.auto){
331
+ el.style.width = dimensions.width + "px"
332
+ }
333
+ if (el.style.display == "inline" || el.style.display === "" || el.style.display == "none") {
334
+ el.style.display = "block";
335
+ }
336
+
337
+ set_initial_dimensions(el)
338
+
339
+ if (instance_config.use_fallback) {
340
+ el.style.backgroundColor = theme.background;
341
+ } else {
342
+ resizable_images.push(el);
343
+ resizable_update(el);
344
+ }
345
+ }
346
+ }
347
+
348
+ function dimension_check(el, callback) {
349
+ var dimensions = {
350
+ height: el.clientHeight,
351
+ width: el.clientWidth
352
+ };
353
+ if (!dimensions.height && !dimensions.width) {
354
+ el.setAttribute("data-holder-invisible", true)
355
+ callback.call(this, el)
356
+ }
357
+ else{
358
+ el.removeAttribute("data-holder-invisible")
359
+ return dimensions;
360
+ }
361
+ }
362
+
363
+ function set_initial_dimensions(el){
364
+ if(el.holder_data){
365
+ var dimensions = dimension_check(el, app.invisible_error_fn( set_initial_dimensions))
366
+ if(dimensions){
367
+ var holder = el.holder_data;
368
+ holder.initial_dimensions = dimensions;
369
+ holder.fluid_data = {
370
+ fluid_height: holder.dimensions.height.slice(-1) == "%",
371
+ fluid_width: holder.dimensions.width.slice(-1) == "%",
372
+ mode: null
373
+ }
374
+ if(holder.fluid_data.fluid_width && !holder.fluid_data.fluid_height){
375
+ holder.fluid_data.mode = "width"
376
+ holder.fluid_data.ratio = holder.initial_dimensions.width / parseFloat(holder.dimensions.height)
377
+ }
378
+ else if(!holder.fluid_data.fluid_width && holder.fluid_data.fluid_height){
379
+ holder.fluid_data.mode = "height";
380
+ holder.fluid_data.ratio = parseFloat(holder.dimensions.width) / holder.initial_dimensions.height
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ function resizable_update(element) {
387
+ var images;
388
+ if (element.nodeType == null) {
389
+ images = resizable_images;
390
+ } else {
391
+ images = [element]
392
+ }
393
+ for (var i in images) {
394
+ if (!images.hasOwnProperty(i)) {
395
+ continue;
396
+ }
397
+ var el = images[i]
398
+ if (el.holder_data) {
399
+ var holder = el.holder_data;
400
+ var dimensions = dimension_check(el, app.invisible_error_fn( resizable_update))
401
+ if(dimensions){
402
+ if(holder.fluid){
403
+ if(holder.auto){
404
+ switch(holder.fluid_data.mode){
405
+ case "width":
406
+ dimensions.height = dimensions.width / holder.fluid_data.ratio;
407
+ break;
408
+ case "height":
409
+ dimensions.width = dimensions.height * holder.fluid_data.ratio;
410
+ break;
411
+ }
412
+ }
413
+ el.setAttribute("src", draw({
414
+ ctx: ctx,
415
+ dimensions: dimensions,
416
+ template: holder.theme,
417
+ ratio: ratio,
418
+ holder: holder
419
+ }))
420
+ }
421
+ if(holder.textmode && holder.textmode == "exact"){
422
+ holder.exact_dimensions = dimensions;
423
+ el.setAttribute("src", draw({
424
+ ctx: ctx,
425
+ dimensions: holder.dimensions,
426
+ template: holder.theme,
427
+ ratio: ratio,
428
+ holder: holder
429
+ }))
430
+ }
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ function parse_flags(flags, options) {
437
+ var ret = {
438
+ theme: extend(settings.themes.gray, {})
439
+ };
440
+ var render = false;
441
+ for (var fl = flags.length, j = 0; j < fl; j++) {
442
+ var flag = flags[j];
443
+ if (app.flags.dimensions.match(flag)) {
444
+ render = true;
445
+ ret.dimensions = app.flags.dimensions.output(flag);
446
+ } else if (app.flags.fluid.match(flag)) {
447
+ render = true;
448
+ ret.dimensions = app.flags.fluid.output(flag);
449
+ ret.fluid = true;
450
+ } else if (app.flags.textmode.match(flag)) {
451
+ ret.textmode = app.flags.textmode.output(flag)
452
+ } else if (app.flags.colors.match(flag)) {
453
+ ret.theme = app.flags.colors.output(flag);
454
+ } else if (options.themes[flag]) {
455
+ //If a theme is specified, it will override custom colors
456
+ if(options.themes.hasOwnProperty(flag)){
457
+ ret.theme = extend(options.themes[flag], {});
458
+ }
459
+ } else if (app.flags.font.match(flag)) {
460
+ ret.font = app.flags.font.output(flag);
461
+ } else if (app.flags.auto.match(flag)) {
462
+ ret.auto = true;
463
+ } else if (app.flags.text.match(flag)) {
464
+ ret.text = app.flags.text.output(flag);
465
+ }
466
+ }
467
+ return render ? ret : false;
468
+ }
469
+
470
+ for (var flag in app.flags) {
471
+ if (!app.flags.hasOwnProperty(flag)) continue;
472
+ app.flags[flag].match = function (val) {
473
+ return val.match(this.regex)
474
+ }
475
+ }
476
+
477
+ app.invisible_error_fn = function(fn){
478
+ return function(el){
479
+ if(el.hasAttribute("data-holder-invisible")){
480
+ throw new Error("Holder: invisible placeholder")
481
+ }
482
+ }
483
+ }
484
+
485
+ app.add_theme = function (name, theme) {
486
+ name != null && theme != null && (settings.themes[name] = theme);
487
+ return app;
488
+ };
489
+
490
+ app.add_image = function (src, el) {
491
+ var node = selector(el);
492
+ if (node.length) {
493
+ for (var i = 0, l = node.length; i < l; i++) {
494
+ var img = document.createElement("img")
495
+ img.setAttribute("data-src", src);
496
+ node[i].appendChild(img);
497
+ }
498
+ }
499
+ return app;
500
+ };
501
+
502
+ app.run = function (o) {
503
+
504
+ instance_config = extend({}, system_config)
505
+ preempted = true;
506
+
507
+ var options = extend(settings, o),
508
+ images = [],
509
+ imageNodes = [],
510
+ bgnodes = [];
511
+
512
+ if(options.use_canvas != null && options.use_canvas){
513
+ instance_config.use_canvas = true;
514
+ instance_config.use_svg = false;
515
+ }
516
+
517
+ if (typeof (options.images) == "string") {
518
+ imageNodes = selector(options.images);
519
+ } else if (window.NodeList && options.images instanceof window.NodeList) {
520
+ imageNodes = options.images;
521
+ } else if (window.Node && options.images instanceof window.Node) {
522
+ imageNodes = [options.images];
523
+ } else if(window.HTMLCollection && options.images instanceof window.HTMLCollection){
524
+ imageNodes = options.images
525
+ }
526
+
527
+ if (typeof (options.bgnodes) == "string") {
528
+ bgnodes = selector(options.bgnodes);
529
+ } else if (window.NodeList && options.elements instanceof window.NodeList) {
530
+ bgnodes = options.bgnodes;
531
+ } else if (window.Node && options.bgnodes instanceof window.Node) {
532
+ bgnodes = [options.bgnodes];
533
+ }
534
+ for (i = 0, l = imageNodes.length; i < l; i++) images.push(imageNodes[i]);
535
+
536
+ var holdercss = document.getElementById("holderjs-style");
537
+ if (!holdercss) {
538
+ holdercss = document.createElement("style");
539
+ holdercss.setAttribute("id", "holderjs-style");
540
+ holdercss.type = "text/css";
541
+ document.getElementsByTagName("head")[0].appendChild(holdercss);
542
+ }
543
+
544
+ if (!options.nocss) {
545
+ if (holdercss.styleSheet) {
546
+ holdercss.styleSheet.cssText += options.stylesheet;
547
+ } else {
548
+ if(options.stylesheet.length){
549
+ holdercss.appendChild(document.createTextNode(options.stylesheet));
550
+ }
551
+ }
552
+ }
553
+
554
+ var cssregex = new RegExp(options.domain + "\/(.*?)\"?\\)");
555
+ for (var l = bgnodes.length, i = 0; i < l; i++) {
556
+ var src = window.getComputedStyle(bgnodes[i], null)
557
+ .getPropertyValue("background-image");
558
+ var flags = src.match(cssregex);
559
+ var bgsrc = bgnodes[i].getAttribute("data-background-src");
560
+ if (flags) {
561
+ var holder = parse_flags(flags[1].split("/"), options);
562
+ if (holder) {
563
+ render("background", bgnodes[i], holder, src);
564
+ }
565
+ } else if (bgsrc != null) {
566
+ var holder = parse_flags(bgsrc.substr(bgsrc.lastIndexOf(options.domain) + options.domain.length + 1)
567
+ .split("/"), options);
568
+ if (holder) {
569
+ render("background", bgnodes[i], holder, src);
570
+ }
571
+ }
572
+ }
573
+ for (l = images.length, i = 0; i < l; i++) {
574
+ var attr_data_src, attr_src;
575
+ attr_src = attr_data_src = src = null;
576
+ try {
577
+ attr_src = images[i].getAttribute("src");
578
+ attr_datasrc = images[i].getAttribute("data-src");
579
+ } catch (e) {}
580
+ if (attr_datasrc == null && !! attr_src && attr_src.indexOf(options.domain) >= 0) {
581
+ src = attr_src;
582
+ } else if ( !! attr_datasrc && attr_datasrc.indexOf(options.domain) >= 0) {
583
+ src = attr_datasrc;
584
+ }
585
+ if (src) {
586
+ var holder = parse_flags(src.substr(src.lastIndexOf(options.domain) + options.domain.length + 1).split("/"), options);
587
+ if (holder) {
588
+ if (holder.fluid) {
589
+ render("fluid", images[i], holder, src)
590
+ } else {
591
+ render("image", images[i], holder, src);
592
+ }
593
+ }
594
+ }
595
+ }
596
+ return app;
597
+ };
598
+
599
+ contentLoaded(win, function () {
600
+ if (window.addEventListener) {
601
+ window.addEventListener("resize", resizable_update, false);
602
+ window.addEventListener("orientationchange", resizable_update, false);
603
+ } else {
604
+ window.attachEvent("onresize", resizable_update)
605
+ }
606
+ preempted || app.run({});
607
+
608
+ if (typeof window.Turbolinks === "object") {
609
+ document.addEventListener("page:change", function() { app.run({}) })
610
+ }
611
+ });
612
+ if (typeof define === "function" && define.amd) {
613
+ define([], function () {
614
+ return app;
615
+ });
616
+ }
617
+
618
+ //github.com/davidchambers/Base64.js
619
+ (function(){function t(t){this.message=t}var e="undefined"!=typeof exports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=Error(),t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var o,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-8*(a%1))){if(n=e.charCodeAt(a+=.75),n>255)throw new t("'btoa' failed");o=o<<8|n}return c}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),1==e.length%4)throw new t("'atob' failed");for(var o,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(6&-2*a)):0)n=r.indexOf(n);return c})})();
620
+
621
+ //getElementsByClassName polyfill
622
+ document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i<n.length;i++)r.test(n[i].className)&&s.push(n[i])}return s})
623
+
624
+ //getComputedStyle polyfill
625
+ window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return t=="float"&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this})
626
+
627
+ //http://javascript.nwbox.com/ContentLoaded by Diego Perini with modifications
628
+ function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
629
+
630
+ //https://gist.github.com/991057 by Jed Schmidt with modifications
631
+ function selector(a,b){var a=a.match(/^(\W)?(.*)/),b=b||document,c=b["getElement"+(a[1]?"#"==a[1]?"ById":"sByClassName":"sByTagName")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}
632
+
633
+ //shallow object property extend
634
+ function extend(a,b){
635
+ var c={};
636
+ for(var i in a){
637
+ if(a.hasOwnProperty(i)){
638
+ c[i]=a[i];
639
+ }
640
+ }
641
+ for(var i in b){
642
+ if(b.hasOwnProperty(i)){
643
+ c[i]=b[i];
644
+ }
645
+ }
646
+ return c
647
+ }
648
+
649
+ //hasOwnProperty polyfill
650
+ if (!Object.prototype.hasOwnProperty)
651
+ /*jshint -W001, -W103 */
652
+ Object.prototype.hasOwnProperty = function(prop) {
653
+ var proto = this.__proto__ || this.constructor.prototype;
654
+ return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
655
+ }
656
+ /*jshint +W001, +W103 */
657
+
658
+ })(Holder, window);