o_cms 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (333) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -4
  3. data/app/controllers/o_cms/application_controller.rb +0 -13
  4. data/app/controllers/o_cms/dashboard_controller.rb +0 -1
  5. data/app/controllers/o_cms/pages_controller.rb +3 -1
  6. data/app/controllers/o_cms/templates_controller.rb +65 -0
  7. data/app/helpers/o_cms/exists_helper.rb +19 -0
  8. data/app/models/o_cms/category.rb +1 -1
  9. data/app/models/o_cms/gallery.rb +2 -2
  10. data/app/models/o_cms/image.rb +2 -2
  11. data/app/models/o_cms/page.rb +5 -1
  12. data/app/models/o_cms/post.rb +2 -2
  13. data/app/models/o_cms/template.rb +15 -0
  14. data/app/uploaders/o_cms/image_uploader.rb +1 -2
  15. data/app/views/layouts/o_cms/application.html.erb +2 -0
  16. data/app/views/o_cms/galleries/_form.html.erb +1 -0
  17. data/app/views/o_cms/pages/_form.html.erb +15 -0
  18. data/app/views/o_cms/pages/_navigation.html.erb +1 -0
  19. data/app/views/o_cms/pages/_page_row.html.erb +5 -1
  20. data/app/views/o_cms/pages/index.html.erb +1 -0
  21. data/app/views/o_cms/partials/_primary_navigation.html.erb +2 -2
  22. data/app/views/o_cms/posts/_form.html.erb +10 -9
  23. data/app/views/o_cms/templates/_form.html.erb +36 -0
  24. data/app/views/o_cms/templates/_guidelines.html.erb +6 -0
  25. data/app/views/o_cms/templates/_navigation.html.erb +8 -0
  26. data/app/views/o_cms/templates/edit.html.erb +17 -0
  27. data/app/views/o_cms/templates/index.html.erb +28 -0
  28. data/app/views/o_cms/templates/new.html.erb +12 -0
  29. data/config/routes.rb +1 -0
  30. data/db/migrate/20161111160543_create_o_cms_templates.rb +11 -0
  31. data/db/migrate/20161202155453_add_slug_to_template.rb +5 -0
  32. data/db/migrate/20161202173341_add_template_to_page.rb +5 -0
  33. data/lib/o_cms.rb +1 -0
  34. data/lib/o_cms/engine.rb +2 -0
  35. data/lib/o_cms/version.rb +1 -1
  36. data/spec/controllers/o_cms/templates_controller_spec.rb +103 -0
  37. data/spec/dummy/rails-4/Gemfile.lock +3 -1
  38. data/spec/dummy/rails-4/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/rails-4/db/schema.rb +61 -52
  40. data/spec/dummy/rails-4/db/seeds.rb +13 -0
  41. data/spec/dummy/rails-4/log/development.log +4382 -0
  42. data/spec/dummy/rails-4/log/test.log +20227 -0
  43. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/admin_thumb_mountains.jpg +0 -0
  44. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/featured_mountains.jpg +0 -0
  45. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/large_mountains.jpg +0 -0
  46. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/medium_mountains.jpg +0 -0
  47. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/mountains.jpg +0 -0
  48. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/special_mountains.jpg +0 -0
  49. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/thumb_mountains.jpg +0 -0
  50. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/admin_thumb_forest.jpg +0 -0
  51. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/featured_forest.jpg +0 -0
  52. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/forest.jpg +0 -0
  53. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/large_forest.jpg +0 -0
  54. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/medium_forest.jpg +0 -0
  55. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/special_forest.jpg +0 -0
  56. data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/thumb_forest.jpg +0 -0
  57. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/admin_thumb_mountains.jpg +0 -0
  58. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/featured_mountains.jpg +0 -0
  59. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/large_mountains.jpg +0 -0
  60. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/medium_mountains.jpg +0 -0
  61. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/mountains.jpg +0 -0
  62. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/special_mountains.jpg +0 -0
  63. data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/thumb_mountains.jpg +0 -0
  64. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/admin_thumb_forest.jpg +0 -0
  65. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/featured_forest.jpg +0 -0
  66. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/forest.jpg +0 -0
  67. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/large_forest.jpg +0 -0
  68. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/medium_forest.jpg +0 -0
  69. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/special_forest.jpg +0 -0
  70. data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/thumb_forest.jpg +0 -0
  71. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/3O/3ODiJia5uMdFDmF3jD7dDNl18V7UDtLqk1bJWIyb2hA.cache +0 -0
  72. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/6j/6j51C6oILM3kf_OLy0sZPQWPxAmY_swD6073ZQnSltc.cache +0 -0
  73. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
  74. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/9n/9nrZYiz77mMjREZsuNa1LR_i53vYpy6pFEocU-0Dn2Y.cache +1 -0
  75. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Id/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
  76. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/L7/L7EMkGUhsoIfp33TrJw6IANmeUFvtfbRuENNCAAcMPM.cache +1 -0
  77. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/NC/NCREnyp3EHQK36sy07nJb8wDI0_B0tIOdvnF2EJNJmc.cache +0 -0
  78. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/WK/WKTCAoxqB14qN8_qfpCDiT2EllrI8BPHhQspRB1NzDQ.cache +0 -0
  79. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Yi/YiYrVpyqeG3NAPMrjAV6O9MKYBRWbIYDeMXR3i0ZtfM.cache +0 -0
  80. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Yj/Yj7WDyKLMi0jZA1UG55D8McpMT8nYMSvILy1OZLUh8M.cache +0 -0
  81. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
  82. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/_X/_XbOeLAejerFz9INoJxTvgGJme0oKpidBMFC7AIDVIQ.cache +0 -0
  83. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +0 -0
  84. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/e_/e_lYJn8nZRO1qRk5nXU2khhOCJ2TjUHV_yaaqGH_xUY.cache +1 -0
  85. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/jg/jghI9nA5xPB0SMqWt7hcEZj9-o6zm570d3jAgyUQfMg.cache +0 -0
  86. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/sG/sGOK7uaA4LNbhBwgSjt9NaFgH-dC7OHrTPdRuE9FLcU.cache +1 -0
  87. data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
  88. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
  89. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/BC/BCn-1KhRagx9rrC2MOvvFXShkg9xq-K5y8ZZ3KoEZzI.cache +1 -0
  90. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Ci/CiGGJ3nuYKA44MYCyg3Js9eUoYzCNfXIc6MvQGAQQuo.cache +1 -0
  91. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/FD/FDw8AeDYoohmI5mc6_nZDUeLshWadeyZ4JlmBxmpKPc.cache +1 -0
  92. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Kp/Kpyn_0WoI_vLbX7XO5OoSop9ZdL4BsioZdfEozaaDVs.cache +1 -0
  93. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/TS/tS1YS0Z4WSkEV2cgLTJqjw42Vvq81w-Q3JOwc8URZkQ.cache +0 -0
  94. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Th/thZZaQ5hR4Poohuh6JsckWmlMdJkOj4-hNzPtgiJIyE.cache +1 -0
  95. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Zc/ZcQpqZaNfy6qdgRhVrCV44lNwdrATuvXKVezBHItl6s.cache +1 -0
  96. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/_3/_3b9ohkJWbTdvGbCgcCzB2FmhDQ2I_UKa728vsNx9VI.cache +0 -0
  97. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
  98. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +2 -0
  99. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/fv/fVcs0JTcc_0A5xQfYFinHTKJl5OjEl3x1NesAhQ-2D4.cache +1 -0
  100. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/iD/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
  101. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/jY/JyzE42rgit3u3fozfbqEOyqGosU2M7wVmnpdElPBN9w.cache +1 -0
  102. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/ob/ObBiEJuavfJmEKRg5rdOjOy4olYyX4FmP7nfVg7z40U.cache +0 -0
  103. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/qt/qtTSJz3rNzxqtYYate2XSD7iy5Z8o72Ij2LejUj0rp4.cache +2 -0
  104. data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
  105. data/spec/dummy/rails-5/Gemfile.lock +3 -1
  106. data/spec/dummy/rails-5/app/helpers/application_helper.rb +2 -0
  107. data/spec/dummy/rails-5/db/development.sqlite3 +0 -0
  108. data/spec/dummy/rails-5/db/schema.rb +11 -1
  109. data/spec/dummy/rails-5/db/seeds.rb +12 -0
  110. data/spec/dummy/rails-5/db/test.sqlite3 +0 -0
  111. data/spec/dummy/rails-5/log/development.log +21315 -0
  112. data/spec/dummy/rails-5/log/test.log +198530 -0
  113. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/admin_thumb_mountains.jpg +0 -0
  114. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/featured_mountains.jpg +0 -0
  115. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/large_mountains.jpg +0 -0
  116. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/medium_mountains.jpg +0 -0
  117. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/mountains.jpg +0 -0
  118. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/special_mountains.jpg +0 -0
  119. data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/thumb_mountains.jpg +0 -0
  120. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/admin_thumb_forest.jpg +0 -0
  121. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/featured_forest.jpg +0 -0
  122. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/forest.jpg +0 -0
  123. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/large_forest.jpg +0 -0
  124. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/medium_forest.jpg +0 -0
  125. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/special_forest.jpg +0 -0
  126. data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/thumb_forest.jpg +0 -0
  127. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/admin_thumb_mountains.jpg +0 -0
  128. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/featured_mountains.jpg +0 -0
  129. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/large_mountains.jpg +0 -0
  130. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/medium_mountains.jpg +0 -0
  131. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/mountains.jpg +0 -0
  132. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/special_mountains.jpg +0 -0
  133. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/thumb_mountains.jpg +0 -0
  134. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/admin_thumb_forest.jpg +0 -0
  135. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/featured_forest.jpg +0 -0
  136. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/forest.jpg +0 -0
  137. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/large_forest.jpg +0 -0
  138. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/medium_forest.jpg +0 -0
  139. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/special_forest.jpg +0 -0
  140. data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/thumb_forest.jpg +0 -0
  141. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/admin_thumb_mountains.jpg +0 -0
  142. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/featured_mountains.jpg +0 -0
  143. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/large_mountains.jpg +0 -0
  144. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/medium_mountains.jpg +0 -0
  145. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/mountains.jpg +0 -0
  146. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/special_mountains.jpg +0 -0
  147. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/thumb_mountains.jpg +0 -0
  148. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/admin_thumb_forest.jpg +0 -0
  149. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/featured_forest.jpg +0 -0
  150. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/forest.jpg +0 -0
  151. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/large_forest.jpg +0 -0
  152. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/medium_forest.jpg +0 -0
  153. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/special_forest.jpg +0 -0
  154. data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/thumb_forest.jpg +0 -0
  155. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/admin_thumb_mountains.jpg +0 -0
  156. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/featured_mountains.jpg +0 -0
  157. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/large_mountains.jpg +0 -0
  158. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/medium_mountains.jpg +0 -0
  159. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/mountains.jpg +0 -0
  160. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/special_mountains.jpg +0 -0
  161. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/thumb_mountains.jpg +0 -0
  162. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/admin_thumb_forest.jpg +0 -0
  163. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/featured_forest.jpg +0 -0
  164. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/forest.jpg +0 -0
  165. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/large_forest.jpg +0 -0
  166. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/medium_forest.jpg +0 -0
  167. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/special_forest.jpg +0 -0
  168. data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/thumb_forest.jpg +0 -0
  169. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/admin_thumb_mountains.jpg +0 -0
  170. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/featured_mountains.jpg +0 -0
  171. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/large_mountains.jpg +0 -0
  172. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/medium_mountains.jpg +0 -0
  173. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/mountains.jpg +0 -0
  174. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/special_mountains.jpg +0 -0
  175. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/thumb_mountains.jpg +0 -0
  176. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/admin_thumb_forest.jpg +0 -0
  177. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/featured_forest.jpg +0 -0
  178. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/forest.jpg +0 -0
  179. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/large_forest.jpg +0 -0
  180. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/medium_forest.jpg +0 -0
  181. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/special_forest.jpg +0 -0
  182. data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/thumb_forest.jpg +0 -0
  183. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/admin_thumb_mountains.jpg +0 -0
  184. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/featured_mountains.jpg +0 -0
  185. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/large_mountains.jpg +0 -0
  186. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/medium_mountains.jpg +0 -0
  187. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/mountains.jpg +0 -0
  188. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/special_mountains.jpg +0 -0
  189. data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/thumb_mountains.jpg +0 -0
  190. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/admin_thumb_forest.jpg +0 -0
  191. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/featured_forest.jpg +0 -0
  192. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/forest.jpg +0 -0
  193. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/large_forest.jpg +0 -0
  194. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/medium_forest.jpg +0 -0
  195. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/special_forest.jpg +0 -0
  196. data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/thumb_forest.jpg +0 -0
  197. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/admin_thumb_mountains.jpg +0 -0
  198. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/featured_mountains.jpg +0 -0
  199. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/large_mountains.jpg +0 -0
  200. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/medium_mountains.jpg +0 -0
  201. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/mountains.jpg +0 -0
  202. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/special_mountains.jpg +0 -0
  203. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/thumb_mountains.jpg +0 -0
  204. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/admin_thumb_forest.jpg +0 -0
  205. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/featured_forest.jpg +0 -0
  206. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/forest.jpg +0 -0
  207. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/large_forest.jpg +0 -0
  208. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/medium_forest.jpg +0 -0
  209. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/special_forest.jpg +0 -0
  210. data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/thumb_forest.jpg +0 -0
  211. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/admin_thumb_mountains.jpg +0 -0
  212. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/featured_mountains.jpg +0 -0
  213. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/large_mountains.jpg +0 -0
  214. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/medium_mountains.jpg +0 -0
  215. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/mountains.jpg +0 -0
  216. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/special_mountains.jpg +0 -0
  217. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/thumb_mountains.jpg +0 -0
  218. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/admin_thumb_forest.jpg +0 -0
  219. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/featured_forest.jpg +0 -0
  220. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/forest.jpg +0 -0
  221. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/large_forest.jpg +0 -0
  222. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/medium_forest.jpg +0 -0
  223. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/special_forest.jpg +0 -0
  224. data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/thumb_forest.jpg +0 -0
  225. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/admin_thumb_mountains.jpg +0 -0
  226. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/featured_mountains.jpg +0 -0
  227. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/large_mountains.jpg +0 -0
  228. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/medium_mountains.jpg +0 -0
  229. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/mountains.jpg +0 -0
  230. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/special_mountains.jpg +0 -0
  231. data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/thumb_mountains.jpg +0 -0
  232. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/admin_thumb_forest.jpg +0 -0
  233. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/featured_forest.jpg +0 -0
  234. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/forest.jpg +0 -0
  235. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/large_forest.jpg +0 -0
  236. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/medium_forest.jpg +0 -0
  237. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/special_forest.jpg +0 -0
  238. data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/thumb_forest.jpg +0 -0
  239. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/admin_thumb_mountains.jpg +0 -0
  240. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/featured_mountains.jpg +0 -0
  241. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/large_mountains.jpg +0 -0
  242. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/medium_mountains.jpg +0 -0
  243. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/mountains.jpg +0 -0
  244. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/special_mountains.jpg +0 -0
  245. data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/thumb_mountains.jpg +0 -0
  246. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/admin_thumb_forest.jpg +0 -0
  247. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/featured_forest.jpg +0 -0
  248. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/forest.jpg +0 -0
  249. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/large_forest.jpg +0 -0
  250. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/medium_forest.jpg +0 -0
  251. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/special_forest.jpg +0 -0
  252. data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/thumb_forest.jpg +0 -0
  253. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/admin_thumb_mountains.jpg +0 -0
  254. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/featured_mountains.jpg +0 -0
  255. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/large_mountains.jpg +0 -0
  256. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/medium_mountains.jpg +0 -0
  257. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/mountains.jpg +0 -0
  258. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/special_mountains.jpg +0 -0
  259. data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/thumb_mountains.jpg +0 -0
  260. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/admin_thumb_forest.jpg +0 -0
  261. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/featured_forest.jpg +0 -0
  262. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/forest.jpg +0 -0
  263. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/large_forest.jpg +0 -0
  264. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/medium_forest.jpg +0 -0
  265. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/special_forest.jpg +0 -0
  266. data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/thumb_forest.jpg +0 -0
  267. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/admin_thumb_mountains.jpg +0 -0
  268. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/featured_mountains.jpg +0 -0
  269. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/large_mountains.jpg +0 -0
  270. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/medium_mountains.jpg +0 -0
  271. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/mountains.jpg +0 -0
  272. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/special_mountains.jpg +0 -0
  273. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/thumb_mountains.jpg +0 -0
  274. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/admin_thumb_forest.jpg +0 -0
  275. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/featured_forest.jpg +0 -0
  276. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/forest.jpg +0 -0
  277. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/large_forest.jpg +0 -0
  278. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/medium_forest.jpg +0 -0
  279. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/special_forest.jpg +0 -0
  280. data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/thumb_forest.jpg +0 -0
  281. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/admin_thumb_mountains.jpg +0 -0
  282. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/featured_mountains.jpg +0 -0
  283. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/large_mountains.jpg +0 -0
  284. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/medium_mountains.jpg +0 -0
  285. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/mountains.jpg +0 -0
  286. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/special_mountains.jpg +0 -0
  287. data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/thumb_mountains.jpg +0 -0
  288. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/admin_thumb_forest.jpg +0 -0
  289. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/featured_forest.jpg +0 -0
  290. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/forest.jpg +0 -0
  291. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/large_forest.jpg +0 -0
  292. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/medium_forest.jpg +0 -0
  293. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/special_forest.jpg +0 -0
  294. data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/thumb_forest.jpg +0 -0
  295. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/admin_thumb_mountains.jpg +0 -0
  296. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/featured_mountains.jpg +0 -0
  297. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/large_mountains.jpg +0 -0
  298. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/medium_mountains.jpg +0 -0
  299. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/mountains.jpg +0 -0
  300. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/special_mountains.jpg +0 -0
  301. data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/thumb_mountains.jpg +0 -0
  302. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/admin_thumb_forest.jpg +0 -0
  303. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/featured_forest.jpg +0 -0
  304. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/forest.jpg +0 -0
  305. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/large_forest.jpg +0 -0
  306. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/medium_forest.jpg +0 -0
  307. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/special_forest.jpg +0 -0
  308. data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/thumb_forest.jpg +0 -0
  309. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/-j/-jJCki_r-oPSXXLl3ffFoRlXuarDpc3BqttJocNpcso.cache +0 -0
  310. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/1R/1RDUJN4-R0v_a1EB2kbL4V_Jbnjf7NO7EUE6OfOknvk.cache +1 -0
  311. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
  312. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/B4/B44rUGjKw-IT5jQg91u68LX8W8WFlnqJEScOW5JEAEQ.cache +0 -0
  313. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/Id/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
  314. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/V9/v9FnYugj6kUrygHuOt2RUUemXNXN5NERvL37qKeSE08.cache +1 -0
  315. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
  316. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +0 -0
  317. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/ns/ns7tCPFFhqUXQlcCE3m6hkwohbISokBqU_2a9amHznI.cache +1 -0
  318. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
  319. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/uC/uCA70-mmGLTwfmwuljQjxD1Hwmjv54uN6R7u9DO_rdE.cache +1 -0
  320. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/wT/wTqXlm6KbVHZFyO7RkmLbmxpb5qVXE2pek3EhOemnLs.cache +1 -0
  321. data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/zD/zDzGvN2biHHXu7BiALrPdtu5oQs-hkAHr77u9azB5-o.cache +0 -0
  322. data/spec/dummy/rails-5/tmp/pids/server.pid +1 -0
  323. data/spec/factories/o_cms/templates.rb +8 -0
  324. data/spec/features/o_cms/admin_creates_page_template_relationship_spec.rb +64 -0
  325. data/spec/features/o_cms/admin_creates_updates_and_deletes_template_spec.rb +104 -0
  326. data/spec/models/o_cms/category_spec.rb +1 -1
  327. data/spec/models/o_cms/gallery_spec.rb +1 -1
  328. data/spec/models/o_cms/image_spec.rb +1 -1
  329. data/spec/models/o_cms/page_spec.rb +5 -4
  330. data/spec/models/o_cms/post_spec.rb +1 -1
  331. data/spec/models/o_cms/template_spec.rb +30 -0
  332. data/spec/support/cabybara.rb +1 -1
  333. metadata +558 -2
