static_blocks 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +88 -0
  3. data/Rakefile +33 -0
  4. data/app/assets/javascripts/static_blocks/application.js +17 -0
  5. data/app/assets/javascripts/static_blocks/static_blocks.js +2 -0
  6. data/app/assets/stylesheets/scaffold.css +56 -0
  7. data/app/assets/stylesheets/static_blocks/application.css +13 -0
  8. data/app/assets/stylesheets/static_blocks/static_blocks.css.scss +14 -0
  9. data/app/controllers/static_blocks/application_controller.rb +24 -0
  10. data/app/controllers/static_blocks/static_blocks_controller.rb +88 -0
  11. data/app/helpers/static_blocks/application_helper.rb +4 -0
  12. data/app/helpers/static_blocks/static_blocks_helper.rb +4 -0
  13. data/app/models/static_blocks/static_block.rb +16 -0
  14. data/app/views/layouts/static_blocks/application.html.erb +57 -0
  15. data/app/views/static_blocks/static_blocks/_form.html.erb +29 -0
  16. data/app/views/static_blocks/static_blocks/edit.html.erb +4 -0
  17. data/app/views/static_blocks/static_blocks/index.html.erb +45 -0
  18. data/app/views/static_blocks/static_blocks/new.html.erb +3 -0
  19. data/app/views/static_blocks/static_blocks/show.html.erb +23 -0
  20. data/config/routes.rb +4 -0
  21. data/db/migrate/20130611042319_create_static_blocks_static_blocks.rb +11 -0
  22. data/db/migrate/20130612034816_create_static_block_translations.rb +13 -0
  23. data/lib/generators/install_generator.rb +18 -0
  24. data/lib/static_blocks/engine.rb +36 -0
  25. data/lib/static_blocks/helpers.rb +17 -0
  26. data/lib/static_blocks/version.rb +3 -0
  27. data/lib/static_blocks.rb +6 -0
  28. data/lib/tasks/populate.rake +12 -0
  29. data/lib/tasks/static_blocks_tasks.rake +4 -0
  30. data/lib/templates/static_blocks_config_template.rb +6 -0
  31. data/spec/dummy/README.rdoc +261 -0
  32. data/spec/dummy/Rakefile +7 -0
  33. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  34. data/spec/dummy/app/assets/javascripts/info.js +2 -0
  35. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  36. data/spec/dummy/app/assets/stylesheets/info.css.scss +3 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +19 -0
  38. data/spec/dummy/app/controllers/info_controller.rb +4 -0
  39. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  40. data/spec/dummy/app/helpers/info_helper.rb +2 -0
  41. data/spec/dummy/app/views/info/index.html.erb +16 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/spec/dummy/config/application.rb +59 -0
  44. data/spec/dummy/config/boot.rb +10 -0
  45. data/spec/dummy/config/database.yml +25 -0
  46. data/spec/dummy/config/environment.rb +5 -0
  47. data/spec/dummy/config/environments/development.rb +37 -0
  48. data/spec/dummy/config/environments/production.rb +67 -0
  49. data/spec/dummy/config/environments/test.rb +37 -0
  50. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  51. data/spec/dummy/config/initializers/inflections.rb +15 -0
  52. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  53. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  54. data/spec/dummy/config/initializers/session_store.rb +8 -0
  55. data/spec/dummy/config/initializers/static_blocks.rb +6 -0
  56. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/spec/dummy/config/locales/en.yml +5 -0
  58. data/spec/dummy/config/locales/wk.yml +2 -0
  59. data/spec/dummy/config/routes.rb +14 -0
  60. data/spec/dummy/config.ru +4 -0
  61. data/spec/dummy/db/development.sqlite3 +0 -0
  62. data/spec/dummy/db/migrate/20130611042521_create_static_blocks_static_blocks.static_blocks.rb +12 -0
  63. data/spec/dummy/db/migrate/20130612035223_create_static_block_translations.static_blocks.rb +14 -0
  64. data/spec/dummy/db/schema.rb +35 -0
  65. data/spec/dummy/db/test.sqlite3 +0 -0
  66. data/spec/dummy/log/development.log +61872 -0
  67. data/spec/dummy/log/test.log +9254 -0
  68. data/spec/dummy/public/404.html +26 -0
  69. data/spec/dummy/public/422.html +26 -0
  70. data/spec/dummy/public/500.html +25 -0
  71. data/spec/dummy/public/favicon.ico +0 -0
  72. data/spec/dummy/script/rails +6 -0
  73. data/spec/dummy/tmp/cache/769/300/static_block%3A%3Afoo +1 -0
  74. data/spec/dummy/tmp/cache/assets/C03/2A0/sprockets%2F2c19695a93d05c448f53808347981544 +0 -0
  75. data/spec/dummy/tmp/cache/assets/C40/7B0/sprockets%2Ff01427a1a9625a41079717e522b48c21 +0 -0
  76. data/spec/dummy/tmp/cache/assets/C43/A80/sprockets%2F94596a352d4841586b435699f9838f1d +0 -0
  77. data/spec/dummy/tmp/cache/assets/C4F/B70/sprockets%2Fa7618b479c438355ec218b6a35081361 +0 -0
  78. data/spec/dummy/tmp/cache/assets/C52/CD0/sprockets%2F05f5bfd8319e875420216370307594be +0 -0
  79. data/spec/dummy/tmp/cache/assets/C57/300/sprockets%2F2615d11245c762e27f082087638cd8f7 +0 -0
  80. data/spec/dummy/tmp/cache/assets/C5E/080/sprockets%2F47c55992c35644316a8e0e2c8048b687 +0 -0
  81. data/spec/dummy/tmp/cache/assets/C71/290/sprockets%2F3e5152a8b0665a620e0c8639a0164c82 +0 -0
  82. data/spec/dummy/tmp/cache/assets/C7C/C50/sprockets%2Fb278044170d94414368b7ee7b4314e4a +0 -0
  83. data/spec/dummy/tmp/cache/assets/C80/DF0/sprockets%2F7c8023b375b62805ef332a557207dd96 +0 -0
  84. data/spec/dummy/tmp/cache/assets/C87/620/sprockets%2F3432446e738294254b2a8edee23c7809 +0 -0
  85. data/spec/dummy/tmp/cache/assets/C89/C20/sprockets%2F32dcb5437995ed21393476f6a1d51728 +0 -0
  86. data/spec/dummy/tmp/cache/assets/C90/600/sprockets%2Fd5d3d15976742040862cea796e828c73 +0 -0
  87. data/spec/dummy/tmp/cache/assets/CB4/CE0/sprockets%2F3299a2e34377c16f310e9289c0cf470e +0 -0
  88. data/spec/dummy/tmp/cache/assets/CBD/290/sprockets%2F7941ab3c9bc78f426e20c9095a659329 +0 -0
  89. data/spec/dummy/tmp/cache/assets/CBD/B40/sprockets%2F0a00f98a83686470ee2838ef1c3c8693 +0 -0
  90. data/spec/dummy/tmp/cache/assets/CBF/090/sprockets%2Fb4576076221ea1abb2ecd081025d3026 +0 -0
  91. data/spec/dummy/tmp/cache/assets/CC1/5A0/sprockets%2F880ce77a9b28981a952adc78253d1844 +0 -0
  92. data/spec/dummy/tmp/cache/assets/CC1/ED0/sprockets%2Fa14463bb037619fa57b714120bb5a0c3 +0 -0
  93. data/spec/dummy/tmp/cache/assets/CC6/C10/sprockets%2F6a82e2cb3e9964325cb937155e92679f +0 -0
  94. data/spec/dummy/tmp/cache/assets/CCF/850/sprockets%2F3e49a417d9f9c4087090ff7d9c939482 +0 -0
  95. data/spec/dummy/tmp/cache/assets/CD0/060/sprockets%2F2ea5643654580eb50727bb42fc190c1a +0 -0
  96. data/spec/dummy/tmp/cache/assets/CD0/C00/sprockets%2Ff581e133147c235d2f003a91f18c4b5d +0 -0
  97. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  98. data/spec/dummy/tmp/cache/assets/CDC/C80/sprockets%2F0221b31c67280890e929e5600ddf7fae +0 -0
  99. data/spec/dummy/tmp/cache/assets/CDF/250/sprockets%2F28111ed79a6721f4d8a870571d74e1ac +0 -0
  100. data/spec/dummy/tmp/cache/assets/CE0/A80/sprockets%2Fb14006f874599a0d9cd092b64c18cc90 +0 -0
  101. data/spec/dummy/tmp/cache/assets/CE3/F70/sprockets%2F26eef61af70b3b5416a8fd2928406944 +0 -0
  102. data/spec/dummy/tmp/cache/assets/CE7/C50/sprockets%2F9fa1970f509ab772a4535f7b0ee42378 +0 -0
  103. data/spec/dummy/tmp/cache/assets/CF3/A70/sprockets%2F0055fb67d9cf98a6916a16d758f7b632 +0 -0
  104. data/spec/dummy/tmp/cache/assets/CF5/810/sprockets%2F1e87820b7e288fa1d49739666e5c4ef0 +0 -0
  105. data/spec/dummy/tmp/cache/assets/CF9/720/sprockets%2F8b948daf6bef57f06c78b66966110458 +0 -0
  106. data/spec/dummy/tmp/cache/assets/CFA/870/sprockets%2F98e7068f7261e1abe3e9253c9b4779c8 +0 -0
  107. data/spec/dummy/tmp/cache/assets/CFD/450/sprockets%2F5a1c34baf6a0808107c88ab82a2824e2 +0 -0
  108. data/spec/dummy/tmp/cache/assets/CFD/9F0/sprockets%2F3327ac0f5086d72b0a712c328cb636fa +0 -0
  109. data/spec/dummy/tmp/cache/assets/D00/080/sprockets%2F8e09f98d6161aedd5169d33cf3699686 +0 -0
  110. data/spec/dummy/tmp/cache/assets/D07/100/sprockets%2F64ee117ce583fa61da15d35315a576d1 +0 -0
  111. data/spec/dummy/tmp/cache/assets/D0B/D70/sprockets%2F552e4c8c329a24dc0b0046eac37e5959 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D0D/840/sprockets%2F50e9139381224f7c9baaf6caf404b394 +0 -0
  113. data/spec/dummy/tmp/cache/assets/D11/9D0/sprockets%2F0bd4e6571b02cf9b6b48316e7b72e791 +0 -0
  114. data/spec/dummy/tmp/cache/assets/D18/860/sprockets%2F540c2f958fef569f4a7539c070a6a2e1 +0 -0
  115. data/spec/dummy/tmp/cache/assets/D1A/DF0/sprockets%2F1e85f1a823c6ac486d80965fdc349e14 +0 -0
  116. data/spec/dummy/tmp/cache/assets/D1F/D80/sprockets%2F7438f09ddf022f97525c3eb448f65f3c +0 -0
  117. data/spec/dummy/tmp/cache/assets/D2B/CD0/sprockets%2F76f9b9eefb641d7657a46237287c8df1 +0 -0
  118. data/spec/dummy/tmp/cache/assets/D2F/730/sprockets%2Fcb562b326045b0e0c8ec50f5d82a92f1 +0 -0
  119. data/spec/dummy/tmp/cache/assets/D2F/950/sprockets%2F563c7c80a43c918ab182fbb055ca0d09 +0 -0
  120. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  121. data/spec/dummy/tmp/cache/assets/D34/970/sprockets%2F7085373a4d1111c33ca8b8986e0cacec +0 -0
  122. data/spec/dummy/tmp/cache/assets/D37/640/sprockets%2Faf7183c34069b6d8baf5041d26ff05c1 +0 -0
  123. data/spec/dummy/tmp/cache/assets/D38/CA0/sprockets%2Fb2f67c43ed95cdec381201a1591a5e73 +0 -0
  124. data/spec/dummy/tmp/cache/assets/D3E/630/sprockets%2Fcdb19b1bced9374f844f54376dc43103 +0 -0
  125. data/spec/dummy/tmp/cache/assets/D42/2F0/sprockets%2F77e311e8847d2d5c5254bc51cd2cf8e2 +0 -0
  126. data/spec/dummy/tmp/cache/assets/D44/4C0/sprockets%2F009e4d29a2d937679015a0ddceda89c7 +0 -0
  127. data/spec/dummy/tmp/cache/assets/D46/A90/sprockets%2Fe349870cbccfd6637c4739c04c45af34 +0 -0
  128. data/spec/dummy/tmp/cache/assets/D49/A90/sprockets%2Fc7da9c3c9df8e05520c74c53639a845c +0 -0
  129. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  130. data/spec/dummy/tmp/cache/assets/D50/470/sprockets%2F2bc1690c65d8ffbff84b58e810e63693 +0 -0
  131. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  132. data/spec/dummy/tmp/cache/assets/D5C/3F0/sprockets%2F10bb094cd44ab73b2e31c49618ee7b1b +0 -0
  133. data/spec/dummy/tmp/cache/assets/D5C/6C0/sprockets%2F1ad1dff23bbf7320d2d7fda364555105 +0 -0
  134. data/spec/dummy/tmp/cache/assets/D5C/820/sprockets%2F696c617f9a6df357683eaa0589d95afd +0 -0
  135. data/spec/dummy/tmp/cache/assets/D62/F80/sprockets%2F16a0314243f7d9efc8fbac12224c74fb +0 -0
  136. data/spec/dummy/tmp/cache/assets/D68/BA0/sprockets%2Ff8283b87e207eb7103ae2ac8df2084bb +0 -0
  137. data/spec/dummy/tmp/cache/assets/D6A/D90/sprockets%2Fd425f2ec9668522e6ab25db50e7a2d4b +0 -0
  138. data/spec/dummy/tmp/cache/assets/D6B/5F0/sprockets%2F5e5a089ff23e4b1b5e7071c0b66ff41d +0 -0
  139. data/spec/dummy/tmp/cache/assets/D6D/E40/sprockets%2F96988fa2bc8e98bcf908f897cd4f3582 +0 -0
  140. data/spec/dummy/tmp/cache/assets/D7A/BA0/sprockets%2F7fe8ec92b30b7e2f688c3a91157c5eb3 +0 -0
  141. data/spec/dummy/tmp/cache/assets/D7B/610/sprockets%2Fd93cd9e659b56810ef3ef1fc4052d93b +0 -0
  142. data/spec/dummy/tmp/cache/assets/D80/010/sprockets%2F441ea8159f4442e7dbf499d93faff51c +0 -0
  143. data/spec/dummy/tmp/cache/assets/D83/090/sprockets%2Fa40a252a6e2b0ff86dace14bc38230c4 +0 -0
  144. data/spec/dummy/tmp/cache/assets/D8B/660/sprockets%2F82f06d4bae338af323d10ca53c23e5de +0 -0
  145. data/spec/dummy/tmp/cache/assets/D8C/960/sprockets%2F8c261eb90a4ec2f023bde5d31f628a2a +0 -0
  146. data/spec/dummy/tmp/cache/assets/D96/D10/sprockets%2F7bd1f5ab50fa7984dc3d13841c800ebe +0 -0
  147. data/spec/dummy/tmp/cache/assets/D98/2B0/sprockets%2F5fc3f1cbdd2724729e1ec9538a3acd12 +0 -0
  148. data/spec/dummy/tmp/cache/assets/D99/370/sprockets%2Fc28be70a409478b91da2ead47ba493bd +0 -0
  149. data/spec/dummy/tmp/cache/assets/D9A/7C0/sprockets%2F96f90c2cec66ba0dfcb37b7412e2e912 +0 -0
  150. data/spec/dummy/tmp/cache/assets/D9A/DB0/sprockets%2Fdb4ec6a8fd5fd625823e014e790a00df +0 -0
  151. data/spec/dummy/tmp/cache/assets/DA0/EE0/sprockets%2F4ecacd17cd6b98f67eb104181a841f7d +0 -0
  152. data/spec/dummy/tmp/cache/assets/DA1/C30/sprockets%2F679ced082eeb1816e41b2e07c6bae69c +0 -0
  153. data/spec/dummy/tmp/cache/assets/DA1/F20/sprockets%2F7e3ba0288726eccaf28beab45d695a91 +0 -0
  154. data/spec/dummy/tmp/cache/assets/DA2/820/sprockets%2F9f81de74a49c9eaf25ad2de0d51c7801 +0 -0
  155. data/spec/dummy/tmp/cache/assets/DA9/720/sprockets%2F48daf0816368157bfaeecdc8d6a39f25 +0 -0
  156. data/spec/dummy/tmp/cache/assets/DC9/A10/sprockets%2F160de89fafbd05b8cc47310780cf4ace +0 -0
  157. data/spec/dummy/tmp/cache/assets/DCF/A40/sprockets%2F554e10f5ef3e3c90b2de3ae0f5c886bf +0 -0
  158. data/spec/dummy/tmp/cache/assets/DDA/FB0/sprockets%2F92b4d4f3bc269e36e67f43ed8eb0db5f +0 -0
  159. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  160. data/spec/dummy/tmp/cache/assets/DDF/B10/sprockets%2Fbfb4fe5872d9482cab1f83ee74a499bc +0 -0
  161. data/spec/dummy/tmp/cache/assets/DF5/F30/sprockets%2F2a719aa2678fbbc921b4dca98b21cdfb +0 -0
  162. data/spec/dummy/tmp/cache/assets/DFE/2A0/sprockets%2Fa874cd00fc9abeb66d68908bbf2ee22b +0 -0
  163. data/spec/dummy/tmp/cache/assets/E00/BC0/sprockets%2F5fb79fd146d829debfd0306daabe1d74 +0 -0
  164. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  165. data/spec/dummy/tmp/cache/assets/E29/330/sprockets%2F37aa8f7e3db4c960ac2bce349e5bc1ce +0 -0
  166. data/spec/dummy/tmp/cache/assets/E2A/1C0/sprockets%2Ffae6441e70ce48653dc6fdefcadc01d3 +0 -0
  167. data/spec/dummy/tmp/cache/assets/E3D/850/sprockets%2Fdf71e8b2fb6eeb586657c8b936afaaeb +0 -0
  168. data/spec/dummy/tmp/cache/assets/E58/B30/sprockets%2F9fe3bb87890ca35d6acfaa0ad1fd5eb3 +0 -0
  169. data/spec/dummy/tmp/cache/assets/E6A/D70/sprockets%2F3d7b9d065fb3bee3fbff2d58eeb4a89c +0 -0
  170. data/spec/dummy/tmp/cache/assets/E7E/730/sprockets%2Fabdedbedfdddeb4ae08e143d1026557a +0 -0
  171. data/spec/dummy/tmp/cache/assets/E8B/4D0/sprockets%2Fedb0cb7f93abec7e5f5bf1ade2490be6 +0 -0
  172. data/spec/dummy/tmp/cache/assets/EB3/7B0/sprockets%2F51dabbc2ed9b98e08dc4bf5aba5aad6d +0 -0
  173. data/spec/dummy/tmp/cache/sass/4f0ce0b83bd09d93536268da405600ef1b98018d/bootstrap.scssc +0 -0
  174. data/spec/dummy/tmp/cache/sass/539156597b6c6280022503b5a967d95c6f1abc4c/static_blocks.css.scssc +0 -0
  175. data/spec/dummy/tmp/cache/sass/956b3763d4c52184978e8e3b49a9eb5d80253bf7/bootstrap.scssc +0 -0
  176. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_accordion.scssc +0 -0
  177. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_alerts.scssc +0 -0
  178. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_breadcrumbs.scssc +0 -0
  179. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_button-groups.scssc +0 -0
  180. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_buttons.scssc +0 -0
  181. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_carousel.scssc +0 -0
  182. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_close.scssc +0 -0
  183. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_code.scssc +0 -0
  184. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_component-animations.scssc +0 -0
  185. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_dropdowns.scssc +0 -0
  186. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_forms.scssc +0 -0
  187. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_grid.scssc +0 -0
  188. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_hero-unit.scssc +0 -0
  189. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_labels-badges.scssc +0 -0
  190. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_layouts.scssc +0 -0
  191. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_media.scssc +0 -0
  192. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_mixins.scssc +0 -0
  193. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_modals.scssc +0 -0
  194. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_navbar.scssc +0 -0
  195. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_navs.scssc +0 -0
  196. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_pager.scssc +0 -0
  197. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_pagination.scssc +0 -0
  198. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_popovers.scssc +0 -0
  199. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_progress-bars.scssc +0 -0
  200. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_reset.scssc +0 -0
  201. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_scaffolding.scssc +0 -0
  202. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_sprites.scssc +0 -0
  203. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_tables.scssc +0 -0
  204. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_thumbnails.scssc +0 -0
  205. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_tooltip.scssc +0 -0
  206. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_type.scssc +0 -0
  207. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_utilities.scssc +0 -0
  208. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_variables.scssc +0 -0
  209. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/_wells.scssc +0 -0
  210. data/spec/dummy/tmp/cache/sass/a65a94b6445e42c04c4572af485c41f8c586032f/bootstrap.scssc +0 -0
  211. data/spec/dummy/tmp/cache/sass/c406acb89bd590cc76375f46baeadeb0ce5cba8e/info.css.scssc +0 -0
  212. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_accordion.scssc +0 -0
  213. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_alerts.scssc +0 -0
  214. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_breadcrumbs.scssc +0 -0
  215. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_button-groups.scssc +0 -0
  216. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_buttons.scssc +0 -0
  217. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_carousel.scssc +0 -0
  218. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_close.scssc +0 -0
  219. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_code.scssc +0 -0
  220. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_component-animations.scssc +0 -0
  221. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_dropdowns.scssc +0 -0
  222. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_forms.scssc +0 -0
  223. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_grid.scssc +0 -0
  224. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_hero-unit.scssc +0 -0
  225. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_labels-badges.scssc +0 -0
  226. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_layouts.scssc +0 -0
  227. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_media.scssc +0 -0
  228. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_mixins.scssc +0 -0
  229. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_modals.scssc +0 -0
  230. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_navbar.scssc +0 -0
  231. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_navs.scssc +0 -0
  232. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_pager.scssc +0 -0
  233. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_pagination.scssc +0 -0
  234. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_popovers.scssc +0 -0
  235. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_progress-bars.scssc +0 -0
  236. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_reset.scssc +0 -0
  237. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_scaffolding.scssc +0 -0
  238. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_sprites.scssc +0 -0
  239. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_tables.scssc +0 -0
  240. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_thumbnails.scssc +0 -0
  241. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_tooltip.scssc +0 -0
  242. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_type.scssc +0 -0
  243. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_utilities.scssc +0 -0
  244. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_variables.scssc +0 -0
  245. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/_wells.scssc +0 -0
  246. data/spec/dummy/tmp/cache/sass/cec3b0e976607689afac1fc85095e1fdcb40263a/bootstrap.scssc +0 -0
  247. data/spec/dummy/tmp/capybara/capybara-201306231456094410600944.html +73 -0
  248. data/spec/dummy/tmp/capybara/capybara-20130623151435523273444.html +73 -0
  249. data/spec/helpers/static_blocks_helper_spec.rb +13 -0
  250. data/spec/integration/static_blocks_spec.rb +68 -0
  251. data/spec/models/static_block_spec.rb +13 -0
  252. data/spec/spec_helper.rb +14 -0
  253. data/spec/support/capybara.rb +8 -0
  254. metadata +762 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # Static Blocks
