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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a425ac410f05dac0bf172caf877c1c732ec78182
4
- data.tar.gz: c45d27d36167274da9ff7ab456fc6868788980f3
3
+ metadata.gz: 2d1bfacfd81ae22c568eb33e1b8325c4a3d21f75
4
+ data.tar.gz: 5f62ba775e78e04a20fbb688e131d02dbb636d05
5
5
  SHA512:
6
- metadata.gz: 371d2d9ca589b88fdb29cfb2ad4f1f2041efda9c7e9cbc43408153747b5d51c58dfa1843e9f3aed7491bb8f41cb1c7ea9827f20e62d6f7a670f6603cfac54180
7
- data.tar.gz: 84cefe42d4f3c094993bcb9c59533f749802ec6a9ea1713b6621a3bc1c377ef09542c5bcedf7a5d35a5e356cc5d373722549a3eaf675b183c7defb2d0c73b9d9
6
+ metadata.gz: 362fb6a66a2f4dc1b41ce6f955ae85d3ba58eb1995fcd0e375aaaf097eb8f9ada5fba7653ffd71dc89f78c191ff6f303a50976ec0b8533c3a6c2f07d0e0818e2
7
+ data.tar.gz: c908f686c37795baff09c61ff020d21f052791ab62e4d01a9d2c32009395b917abaf0b8fab15aa5170280218d2b9fe6e58b0e22ebf0b3be8dbd952047698e2a6
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Outside CMS
2
2
 