@@ -0,0 +1,17 @@
1
+ <%= render :partial => 'o_cms/templates/navigation' %>
2
+
3
+ <h2>Edit Template</h2>
4
+
5
+ <div class="row">
6
+ <div class="col-md-4">
7
+ <%= render :partial => 'guidelines' %>
8
+ </div>
9
+ <div class="col-md-8">
10
+ <%= render partial: 'form', locals: { template: @template } %>
11
+ </div>
12
+ <div class="col-md-8 offset-md-4">
13
+ <%= link_to template_path(@template), method: :delete, data: { confirm: 'Are you sure?' }, class:'btn btn-default btn-danger clear-right' do %>
14
+ <i class="fa fa-delete-variant"></i> Delete
15
+ <% end %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,28 @@
1
+ <%= render :partial => 'o_cms/templates/navigation' %>
2
+
3
+ <h2>Templates</h2>
4
+
5
+ <div class="table-responsive">
6
+ <table class="table">
7
+ <thead>
8
+ <tr>
9
+ <th>Name</th>
10
+ <th>Description</th>
11
+ <th></th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <% @templates.each do |template| %>
16
+ <tr>
17
+ <td><%= template.name %></td>
18
+ <td><%= template.description %></td>
19
+ <td>
20
+ <%= link_to edit_template_path(template), class:'btn btn-info btn-sm' do %>
21
+ <i class="fa fa-mode-edit"></i> Edit
22
+ <% end %>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ </div>
@@ -0,0 +1,12 @@
1
+ <%= render :partial => 'o_cms/templates/navigation' %>
2
+
3
+ <h2>New Template</h2>
4
+
5
+ <div class="row">
6
+ <div class="col-md-4">
7
+ <%= render :partial => 'guidelines' %>
8
+ </div>
9
+ <div class="col-md-8">
10
+ <%= render partial: 'form', locals: { template: @template } %>
11
+ </div>
12
+ </div>
@@ -6,4 +6,5 @@ OCms::Engine.routes.draw do
6
6
  resources :categories