2
+
3
+ Static Blocks is an ultra light-weight CMS for Ruby on Rails. Create static blocks of content. Place them anywhere in your views.
4
+
5
+ ## Features
6
+ * Simple admin interface
7
+ * i18n internationalization support
8
+ * Optional http basic authentication
9
+ * Search
10
+ * wysihtml5 editor
11
+
12
+ ## Installation
13
+
14
+ Add the following to Gemfile:
15
+
16
+ ```ruby
17
+ gem 'static_blocks'
18
+ ```
19
+
20
+ Run bundle from shell:
21
+
22
+ ```shell
23
+ bundle install
24
+ ```
25
+
26
+ Run static blocks install generator from shell:
27
+
28
+ ```shell
29
+ rails generate static_blocks:install
30
+ ```
31
+
32
+ Run migrations:
33
+
34
+ ```shell
35
+ rake db:migrate
36
+ ```
37
+
38
+ Mount engine in routes.rb:
39
+
40
+ ```ruby
41
+ mount StaticBlocks::Engine => "/static_blocks_admin"
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ Visit `/static_blocks_admin` and create some static blocks.
47
+
48
+ Use the `static_block_for` method or it's alias `s` to output a block onto any view template. Pass in the title of the static block as argument. Use `raw` if you do not want to escape the html.
49
+
50
+ ```
51
+ <%=raw static_block_for('foo') %>
52
+ <%=raw s('foo') %>
53
+ ```
54
+
55
+ ## Configuration
56
+
57
+ When you ran the install generator, a configuration file should have been created in config/initializers/static_blocks.rb:
58
+
59
+ ```ruby
60
+ StaticBlocks.config do |config|
61
+ config.locales = ['en']
62
+ config.http_auth = false
63
+ config.username = ENV['STATIC_BLOCKS_USERNAME']
64
+ config.password = ENV['STATIC_BLOCKS_PASSWORD']
65
+ end
66
+ ```
67
+
68
+ ### i18n Internationalization
69
+
70
+ Static Blocks supports i18n internationalization. Pass in an array of locales to it's config option:
71
+
72
+ ```ruby
73
+ config.locales = ['en', 'wk', 'zh', 'pirate']
74
+ ```
75
+
76
+ ### Optional http basic authentication
77
+
78
+ Static Blocks has an optional http basic authentication which is turned off by default. To activate, set the config option to true and create environment variables for the username and password.
79
+
80
+ ```ruby
81
+ config.http_auth = true
82
+ ```
83
+
84
+ ## Credits
85
+ Written by Travis Luong
86
+
87
+ ## License
88
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'StaticBlocks'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec)
32
+
33
+ task :default => :spec
@@ -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_tree .
16
+ //= require bootstrap
17
+ //= require bootstrap-wysihtml5
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,14 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ *= require bootstrap-wysihtml5
5
+ */
6
+ @import "bootstrap";
7
+
8
+ .wysihtml5 {
9
+ width: 100%;
10
+ }
11
+
12
+ .navbar .container {
13
+ width: 940px;
14
+ }
@@ -0,0 +1,24 @@
1
+ module StaticBlocks
2
+ class ApplicationController < ActionController::Base
3
+
4
+ if StaticBlocks.config.http_auth
5
+ http_basic_authenticate_with :name => StaticBlocks.config.username, :password => StaticBlocks.config.password
6
+ end
7
+
8
+ before_filter :set_locale
9
+
10
+ private
11
+
12
+ def set_locale
13
+ I18n.locale = params[:locale] if params[:locale].present?
14
+ # current_user.locale
15
+ # request.subdomain
16
+ # request.env["HTTP_ACCEPT_LANGUAGE"]
17
+ # request.remote_ip
18
+ end
19
+
20
+ def default_url_options(options = {})
21
+ {locale: I18n.locale}
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,88 @@
1
+ require_dependency "static_blocks/application_controller"
2
+
3
+ module StaticBlocks
4
+ class StaticBlocksController < ApplicationController
5
+ # GET /static_blocks
6
+ # GET /static_blocks.json
7
+ def index
8
+ @search = StaticBlock.search(params[:q])
9
+ @static_blocks = @search.result.page(params[:page]).per(10)
10
+
11
+ respond_to do |format|
12
+ format.html # index.html.erb
13
+ format.json { render json: @static_blocks }
14
+ end
15
+ end
16
+
17
+ # GET /static_blocks/1
18
+ # GET /static_blocks/1.json
19
+ def show
20
+ @static_block = StaticBlock.find(params[:id])
21
+
22
+ respond_to do |format|
23
+ format.html # show.html.erb
24
+ format.json { render json: @static_block }
25
+ end
26
+ end
27
+
28
+ # GET /static_blocks/new
29
+ # GET /static_blocks/new.json
30
+ def new
31
+ @static_block = StaticBlock.new
32
+
33
+ respond_to do |format|
34
+ format.html # new.html.erb
35
+ format.json { render json: @static_block }
36
+ end
37
+ end
38
+
39
+ # GET /static_blocks/1/edit
40
+ def edit
41
+ @static_block = StaticBlock.find(params[:id])
42
+ end
43
+
44
+ # POST /static_blocks
45
+ # POST /static_blocks.json
46
+ def create
47
+ @static_block = StaticBlock.new(params[:static_block])
48
+
49
+ respond_to do |format|
50
+ if @static_block.save
51
+ format.html { redirect_to @static_block, notice: 'Static block was successfully created.' }
52
+ format.json { render json: @static_block, status: :created, location: @static_block }
53
+ else
54
+ format.html { render action: "new" }
55
+ format.json { render json: @static_block.errors, status: :unprocessable_entity }
56
+ end
57
+ end
58
+ end
59
+
60
+ # PUT /static_blocks/1
61
+ # PUT /static_blocks/1.json
62
+ def update
63
+ @static_block = StaticBlock.find(params[:id])
64
+
65
+ respond_to do |format|
66
+ if @static_block.update_attributes(params[:static_block])
67
+ format.html { redirect_to @static_block, notice: 'Static block was successfully updated.' }
68
+ format.json { head :no_content }
69
+ else
70
+ format.html { render action: "edit" }
71
+ format.json { render json: @static_block.errors, status: :unprocessable_entity }
72
+ end
73
+ end
74
+ end
75
+
76
+ # DELETE /static_blocks/1
77
+ # DELETE /static_blocks/1.json
78
+ def destroy
79
+ @static_block = StaticBlock.find(params[:id])
80
+ @static_block.destroy
81
+
82
+ respond_to do |format|
83
+ format.html { redirect_to static_blocks_url }
84
+ format.json { head :no_content }
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,4 @@
1
+ module StaticBlocks
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module StaticBlocks
2
+ module StaticBlocksHelper
3
+ end
4
+ end
@@ -0,0 +1,16 @@
1
+ module StaticBlocks
2
+ class StaticBlock < ActiveRecord::Base
3
+ attr_accessible :content, :status, :title
4
+ after_save :clear_cache
5
+ scope :published, where(:status => 'published')
6
+ translates :content
7
+
8
+ def to_s
9
+ content
10
+ end
11
+
12
+ def clear_cache
13
+ Rails.cache.delete("static_block::"+title)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>StaticBlocks</title>
5
+ <%= stylesheet_link_tag "static_blocks/application", :media => "all" %>
6
+ <%= javascript_include_tag "static_blocks/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <div class="navbar">
12
+ <div class="navbar-inner">
13
+ <div class="container">
14
+ <%= link_to "Static Blocks", static_blocks_path, :class => "brand" %>
15
+ <div class="nav-collapse collapse">
16
+ <ul class="nav pull-right">
17
+ <li><%= link_to "List", static_blocks_path %></li>
18
+ <li><%= link_to "New", new_static_block_path %></li>
19
+ </ul>
20
+ </div><!--/.nav-collapse -->
21
+ </div>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="container">
26
+
27
+ <% flash.each do |name, msg| %>
28
+ <% if msg.is_a?(String) %>
29
+ <div class="alert alert-<%= name == :notice ? "success" : "error" %>">
30
+ <a class="close" data-dismiss="alert">&#215;</a>
31
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
32
+ </div>
33
+ <% end %>
34
+ <% end %>
35
+
36
+ <div id="locale">
37
+ Language
38
+
39
+ <% StaticBlocks.config.locales.each do |loc| %>
40
+ <%= link_to_unless_current loc, locale: loc %>
41
+ <% end %>
42
+ </div>
43
+
44
+ <%= yield %>
45
+
46
+ </div>
47
+
48
+ <script type="text/javascript">
49
+ $('.wysihtml5').each(function(i, elem) {
50
+ $(elem).wysihtml5({
51
+ html: true
52
+ });
53
+ });
54
+ </script>
55
+
56
+ </body>
57
+ </html>
@@ -0,0 +1,29 @@
1
+ <%= form_for(@static_block) do |f| %>
2
+ <% if @static_block.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@static_block.errors.count, "error") %> prohibited this static_block from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @static_block.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %>
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :content %>
20
+ <%= f.text_area :content, :class => 'wysihtml5' %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :status %>
24
+ <%= f.select(:status, [['Draft', 'draft'], ['Published', 'published']]) %>
25
+ </div>
26
+ <div class="actions">
27
+ <%= f.submit 'Submit', class: "btn btn-primary" %>
28
+ </div>
29
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <h1>Editing static block</h1>
2
+
3
+ <%= render 'form' %>
4
+
@@ -0,0 +1,45 @@
1
+ <h1>Listing static blocks</h1>
2
+
3
+ <div class="well">
4
+ <%= search_form_for @search do |f| %>
5
+ <div class="field">
6
+ <%= f.label :title_cont, "Title contains" %>
7
+ <%= f.text_field :title_cont %>
8
+ </div>
9
+ <div class="field">
10
+ <%= f.label :content_cont, "Content contains" %>
11
+ <%= f.text_field :content_cont %>
12
+ </div>
13
+ <div class="field">
14
+ <%= f.label :status_cont, "Status contains" %>
15
+ <%= f.select(:status_cont, [['', ''], ['Draft', 'draft'], ['Published', 'published']]) %>
16
+ </div>
17
+ <div class="actions"><%= f.submit "Search" %></div>
18
+ <% end %>
19
+ </div>
20
+
21
+ <%= paginate @static_blocks, :theme => 'twitter-bootstrap' %>
22
+
23
+ <table id="static-block-list" class="table table-striped">
24
+ <tr>
25
+ <th style="min-width: 60px;"><%= sort_link(@search, :title, "Title") %></th>
26
+ <th><%= sort_link(@search, :content, "Content") %></th>
27
+ <th style="min-width: 80px;"><%= sort_link(@search, :status, "Status") %></th>
28
+ <th></th>
29
+ <th></th>
30
+ <th></th>
31
+ </tr>
32
+
33
+ <% @static_blocks.each do |static_block| %>
34
+ <tr>
35
+ <td><%= static_block.title %></td>
36
+ <td><%= static_block.content %></td>
37
+ <td><%= static_block.status %></td>
38
+ <td><%= link_to 'Show', static_block_path(static_block), class: "btn btn-mini btn-success" %></td>
39
+ <td><%= link_to 'Edit', edit_static_block_path(static_block), class: "btn btn-mini btn-warning" %></td>
40
+ <td><%= link_to 'Destroy', static_block, class: "btn btn-mini btn-danger", method: :delete, data: { confirm: 'Are you sure?' } %></td>
41
+ </tr>
42
+ <% end %>
43
+ </table>
44
+
45
+ <%= paginate @static_blocks, :theme => 'twitter-bootstrap' %>
@@ -0,0 +1,3 @@
1
+ <h1>New static block</h1>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,23 @@
1
+ <h1>Showing Static Block</h1>
2
+
3
+ <div>
4
+ <p>
5
+ <b>Title:</b>
6
+ <%= @static_block.title %>
7
+ </p>
8
+
9
+ <p>
10
+ <b>Status:</b>
11
+ <%= @static_block.status %>
12
+ </p>
13
+
14
+ <p>
15
+ <%= link_to 'Edit', edit_static_block_path(@static_block), class: "btn btn-primary btn-warning" %>
16
+ </p>
17
+ </div>
18
+
19
+ <hr>
20
+
21
+ <div class="well">
22
+ <%= raw(@static_block.content) %>
23
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ StaticBlocks::Engine.routes.draw do
2
+ resources :static_blocks
3
+ root to: 'static_blocks#index'
4
+ end
@@ -0,0 +1,11 @@
1
+ class CreateStaticBlocksStaticBlocks < ActiveRecord::Migration
2
+ def change
3
+ create_table :static_blocks_static_blocks do |t|
4
+ t.string :title
5
+ t.text :content
6
+ t.string :status
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateStaticBlockTranslations < ActiveRecord::Migration
2
+ def up
3
+ StaticBlocks::StaticBlock.create_translation_table!({
4
+ content: :text
5
+ }, {
6
+ migrate_data: true
7
+ })
8
+ end
9
+
10
+ def down
11
+ StaticBlock.drop_translation_table! migrate_data: true
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ require 'rails/generators'
2
+
3
+ module StaticBlocks
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path("../../templates", __FILE__)
8
+
9
+ def copy_static_blocks_config
10
+ copy_file "static_blocks_config_template.rb", "config/initializers/static_block.rb"
11
+ end
12
+
13
+ def copy_migrations
14
+ rake('static_blocks:install:migrations')
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,36 @@
1
+ require "jquery-rails"
2
+ require "sass-rails"
3
+ require "bootstrap-sass"
4
+ require "bootstrap-wysihtml5-rails"
5
+ require "ransack"
6
+ require "kaminari"
7
+ require "bootstrap-kaminari-views"
8
+ require "globalize3"
9
+
10
+ module StaticBlocks
11
+ class Engine < ::Rails::Engine
12
+ isolate_namespace StaticBlocks
13
+ config.generators.integration_tool :rspec
14
+ config.generators.test_framework :rspec
15
+
16
+ initializer "static_blocks.include_helpers" do
17
+ ActiveSupport.on_load(:action_controller) do
18
+ helper StaticBlocks::StaticBlocksHelper
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.config(&block)
24
+ unless defined? @@config
25
+ @@config ||= StaticBlocks::Engine::Configuration.new
26
+ @@config.locales = ['en']
27
+ @@config.http_auth = false
28
+ @@config.username = "admin"
29
+ @@config.password = "password"
30
+ end
31
+
32
+ yield @@config if block
33
+
34
+ return @@config
35
+ end
36
+ end
@@ -0,0 +1,17 @@
1
+ module StaticBlocks
2
+ module StaticBlocksHelper
3
+ def static_block_for(name, default = nil)
4
+ Rails.cache.fetch("static_block::"+name.to_s) do
5
+ StaticBlock.published.find_by_title(name.to_s).content || default || "StaticBlock for #{name.to_s} missing"
6
+ end
7
+ end
8
+
9
+ def static_block_published?(name)
10
+ Rails.cache.fetch("static_block::"+name.to_s) do
11
+ StaticBlock.published.find_by_title(name.to_s) || false
12
+ end
13
+ end
14
+
15
+ alias_method :s, :static_block_for
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module StaticBlocks
2
+ VERSION = "0.0.1"
3
+ end