3
- [![Build Status](https://travis-ci.com/benjaminayres/o_cms.svg?token=SupDfrX15nFZyz6Z1cQz&branch=master)](https://travis-ci.com/benjaminayres/o_cms) [![Gem Version](https://badge.fury.io/rb/o_cms.svg)](https://badge.fury.io/rb/o_cms) [![Code Climate](https://codeclimate.com/repos/582251ca7ec35900650034b0/badges/97c43554c5b2c9a14e5b/gpa.svg)](https://codeclimate.com/repos/582251ca7ec35900650034b0/feed) [![Test Coverage](https://codeclimate.com/repos/582251ca7ec35900650034b0/badges/97c43554c5b2c9a14e5b/coverage.svg)](https://codeclimate.com/repos/582251ca7ec35900650034b0/coverage)
3
+ [![Build Status](https://travis-ci.org/benjaminayres/o_cms.svg?branch=master)](https://travis-ci.org/benjaminayres/o_cms) [![Gem Version](https://badge.fury.io/rb/o_cms.svg)](https://badge.fury.io/rb/o_cms) [![Code Climate](https://codeclimate.com/repos/582251ca7ec35900650034b0/badges/97c43554c5b2c9a14e5b/gpa.svg)](https://codeclimate.com/repos/582251ca7ec35900650034b0/feed) [![Test Coverage](https://codeclimate.com/repos/582251ca7ec35900650034b0/badges/97c43554c5b2c9a14e5b/coverage.svg)](https://codeclimate.com/repos/582251ca7ec35900650034b0/coverage)
4
4
 
5
5
  ## Open source, easy to extend content management system for Rails
6
6
 
@@ -110,11 +110,22 @@ You can easily override these guidelines, if you feel the language is tool simpl
110
110
  * ``` /views/o_cms/posts/_guidelines.html.erb ```
111
111
  * ``` /views/o_cms/categories/_guidelines.html.erb ```
112
112
 
113
+ ### Controllers
114
+
115
+ 1. Create your controller
116
+ 2. Define the Outside CMS layout in the head of your controller ``` layouts/o_cms/application ```
117
+ 3. Override the navigation to include a link to your new controller (explained in 'Navigation' above)
118
+ 4. Add controller specific Javascipt and CSS files to your assets directories, in folders following your CMS mount name defined in ``` routes.rb ```.
119
+
120
+ **E.g** For a ``` courses_controller.rb ``` where your CMS uses the default mount name ``` o_cms```. Add your custom controller javascript & styles to ``` assets/javascripts/o_cms/courses.js``` & ``` assets/stylesheets/o_cms/courses.css```.
121
+
122
+ Also supports the file extensions ```.coffee .erb .coffee.erb ``` & ``` .scss .erb .scss.erb ```.
123
+
113
124
  ## Contributing
114
125
 
115
- 1. Fork the project
116
- 2. Make your changes, including tests that exercise the code
117
- 4. Make a pull request
126
+ 1. Fork the project
127
+ 2. Make your changes, including tests that exercise the code
128
+ 4. Make a pull request
118
129
 
119
130
  ## License
120
131
 
@@ -1,18 +1,5 @@
1
1
  module OCms
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
- # before_action :authenticate_admin!
5
-
6
- # # Redirects any unauthorised users
7
- # def authenticate_admin!
8
- # if user_signed_in?
9
- # unless current_user.has_role? :admin
10
- # flash[:alert] = "Sorry your are not authorized to view this area."
11
- # redirect_to main_app.root_url
12
- # end
13
- # else
14
- # authenticate_user!
15
- # end
16
- # end
17
4
  end
18
5
  end
@@ -2,7 +2,6 @@ require_dependency "o_cms/application_controller"
2
2
 
3
3
  module OCms
4
4
  class DashboardController < ApplicationController
5
- # before_action :authenticate_admin!
6
5
 
7
6
  def index
8
7
  end
@@ -14,6 +14,7 @@ module OCms
14
14
  def new
15
15
  @page = Page.new
16
16
  @pages = Page.all
17
+ @templates = Template.all
17
18
  end
18
19
 
19
20
  def create
@@ -32,6 +33,7 @@ module OCms
32
33
  def edit
33
34
  @page = Page.find(params[:id])
34
35
  @pages = Page.all_except(@page)
36
+ @templates = Template.all
35
37
  end
36
38
 
37
39
  def update
@@ -63,7 +65,7 @@ module OCms
63
65
  private
64
66
 
65
67
  def page_params
66
- params.require(:page).permit(:title, :slug, :body, :excerpt, :featured_image, :meta_title, :meta_description, :meta_keywords, :status, :published_at, :parent_id, :order)
68
+ params.require(:page).permit(:title, :slug, :body, :excerpt, :featured_image, :meta_title, :meta_description, :meta_keywords, :status, :published_at, :parent_id, :order, :template_id)
67
69
  end
68
70
  end
69
71
  end
@@ -0,0 +1,65 @@
1
+ require_dependency "o_cms/application_controller"
2
+
3
+ module OCms
4
+ class TemplatesController < ApplicationController
5
+
6
+ def index
7
+ @templates = Template.all
8
+ end
9
+
10
+ def show
11
+ @template = Template.find(params[:id])
12
+ end
13
+
14
+ def new
15
+ @template = Template.new
16
+ end
17
+
18
+ def create
19
+ @template = Template.new(template_params)
20
+
21
+ if @template.save
22
+ flash[:notice] = "Template was saved successfully."
23
+ redirect_to edit_template_path(@template)
24
+ else
25
+ flash.now[:alert] = "Error creating template. Please try again."
26
+ render :new
27
+ end
28
+ end
29
+
30
+ def edit
31
+ @template = Template.find(params[:id])
32
+ end
33
+
34
+ def update
35
+ @template = Template.find(params[:id])
36
+ @template.assign_attributes(template_params)
37
+
38
+ if @template.save
39
+ flash[:notice] = "Template was updated successfully."
40
+ redirect_to edit_template_path(@template)
41
+ else
42
+ flash.now[:alert] = "Error saving template. Please try again."
43
+ render :edit
44
+ end
45
+ end
46
+
47
+ def destroy
48
+ @template = Template.find(params[:id])
49
+
50
+ if @template.destroy
51
+ flash[:notice] = "\"#{@template.name}\" was deleted successfully."
52
+ redirect_to action: :index
53
+ else
54
+ flash.now[:alert] = "There was an error deleting the template."
55
+ render :show
56
+ end
57
+ end
58
+
59
+ private
60
+
61
+ def template_params
62
+ params.require(:template).permit(:name, :slug, :description, :layout)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,19 @@
1
+ module OCms
2
+ module ExistsHelper
3
+ def stylesheet_exists?(stylesheet)
4
+ stylesheet = "#{Rails.root}/app/assets/stylesheets/#{stylesheet}.scss"
5
+ extensions = %w(.scss .erb .scss.erb) + [""]
6
+ extensions.inject(false) do |truth, extension|
7
+ truth || File.exists?("#{stylesheet}#{extension}")
8
+ end
9
+ end
10
+
11
+ def javascript_exists?(script)
12
+ script = "#{Rails.root}/app/assets/javascripts/#{script}.js"
13
+ extensions = %w(.coffee .erb .coffee.erb) + [""]
14
+ extensions.inject(false) do |truth, extension|
15
+ truth || File.exists?("#{script}#{extension}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -5,7 +5,7 @@ module OCms
5
5
  has_many :post_category
6
6
  has_many :posts, :through => :post_category
7
7
 
8
- validates :name, length: { minimum: 5 }, presence: true
8
+ validates :name, length: { minimum: 4 }, presence: true
9
9
  validates :body, presence: true
10
10
 
11
11
  before_validation :create_slug
@@ -1,10 +1,10 @@
1
1
  module OCms
2
2
  class Gallery < ActiveRecord::Base
3
3
  default_scope { order('created_at DESC') }
4
-
4
+
5
5
  has_many :image_gallery
6
6
  has_many :images, :through => :image_gallery
7
7
 
8
- validates :name, length: { minimum: 5 }, presence: true
8
+ validates :name, length: { minimum: 4 }, presence: true
9
9
  end
10
10
  end
@@ -7,7 +7,7 @@ module OCms
7
7
  has_many :image_gallery
8
8
  has_many :galleries, :through => :image_gallery
9
9
 
10
- validates :name, length: { minimum: 5 }, presence: true
11
- validates :file, length: { minimum: 5 }, presence: true
10
+ validates :name, length: { minimum: 4 }, presence: true
11
+ validates :file, length: { minimum: 4 }, presence: true
12
12
  end
13
13
  end
@@ -4,11 +4,15 @@ module OCms
4
4
 
5
5
  has_many :subpages, class_name: OCms::Page, foreign_key: 'parent_id'
6
6
 
7
+ belongs_to_opts = { class_name: OCms::Template, foreign_key: 'template_id' }
8
+ belongs_to_opts[:optional] = true if ActiveRecord::VERSION::MAJOR >= 5
9
+ belongs_to :template, belongs_to_opts
10
+
7
11
  belongs_to_opts = { class_name: OCms::Page, foreign_key: 'parent_id' }
8
12
  belongs_to_opts[:optional] = true if ActiveRecord::VERSION::MAJOR >= 5
9
13
  belongs_to :parent, belongs_to_opts
10
14
 
11
- validates :title, length: { minimum: 8 }, presence: true
15
+ validates :title, length: { minimum: 4 }, presence: true
12
16
  validates :body, length: { minimum: 15 }, presence: true
13
17
 
14
18
  before_validation :create_slug
@@ -1,11 +1,11 @@
1
1
  module OCms
2
2
  class Post < ActiveRecord::Base
3
- default_scope { order('created_at DESC') }
3
+ default_scope { order('published_at DESC') }
4
4
 
5
5
  has_many :post_category
6
6
  has_many :categories, :through => :post_category
7
7
 
8
- validates :title, length: { minimum: 8 }, presence: true
8
+ validates :title, length: { minimum: 4 }, presence: true
9
9
  validates :body, length: { minimum: 15 }, presence: true
10
10
 
11
11
  before_validation :create_slug
@@ -0,0 +1,15 @@
1
+ module OCms
2
+ class Template < ActiveRecord::Base
3
+ default_scope { order('name ASC') }
4
+
5
+ has_many :pages
6
+
7
+ validates :name, length: { minimum: 5 }, presence: true
8
+
9
+ before_validation :create_slug
10
+
11
+ def create_slug
12
+ self.slug = "#{name.parameterize}" if self.slug.blank? && self.name.present?
13
+ end
14
+ end
15
+ end
@@ -6,8 +6,7 @@ module OCms
6
6
  include CarrierWave::MiniMagick
7
7
 
8
8
  # Choose what kind of storage to use for this uploader:
9
- storage :file
10
- # storage :fog
9
+ storage OCms::Engine.config.file_storage
11
10
 
12
11
  # Override the directory where uploaded files will be stored.
13
12
  # This is a sensible default for uploaders that are meant to be mounted:
@@ -7,7 +7,9 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8
8
  <meta http-equiv="x-ua-compatible" content="ie=edge">
9
9
  <%= stylesheet_link_tag 'o_cms/application', media: 'all' %>
10
+ <%= stylesheet_link_tag params[:controller], :media => "all" if stylesheet_exists?(params[:controller]) %>
10
11
  <%= javascript_include_tag 'o_cms/application' %>
12
+ <%= javascript_include_tag params[:controller] if javascript_exists?(params[:controller]) %>
11
13
  <script src="https://use.fortawesome.com/c7e3010e.js"></script>
12
14
  </head>
13
15
  <body>
@@ -24,6 +24,7 @@
24
24
  <div class="form-group checkbox-group">
25
25
  <%= f.label "Select the images you would like to add to your gallery.", :class => 'control-label' %>
26
26
  <div class="gallery-options">
27
+ <input name="gallery[image_ids][]" value="" type="hidden">
27
28
  <% @images.each do |image| %>
28
29
  <%= label_tag 'gallery_image_ids_' + image.id.to_s do %>
29
30
  <span>
@@ -77,6 +77,21 @@
77
77
  </div>
78
78
  </div>
79
79
 
80
+ <div class="card">
81
+ <div class="card-header">
82
+ Template
83
+ </div>
84
+ <div class="card-block">
85
+ <div class="row">
86
+ <div class="col-sm-12">
87
+ <div class="form-group">
88
+ <%= f.collection_select(:template_id, @templates, :id, :name, {:prompt => 'Choose a template', include_blank: true}, { :class => 'form-control' }) %>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ </div>
94
+
80
95
  <div class="card">
81
96
  <div class="card-header">
82
97
  Publish Options
@@ -3,6 +3,7 @@
3
3
  <div class="btn-toolbar">
4
4
  <%= link_to 'Add Page', new_page_path, class:'btn btn-secondary' %>
5
5
  <%= link_to 'Pages', pages_path, class:'btn btn-secondary' %>
6
+ <%= link_to 'Templates', templates_path, class:'btn btn-secondary' %>
6
7
  </div>
7
8
  </div>
8
9
  <hr />
@@ -3,7 +3,11 @@
3
3
  <% unless type == 'page' %>
4
4
  <i class="fa fa-level-down <%= type %>"></i>
5
5
  <% end %>
6
- <%= page.title %></td>
6
+ <%= page.title %>
7
+ </td>
8
+ <td class="hidden-sm-down">
9
+ <%= page.template.name if page.template_id.present? %>
10
+ </td>
7
11
  <td>
8
12
  <span class="tag tag-<%= page.status %>">
9
13
  <%= page.status.capitalize %>
@@ -7,6 +7,7 @@
7
7
  <thead>
8
8
  <tr>
9
9
  <th>Title</th>
10
+ <th class="hidden-sm-down">Template</th>
10
11
  <th>Status</th>
11
12
  <th></th>
12
13
  </tr>
@@ -10,8 +10,8 @@
10
10
  <li class="nav-item <%= 'active' if params[:controller] == 'o_cms/posts' %>">
11
11
  <%= link_to o_cms.posts_path, class: 'nav-link' do %>
12
12
  <i class="fa fa-pin"></i> Blog</a>
13
- <% end %>
14
- </li>
13
+ <% end %>
14
+ </li>
15
15
  <li class="nav-item">
16
16
  <li class="nav-item <%= 'active' if params[:controller] == 'o_cms/images' %>">
17
17
  <%= link_to o_cms.images_path, class: 'nav-link' do %>
@@ -62,15 +62,16 @@
62
62
  <% if @categories.present? %>
63
63
  <div class="form-group checkbox-group">
64
64
  <%= f.label "Select the categories you would like to associate with your post.", :class => 'control-label' %>
65
- <% @categories.each do |category| %>
66
- <span>
67
- <%= check_box_tag 'post[category_ids][]',
68
- category.id,
69
- @post.categories.include?(category),
70
- id: 'post_category_ids_' + category.id.to_s %>
71
- <%= label_tag 'post_category_ids_' + category.id.to_s, category.name %>
72
- </span>
73
- <% end %>
65
+ <input name="post[category_ids][]" value="" type="hidden">
66
+ <% @categories.each do |category| %>
67
+ <span>
68
+ <%= check_box_tag 'post[category_ids][]',
69
+ category.id,
70
+ @post.categories.include?(category),
71
+ id: 'post_category_ids_' + category.id.to_s %>
72
+ <%= label_tag 'post_category_ids_' + category.id.to_s, category.name %>
73
+ </span>
74
+ <% end %>
74
75
  </div>
75
76
  <% end %>
76
77
  </div>
@@ -0,0 +1,36 @@
1
+ <%= form_for @template do |f| %>
2
+ <% if template.errors.any? %>
3
+ <div class="alert alert-danger">
4
+ <h4><%= pluralize(template.errors.count, "error") %>.</h4>
5
+ <ul>
6
+ <% template.errors.full_messages.each do |msg| %>
7
+ <li><%= msg %></li>
8
+ <% end %>
9
+ </ul>
10
+ </div>
11
+ <% end %>
12
+
13
+ <%= form_group_tag(template.errors[:name]) do %>
14
+ <%= f.label :name %>
15
+ <%= f.text_field :name, class: 'form-control form-control-lg', placeholder: "Enter template name" %>
16
+ <% end %>
17
+
18
+ <%= form_group_tag(template.errors[:slug]) do %>
19
+ <%= f.label :slug %>
20
+ <%= f.text_field :slug, class: 'form-control', placeholder: "Enter template slug" %>
21
+ <% end %>
22
+
23
+ <%= form_group_tag(template.errors[:description]) do %>
24
+ <%= f.label :description %>
25
+ <%= f.text_area :description, rows: 3, class: 'form-control', placeholder: "Enter template description" %>
26
+ <% end %>
27
+
28
+ <%= form_group_tag(template.errors[:layout]) do %>
29
+ <%= f.label :layout %>
30
+ <%= f.text_area :layout, rows: 3, class: 'form-control', placeholder: "Enter template layout" %>
31
+ <% end %>
32
+
33
+ <div class="form-group">
34
+ <%= f.submit "Save", class: 'btn btn-success' %>
35
+ </div>
36
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <p>Guidelines for templates</p>
2
+ <ul>
3
+ <li>Make sure you include a name for your template.</li>
4
+ <li>Description is optional describing where and how to use the template.</li>
5
+ </ul>
6
+ <hr />
@@ -0,0 +1,8 @@
1
+ <div class="section-header with-navigation">
2
+ <h1>Templates</h1>
3
+ <div class="btn-toolbar">
4
+ <%= link_to 'Add Template', new_template_path, class:'btn btn-secondary' %>
5
+ <%= link_to 'Templates', templates_path, class:'btn btn-secondary' %>
6
+ </div>
7
+ </div>
8
+ <hr />