7
7
  resources :pages
8
8
  resources :galleries
9
+ resources :templates
9
10
  end
@@ -0,0 +1,11 @@
1
+ class CreateOCmsTemplates < ActiveRecord::Migration
2
+ def change
3
+ create_table :o_cms_templates do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.text :layout
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddSlugToTemplate < ActiveRecord::Migration
2
+ def change
3
+ add_column :o_cms_templates, :slug, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddTemplateToPage < ActiveRecord::Migration
2
+ def change
3
+ add_column :o_cms_pages, :template_id, :integer
4
+ end
5
+ end
@@ -5,6 +5,7 @@ require 'rails-assets-tether'
5
5
  require 'bootstrap'
6
6
  require 'carrierwave'
7
7
  require 'trix'
8
+ require "liquid"
8
9
  require "o_cms/engine"
9
10
 
10
11
  module OCms
@@ -16,6 +16,8 @@ module OCms
16
16
  g.helper false
17
17
  end
18
18
 
19
+ config.file_storage = :file
20
+
19
21
  config.image_sizes = {
20
22
  thumb: { resize: "resize_to_fill", width: 50, height: 50 },
21
23
  medium: { resize: "resize_to_fit", width: 200, height: 200 },
@@ -1,3 +1,3 @@
1
1
  module OCms
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,103 @@
1
+ require 'rails_helper'
2
+
3
+ module OCms
4
+ RSpec.describe TemplatesController, type: :controller do
5
+ routes { OCms::Engine.routes }
6
+ let(:template) { create(:template) }
7
+
8
+ context "admin doing CRUD on a template" do
9
+ login_admin
10
+
11
+ describe "GET new" do
12
+ it "returns http success" do
13
+ get :new
14
+ expect(response).to have_http_status(:success)
15
+ end
16
+
17
+ it "renders the #new view" do
18
+ get :new
19
+ expect(response).to render_template :new
20
+ end
21
+
22
+ it "instantiates @template" do
23
+ get :new
24
+ expect(assigns(:template)).not_to be_nil
25
+ end
26
+ end
27
+
28
+ describe "POST create" do
29
+ it "increases the number of Templates by 1" do
30
+ expect{ post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph } }.to change(Template,:count).by(1)
31
+ end
32
+
33
+ it "assigns the new template to @template" do
34
+ post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph }
35
+ expect(assigns(:template)).to eq Template.last
36
+ end
37
+
38
+ it "redirects to the new template" do
39
+ post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph }
40
+ expect(response).to redirect_to edit_template_path(Template.last)
41
+ end
42
+ end
43
+
44
+ describe "GET edit" do
45
+ it "returns http success" do
46
+ get :edit, id: template.id
47
+ expect(response).to have_http_status(:success)
48
+ end
49
+
50
+ it "renders the #edit view" do
51
+ get :edit, id: template.id
52
+ expect(response).to render_template :edit
53
+ end
54
+
55
+ it "assigns template to be updated to @template" do
56
+ get :edit, id: template.id
57
+ template_instance = assigns(:template)
58
+
59
+ expect(template_instance).to eq template
60
+ end
61
+ end
62
+
63
+ describe "PUT update" do
64
+ it "updates template with expected attributes" do
65
+ new_name = RandomData.random_sentence
66
+ new_description = RandomData.random_paragraph
67
+ new_layout = RandomData.random_paragraph
68
+
69
+ put :update, id: template.id, template: {name: new_name, description: new_description, layout: new_layout }
70
+
71
+ updated_template = assigns(:template)
72
+ expect(updated_template.id).to eq template.id
73
+ expect(updated_template.name).to eq new_name
74
+ expect(updated_template.description).to eq new_description
75
+ expect(updated_template.layout).to eq new_layout
76
+ end
77
+
78
+ it "redirects to the updated template" do
79
+ new_name = RandomData.random_sentence
80
+ new_description = RandomData.random_paragraph
81
+ new_layout = RandomData.random_paragraph
82
+
83
+ put :update, id: template.id, template: {name: new_name, description: new_description, layout: new_layout }
84
+ expect(response).to redirect_to edit_template_path(template)
85
+ end
86
+ end
87
+
88
+ describe "DELETE destroy" do
89
+ it "deletes the template" do
90
+ delete :destroy, id: template.id
91
+ count = Template.where({id: template.id}).size
92
+ expect(count).to eq 0
93
+ end
94
+
95
+ it "redirects to templates index" do
96
+ delete :destroy, id: template.id
97
+ expect(response).to redirect_to templates_path
98
+ end
99
+ end
100
+ end
101
+
102
+ end
103
+ end
@@ -62,11 +62,12 @@ GIT
62
62
  PATH
