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.
- checksums.yaml +4 -4
- data/README.md +15 -4
- data/app/controllers/o_cms/application_controller.rb +0 -13
- data/app/controllers/o_cms/dashboard_controller.rb +0 -1
- data/app/controllers/o_cms/pages_controller.rb +3 -1
- data/app/controllers/o_cms/templates_controller.rb +65 -0
- data/app/helpers/o_cms/exists_helper.rb +19 -0
- data/app/models/o_cms/category.rb +1 -1
- data/app/models/o_cms/gallery.rb +2 -2
- data/app/models/o_cms/image.rb +2 -2
- data/app/models/o_cms/page.rb +5 -1
- data/app/models/o_cms/post.rb +2 -2
- data/app/models/o_cms/template.rb +15 -0
- data/app/uploaders/o_cms/image_uploader.rb +1 -2
- data/app/views/layouts/o_cms/application.html.erb +2 -0
- data/app/views/o_cms/galleries/_form.html.erb +1 -0
- data/app/views/o_cms/pages/_form.html.erb +15 -0
- data/app/views/o_cms/pages/_navigation.html.erb +1 -0
- data/app/views/o_cms/pages/_page_row.html.erb +5 -1
- data/app/views/o_cms/pages/index.html.erb +1 -0
- data/app/views/o_cms/partials/_primary_navigation.html.erb +2 -2
- data/app/views/o_cms/posts/_form.html.erb +10 -9
- data/app/views/o_cms/templates/_form.html.erb +36 -0
- data/app/views/o_cms/templates/_guidelines.html.erb +6 -0
- data/app/views/o_cms/templates/_navigation.html.erb +8 -0
- data/app/views/o_cms/templates/edit.html.erb +17 -0
- data/app/views/o_cms/templates/index.html.erb +28 -0
- data/app/views/o_cms/templates/new.html.erb +12 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20161111160543_create_o_cms_templates.rb +11 -0
- data/db/migrate/20161202155453_add_slug_to_template.rb +5 -0
- data/db/migrate/20161202173341_add_template_to_page.rb +5 -0
- data/lib/o_cms.rb +1 -0
- data/lib/o_cms/engine.rb +2 -0
- data/lib/o_cms/version.rb +1 -1
- data/spec/controllers/o_cms/templates_controller_spec.rb +103 -0
- data/spec/dummy/rails-4/Gemfile.lock +3 -1
- data/spec/dummy/rails-4/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/rails-4/db/schema.rb +61 -52
- data/spec/dummy/rails-4/db/seeds.rb +13 -0
- data/spec/dummy/rails-4/log/development.log +4382 -0
- data/spec/dummy/rails-4/log/test.log +20227 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/large_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/special_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0050-1176/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/featured_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/large_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/medium_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/special_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480696515-19431-0051-6961/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/large_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/special_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697086-20988-0050-5126/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/featured_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/large_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/medium_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/special_forest.jpg +0 -0
- data/spec/dummy/rails-4/public/uploads/tmp/1480697087-20988-0051-0142/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/3O/3ODiJia5uMdFDmF3jD7dDNl18V7UDtLqk1bJWIyb2hA.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/6j/6j51C6oILM3kf_OLy0sZPQWPxAmY_swD6073ZQnSltc.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/9n/9nrZYiz77mMjREZsuNa1LR_i53vYpy6pFEocU-0Dn2Y.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Id/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/L7/L7EMkGUhsoIfp33TrJw6IANmeUFvtfbRuENNCAAcMPM.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/NC/NCREnyp3EHQK36sy07nJb8wDI0_B0tIOdvnF2EJNJmc.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/WK/WKTCAoxqB14qN8_qfpCDiT2EllrI8BPHhQspRB1NzDQ.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Yi/YiYrVpyqeG3NAPMrjAV6O9MKYBRWbIYDeMXR3i0ZtfM.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/Yj/Yj7WDyKLMi0jZA1UG55D8McpMT8nYMSvILy1OZLUh8M.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/_X/_XbOeLAejerFz9INoJxTvgGJme0oKpidBMFC7AIDVIQ.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/e_/e_lYJn8nZRO1qRk5nXU2khhOCJ2TjUHV_yaaqGH_xUY.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/jg/jghI9nA5xPB0SMqWt7hcEZj9-o6zm570d3jAgyUQfMg.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/sG/sGOK7uaA4LNbhBwgSjt9NaFgH-dC7OHrTPdRuE9FLcU.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/BC/BCn-1KhRagx9rrC2MOvvFXShkg9xq-K5y8ZZ3KoEZzI.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Ci/CiGGJ3nuYKA44MYCyg3Js9eUoYzCNfXIc6MvQGAQQuo.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/FD/FDw8AeDYoohmI5mc6_nZDUeLshWadeyZ4JlmBxmpKPc.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Kp/Kpyn_0WoI_vLbX7XO5OoSop9ZdL4BsioZdfEozaaDVs.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/TS/tS1YS0Z4WSkEV2cgLTJqjw42Vvq81w-Q3JOwc8URZkQ.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Th/thZZaQ5hR4Poohuh6JsckWmlMdJkOj4-hNzPtgiJIyE.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/Zc/ZcQpqZaNfy6qdgRhVrCV44lNwdrATuvXKVezBHItl6s.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/_3/_3b9ohkJWbTdvGbCgcCzB2FmhDQ2I_UKa728vsNx9VI.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +2 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/fv/fVcs0JTcc_0A5xQfYFinHTKJl5OjEl3x1NesAhQ-2D4.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/iD/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/jY/JyzE42rgit3u3fozfbqEOyqGosU2M7wVmnpdElPBN9w.cache +1 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/ob/ObBiEJuavfJmEKRg5rdOjOy4olYyX4FmP7nfVg7z40U.cache +0 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/qt/qtTSJz3rNzxqtYYate2XSD7iy5Z8o72Ij2LejUj0rp4.cache +2 -0
- data/spec/dummy/rails-4/tmp/cache/assets/test/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
- data/spec/dummy/rails-5/Gemfile.lock +3 -1
- data/spec/dummy/rails-5/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/rails-5/db/development.sqlite3 +0 -0
- data/spec/dummy/rails-5/db/schema.rb +11 -1
- data/spec/dummy/rails-5/db/seeds.rb +12 -0
- data/spec/dummy/rails-5/db/test.sqlite3 +0 -0
- data/spec/dummy/rails-5/log/development.log +21315 -0
- data/spec/dummy/rails-5/log/test.log +198530 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499689-98518-0050-2910/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480499690-98518-0051-1314/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0050-6057/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480500264-432-0051-0517/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0050-8724/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480692005-13203-0051-1425/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0050-0041/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480695903-17883-0051-1581/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0050-3998/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480703647-26680-0051-7442/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711317-30030-0050-9030/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480711318-30030-0051-1844/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0050-1199/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480712477-32892-0051-8817/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0050-3707/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480714308-35499-0051-0436/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716639-38294-0050-3316/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480716640-38294-0051-7393/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854732-51018-0050-9731/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1480854733-51018-0051-2918/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209003-49423-0050-9635/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481209004-49423-0051-1226/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0050-3569/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481553724-7826-0051-0290/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554859-10349-0050-9661/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481554860-10349-0051-9735/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/admin_thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/featured_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/large_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/medium_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/special_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556560-13113-0050-4682/thumb_mountains.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/admin_thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/featured_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/large_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/medium_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/special_forest.jpg +0 -0
- data/spec/dummy/rails-5/public/uploads/tmp/1481556561-13113-0051-1474/thumb_forest.jpg +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/-j/-jJCki_r-oPSXXLl3ffFoRlXuarDpc3BqttJocNpcso.cache +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/1R/1RDUJN4-R0v_a1EB2kbL4V_Jbnjf7NO7EUE6OfOknvk.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/6t/6t4BpyzekByTyspkmNuGlIkgkH957wxUcWaF9dHpyXg.cache +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/B4/B44rUGjKw-IT5jQg91u68LX8W8WFlnqJEScOW5JEAEQ.cache +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/Id/IdjOEZjhUwO70uQb9Tc2qMAyvDx-XJsCZpOuNrDNE50.cache +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/V9/v9FnYugj6kUrygHuOt2RUUemXNXN5NERvL37qKeSE08.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/_D/_D9yg5w12C2qNvPst7SikTC6KfSRLBjI4xY1PxbCaZQ.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/dv/dvtF4hZBrPGfbSH-u-7qGoasfSiEYTUW0mTnRpAG2QE.cache +0 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/ns/ns7tCPFFhqUXQlcCE3m6hkwohbISokBqU_2a9amHznI.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/tF/tFBE4kTO5PegMqCWNU_cXw7ut9nYiIKzgw2GAMVNYek.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/uC/uCA70-mmGLTwfmwuljQjxD1Hwmjv54uN6R7u9DO_rdE.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/wT/wTqXlm6KbVHZFyO7RkmLbmxpb5qVXE2pek3EhOemnLs.cache +1 -0
- data/spec/dummy/rails-5/tmp/cache/assets/sprockets/v3.0/zD/zDzGvN2biHHXu7BiALrPdtu5oQs-hkAHr77u9azB5-o.cache +0 -0
- data/spec/dummy/rails-5/tmp/pids/server.pid +1 -0
- data/spec/factories/o_cms/templates.rb +8 -0
- data/spec/features/o_cms/admin_creates_page_template_relationship_spec.rb +64 -0
- data/spec/features/o_cms/admin_creates_updates_and_deletes_template_spec.rb +104 -0
- data/spec/models/o_cms/category_spec.rb +1 -1
- data/spec/models/o_cms/gallery_spec.rb +1 -1
- data/spec/models/o_cms/image_spec.rb +1 -1
- data/spec/models/o_cms/page_spec.rb +5 -4
- data/spec/models/o_cms/post_spec.rb +1 -1
- data/spec/models/o_cms/template_spec.rb +30 -0
- data/spec/support/cabybara.rb +1 -1
- metadata +558 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d1bfacfd81ae22c568eb33e1b8325c4a3d21f75
|
4
|
+
data.tar.gz: 5f62ba775e78e04a20fbb688e131d02dbb636d05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
116
|
-
|
117
|
-
|
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
|
@@ -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:
|
8
|
+
validates :name, length: { minimum: 4 }, presence: true
|
9
9
|
validates :body, presence: true
|
10
10
|
|
11
11
|
before_validation :create_slug
|
data/app/models/o_cms/gallery.rb
CHANGED
@@ -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:
|
8
|
+
validates :name, length: { minimum: 4 }, presence: true
|
9
9
|
end
|
10
10
|
end
|
data/app/models/o_cms/image.rb
CHANGED
@@ -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:
|
11
|
-
validates :file, length: { minimum:
|
10
|
+
validates :name, length: { minimum: 4 }, presence: true
|
11
|
+
validates :file, length: { minimum: 4 }, presence: true
|
12
12
|
end
|
13
13
|
end
|
data/app/models/o_cms/page.rb
CHANGED
@@ -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:
|
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
|
data/app/models/o_cms/post.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module OCms
|
2
2
|
class Post < ActiveRecord::Base
|
3
|
-
default_scope { order('
|
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
|
+
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
|
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,7 +3,11 @@
|
|
3
3
|
<% unless type == 'page' %>
|
4
4
|
<i class="fa fa-level-down <%= type %>"></i>
|
5
5
|
<% end %>
|
6
|
-
<%= page.title
|
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 %>
|
@@ -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
|
-
|
14
|
-
|
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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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,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 />
|