63
63
  remote: ..
64
64
  specs:
65
- o_cms (0.0.1)
65
+ o_cms (0.3.0)
66
66
  bootstrap (= 4.0.0.alpha4)
67
67
  carrierwave (>= 1.0.0.beta, < 2.0)
68
68
  compass-rails
69
69
  jquery-rails
70
+ liquid
70
71
  mini_magick
71
72
  rails (>= 4.1.16)
72
73
  rails-assets-tether (>= 1.1.0)
@@ -172,6 +173,7 @@ GEM
172
173
  json (2.0.2)
173
174
  launchy (2.4.3)
174
175
  addressable (~> 2.3)
176
+ liquid (3.0.6)
175
177
  loofah (2.0.3)
176
178
  nokogiri (>= 1.5.9)
177
179
  mail (2.6.4)
@@ -1,4 +1,6 @@
1
1
  module ApplicationHelper
2
+ include OCms::ExistsHelper
3
+
2
4
  def roles_for_select
3
5
  Role.not_admin
4
6
  end
@@ -11,31 +11,31 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20161105203727) do
14
+ ActiveRecord::Schema.define(version: 20161202155453) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
18
18
 
19
- create_table "o_cms_categories", force: :cascade do |t|
20
- t.string "name"
21
- t.string "slug"
22
- t.string "icon"
19
+ create_table "o_cms_categories", force: true do |t|
20
+ t.string "name", limit: nil
21
+ t.string "slug", limit: nil
22
+ t.string "icon", limit: nil
23
23
  t.text "body"
24
- t.string "meta_title"
25
- t.string "meta_description"
26
- t.string "meta_keywords"
27
- t.datetime "created_at", null: false
28
- t.datetime "updated_at", null: false
24
+ t.string "meta_title", limit: nil
25
+ t.string "meta_description", limit: nil
26
+ t.string "meta_keywords", limit: nil
27
+ t.datetime "created_at", null: false
28
+ t.datetime "updated_at", null: false
29
29
  end
30
30
 
31
- create_table "o_cms_galleries", force: :cascade do |t|
32
- t.string "name"
31
+ create_table "o_cms_galleries", force: true do |t|
32
+ t.string "name", limit: nil
33
33
  t.text "description"
34
- t.datetime "created_at", null: false
35
- t.datetime "updated_at", null: false
34
+ t.datetime "created_at", null: false
35
+ t.datetime "updated_at", null: false
36
36
  end
37
37
 
38
- create_table "o_cms_image_galleries", id: false, force: :cascade do |t|
38
+ create_table "o_cms_image_galleries", id: false, force: true do |t|
39
39
  t.integer "image_id"
40
40
  t.integer "gallery_id"
41
41
  end
@@ -43,31 +43,31 @@ ActiveRecord::Schema.define(version: 20161105203727) do
43
43
  add_index "o_cms_image_galleries", ["gallery_id"], name: "index_o_cms_image_galleries_on_gallery_id", using: :btree
44
44
  add_index "o_cms_image_galleries", ["image_id"], name: "index_o_cms_image_galleries_on_image_id", using: :btree
45
45
 
46
- create_table "o_cms_images", force: :cascade do |t|
47
- t.string "name"
48
- t.string "file"
46
+ create_table "o_cms_images", force: true do |t|
47
+ t.string "name", limit: nil
48
+ t.string "file", limit: nil
49
49
  t.text "description"
50
- t.datetime "created_at", null: false
51
- t.datetime "updated_at", null: false
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
52
  end
53
53
 
54
- create_table "o_cms_pages", force: :cascade do |t|
55
- t.string "title"
56
- t.string "slug"
54
+ create_table "o_cms_pages", force: true do |t|
55
+ t.string "title", limit: nil
56
+ t.string "slug", limit: nil
57
57
  t.text "body"
58
58
  t.text "excerpt"
59
- t.string "featured_image"
60
- t.string "meta_title"
61
- t.string "meta_description"
62
- t.string "meta_keywords"
63
- t.datetime "created_at", null: false
64
- t.datetime "updated_at", null: false
59
+ t.string "featured_image", limit: nil
60
+ t.string "meta_title", limit: nil
61
+ t.string "meta_description", limit: nil
62
+ t.string "meta_keywords", limit: nil
63
+ t.datetime "created_at", null: false
64
+ t.datetime "updated_at", null: false
65
65
  t.datetime "published_at"
66
66
  t.integer "parent_id"
67
67
  t.integer "order"
68
68
  end
69
69
 
70
- create_table "o_cms_post_categories", id: false, force: :cascade do |t|
70
+ create_table "o_cms_post_categories", id: false, force: true do |t|
71
71
  t.integer "post_id"
72
72
  t.integer "category_id"
73
73
  end
@@ -75,24 +75,33 @@ ActiveRecord::Schema.define(version: 20161105203727) do
75
75
  add_index "o_cms_post_categories", ["category_id"], name: "index_o_cms_post_categories_on_category_id", using: :btree
76
76
  add_index "o_cms_post_categories", ["post_id"], name: "index_o_cms_post_categories_on_post_id", using: :btree
77
77
 
78
- create_table "o_cms_posts", force: :cascade do |t|
79
- t.string "title"
80
- t.string "slug"
78
+ create_table "o_cms_posts", force: true do |t|
79
+ t.string "title", limit: nil
80
+ t.string "slug", limit: nil
81
81
  t.text "body"
82
82
  t.text "excerpt"
83
- t.string "featured_image"
84
- t.string "meta_title"
85
- t.string "meta_description"
86
- t.string "meta_keywords"
87
- t.datetime "created_at", null: false
88
- t.datetime "updated_at", null: false
83
+ t.string "featured_image", limit: nil
84
+ t.string "meta_title", limit: nil
85
+ t.string "meta_description", limit: nil
86
+ t.string "meta_keywords", limit: nil
87
+ t.datetime "created_at", null: false
88
+ t.datetime "updated_at", null: false
89
89
  t.datetime "published_at"
90
90
  end
91
91
 
92
- create_table "roles", force: :cascade do |t|
93
- t.string "name"
92
+ create_table "o_cms_templates", force: true do |t|
93
+ t.string "name", limit: nil
94
+ t.text "description"
95
+ t.text "layout"
96
+ t.datetime "created_at", null: false
97
+ t.datetime "updated_at", null: false
98
+ t.string "slug", limit: nil
99
+ end
100
+
101
+ create_table "roles", force: true do |t|
102
+ t.string "name", limit: nil
94
103
  t.integer "resource_id"
95
- t.string "resource_type"
104
+ t.string "resource_type", limit: nil
96
105
  t.datetime "created_at"
97
106
  t.datetime "updated_at"
98
107
  end
@@ -100,26 +109,26 @@ ActiveRecord::Schema.define(version: 20161105203727) do
100
109
  add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
101
110
  add_index "roles", ["name"], name: "index_roles_on_name", using: :btree
102
111
 
103
- create_table "users", force: :cascade do |t|
104
- t.string "email", default: "", null: false
105
- t.string "encrypted_password", default: "", null: false
106
- t.string "reset_password_token"
112
+ create_table "users", force: true do |t|
113
+ t.string "email", limit: nil, default: "", null: false
114
+ t.string "encrypted_password", limit: nil, default: "", null: false
115
+ t.string "reset_password_token", limit: nil
107
116
  t.datetime "reset_password_sent_at"
108
117
  t.datetime "remember_created_at"
109
- t.integer "sign_in_count", default: 0, null: false
118
+ t.integer "sign_in_count", default: 0, null: false
110
119
  t.datetime "current_sign_in_at"
111
120
  t.datetime "last_sign_in_at"
112
- t.string "current_sign_in_ip"
113
- t.string "last_sign_in_ip"
114
- t.datetime "created_at", null: false
115
- t.datetime "updated_at", null: false
121
+ t.string "current_sign_in_ip", limit: nil
122
+ t.string "last_sign_in_ip", limit: nil
123
+ t.datetime "created_at", null: false
124
+ t.datetime "updated_at", null: false
116
125
  t.integer "role_id"
117
126
  end
118
127
 
119
128
  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
120
129
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
121
130
 
122
- create_table "users_roles", id: false, force: :cascade do |t|
131
+ create_table "users_roles", id: false, force: true do |t|
123
132
  t.integer "user_id"
124
133
  t.integer "role_id"
125
134
  end
@@ -82,6 +82,18 @@ end
82
82
  end
83
83
  galleries = OCms::Gallery.all
84
84
 
85
+ # Templates
86
+ 5.times do
87
+ OCms::Template.create!(
88
+ name: RandomData.random_sentence,
89
+ slug: RandomData.random_slug,
90
+ description: RandomData.random_paragraph,
91
+ layout: RandomData.random_sentence
92
+ )
93
+ end
94
+ templates = OCms::Template.all
95
+
96
+
85
97
  # Confirmation
86
98
  puts "Seed finished"
87
99
  puts "#{Role.count} roles created"
@@ -91,3 +103,4 @@ puts "#{OCms::Post.count} posts created"
91
103
  puts "#{OCms::Category.count} categories created"
92
104
  puts "#{OCms::Page.count} pages created"
93
105
  puts "#{OCms::Gallery.count} galleries created"
106
+ puts "#{OCms::Template.count} templates created"