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
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= render :partial => 'o_cms/templates/navigation' %>
|
2
|
+
|
3
|
+
<h2>Edit Template</h2>
|
4
|
+
|
5
|
+
<div class="row">
|
6
|
+
<div class="col-md-4">
|
7
|
+
<%= render :partial => 'guidelines' %>
|
8
|
+
</div>
|
9
|
+
<div class="col-md-8">
|
10
|
+
<%= render partial: 'form', locals: { template: @template } %>
|
11
|
+
</div>
|
12
|
+
<div class="col-md-8 offset-md-4">
|
13
|
+
<%= link_to template_path(@template), method: :delete, data: { confirm: 'Are you sure?' }, class:'btn btn-default btn-danger clear-right' do %>
|
14
|
+
<i class="fa fa-delete-variant"></i> Delete
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= render :partial => 'o_cms/templates/navigation' %>
|
2
|
+
|
3
|
+
<h2>Templates</h2>
|
4
|
+
|
5
|
+
<div class="table-responsive">
|
6
|
+
<table class="table">
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th>Name</th>
|
10
|
+
<th>Description</th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<tbody>
|
15
|
+
<% @templates.each do |template| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= template.name %></td>
|
18
|
+
<td><%= template.description %></td>
|
19
|
+
<td>
|
20
|
+
<%= link_to edit_template_path(template), class:'btn btn-info btn-sm' do %>
|
21
|
+
<i class="fa fa-mode-edit"></i> Edit
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render :partial => 'o_cms/templates/navigation' %>
|
2
|
+
|
3
|
+
<h2>New Template</h2>
|
4
|
+
|
5
|
+
<div class="row">
|
6
|
+
<div class="col-md-4">
|
7
|
+
<%= render :partial => 'guidelines' %>
|
8
|
+
</div>
|
9
|
+
<div class="col-md-8">
|
10
|
+
<%= render partial: 'form', locals: { template: @template } %>
|
11
|
+
</div>
|
12
|
+
</div>
|
data/config/routes.rb
CHANGED
data/lib/o_cms.rb
CHANGED
data/lib/o_cms/engine.rb
CHANGED
data/lib/o_cms/version.rb
CHANGED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module OCms
|
4
|
+
RSpec.describe TemplatesController, type: :controller do
|
5
|
+
routes { OCms::Engine.routes }
|
6
|
+
let(:template) { create(:template) }
|
7
|
+
|
8
|
+
context "admin doing CRUD on a template" do
|
9
|
+
login_admin
|
10
|
+
|
11
|
+
describe "GET new" do
|
12
|
+
it "returns http success" do
|
13
|
+
get :new
|
14
|
+
expect(response).to have_http_status(:success)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "renders the #new view" do
|
18
|
+
get :new
|
19
|
+
expect(response).to render_template :new
|
20
|
+
end
|
21
|
+
|
22
|
+
it "instantiates @template" do
|
23
|
+
get :new
|
24
|
+
expect(assigns(:template)).not_to be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "POST create" do
|
29
|
+
it "increases the number of Templates by 1" do
|
30
|
+
expect{ post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph } }.to change(Template,:count).by(1)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "assigns the new template to @template" do
|
34
|
+
post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph }
|
35
|
+
expect(assigns(:template)).to eq Template.last
|
36
|
+
end
|
37
|
+
|
38
|
+
it "redirects to the new template" do
|
39
|
+
post :create, template: {name: RandomData.random_sentence, description: RandomData.random_paragraph, layout: RandomData.random_paragraph }
|
40
|
+
expect(response).to redirect_to edit_template_path(Template.last)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "GET edit" do
|
45
|
+
it "returns http success" do
|
46
|
+
get :edit, id: template.id
|
47
|
+
expect(response).to have_http_status(:success)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "renders the #edit view" do
|
51
|
+
get :edit, id: template.id
|
52
|
+
expect(response).to render_template :edit
|
53
|
+
end
|
54
|
+
|
55
|
+
it "assigns template to be updated to @template" do
|
56
|
+
get :edit, id: template.id
|
57
|
+
template_instance = assigns(:template)
|
58
|
+
|
59
|
+
expect(template_instance).to eq template
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "PUT update" do
|
64
|
+
it "updates template with expected attributes" do
|
65
|
+
new_name = RandomData.random_sentence
|
66
|
+
new_description = RandomData.random_paragraph
|
67
|
+
new_layout = RandomData.random_paragraph
|
68
|
+
|
69
|
+
put :update, id: template.id, template: {name: new_name, description: new_description, layout: new_layout }
|
70
|
+
|
71
|
+
updated_template = assigns(:template)
|
72
|
+
expect(updated_template.id).to eq template.id
|
73
|
+
expect(updated_template.name).to eq new_name
|
74
|
+
expect(updated_template.description).to eq new_description
|
75
|
+
expect(updated_template.layout).to eq new_layout
|
76
|
+
end
|
77
|
+
|
78
|
+
it "redirects to the updated template" do
|
79
|
+
new_name = RandomData.random_sentence
|
80
|
+
new_description = RandomData.random_paragraph
|
81
|
+
new_layout = RandomData.random_paragraph
|
82
|
+
|
83
|
+
put :update, id: template.id, template: {name: new_name, description: new_description, layout: new_layout }
|
84
|
+
expect(response).to redirect_to edit_template_path(template)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "DELETE destroy" do
|
89
|
+
it "deletes the template" do
|
90
|
+
delete :destroy, id: template.id
|
91
|
+
count = Template.where({id: template.id}).size
|
92
|
+
expect(count).to eq 0
|
93
|
+
end
|
94
|
+
|
95
|
+
it "redirects to templates index" do
|
96
|
+
delete :destroy, id: template.id
|
97
|
+
expect(response).to redirect_to templates_path
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -62,11 +62,12 @@ GIT
|
|
62
62
|
PATH
|
63
63
|
remote: ..
|
64
64
|
specs:
|
65
|
-
o_cms (0.0
|
65
|
+
o_cms (0.3.0)
|
66
66
|
bootstrap (= 4.0.0.alpha4)
|
67
67
|
carrierwave (>= 1.0.0.beta, < 2.0)
|
68
68
|
compass-rails
|
69
69
|
jquery-rails
|
70
|
+
liquid
|
70
71
|
mini_magick
|
71
72
|
rails (>= 4.1.16)
|
72
73
|
rails-assets-tether (>= 1.1.0)
|
@@ -172,6 +173,7 @@ GEM
|
|
172
173
|
json (2.0.2)
|
173
174
|
launchy (2.4.3)
|
174
175
|
addressable (~> 2.3)
|
176
|
+
liquid (3.0.6)
|
175
177
|
loofah (2.0.3)
|
176
178
|
nokogiri (>= 1.5.9)
|
177
179
|
mail (2.6.4)
|
@@ -11,31 +11,31 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20161202155453) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
18
18
|
|
19
|
-
create_table "o_cms_categories", force:
|
20
|
-
t.string "name"
|
21
|
-
t.string "slug"
|
22
|
-
t.string "icon"
|
19
|
+
create_table "o_cms_categories", force: true do |t|
|
20
|
+
t.string "name", limit: nil
|
21
|
+
t.string "slug", limit: nil
|
22
|
+
t.string "icon", limit: nil
|
23
23
|
t.text "body"
|
24
|
-
t.string "meta_title"
|
25
|
-
t.string "meta_description"
|
26
|
-
t.string "meta_keywords"
|
27
|
-
t.datetime "created_at",
|
28
|
-
t.datetime "updated_at",
|
24
|
+
t.string "meta_title", limit: nil
|
25
|
+
t.string "meta_description", limit: nil
|
26
|
+
t.string "meta_keywords", limit: nil
|
27
|
+
t.datetime "created_at", null: false
|
28
|
+
t.datetime "updated_at", null: false
|
29
29
|
end
|
30
30
|
|
31
|
-
create_table "o_cms_galleries", force:
|
32
|
-
t.string "name"
|
31
|
+
create_table "o_cms_galleries", force: true do |t|
|
32
|
+
t.string "name", limit: nil
|
33
33
|
t.text "description"
|
34
|
-
t.datetime "created_at",
|
35
|
-
t.datetime "updated_at",
|
34
|
+
t.datetime "created_at", null: false
|
35
|
+
t.datetime "updated_at", null: false
|
36
36
|
end
|
37
37
|
|
38
|
-
create_table "o_cms_image_galleries", id: false, force:
|
38
|
+
create_table "o_cms_image_galleries", id: false, force: true do |t|
|
39
39
|
t.integer "image_id"
|
40
40
|
t.integer "gallery_id"
|
41
41
|
end
|
@@ -43,31 +43,31 @@ ActiveRecord::Schema.define(version: 20161105203727) do
|
|
43
43
|
add_index "o_cms_image_galleries", ["gallery_id"], name: "index_o_cms_image_galleries_on_gallery_id", using: :btree
|
44
44
|
add_index "o_cms_image_galleries", ["image_id"], name: "index_o_cms_image_galleries_on_image_id", using: :btree
|
45
45
|
|
46
|
-
create_table "o_cms_images", force:
|
47
|
-
t.string "name"
|
48
|
-
t.string "file"
|
46
|
+
create_table "o_cms_images", force: true do |t|
|
47
|
+
t.string "name", limit: nil
|
48
|
+
t.string "file", limit: nil
|
49
49
|
t.text "description"
|
50
|
-
t.datetime "created_at",
|
51
|
-
t.datetime "updated_at",
|
50
|
+
t.datetime "created_at", null: false
|
51
|
+
t.datetime "updated_at", null: false
|
52
52
|
end
|
53
53
|
|
54
|
-
create_table "o_cms_pages", force:
|
55
|
-
t.string "title"
|
56
|
-
t.string "slug"
|
54
|
+
create_table "o_cms_pages", force: true do |t|
|
55
|
+
t.string "title", limit: nil
|
56
|
+
t.string "slug", limit: nil
|
57
57
|
t.text "body"
|
58
58
|
t.text "excerpt"
|
59
|
-
t.string "featured_image"
|
60
|
-
t.string "meta_title"
|
61
|
-
t.string "meta_description"
|
62
|
-
t.string "meta_keywords"
|
63
|
-
t.datetime "created_at",
|
64
|
-
t.datetime "updated_at",
|
59
|
+
t.string "featured_image", limit: nil
|
60
|
+
t.string "meta_title", limit: nil
|
61
|
+
t.string "meta_description", limit: nil
|
62
|
+
t.string "meta_keywords", limit: nil
|
63
|
+
t.datetime "created_at", null: false
|
64
|
+
t.datetime "updated_at", null: false
|
65
65
|
t.datetime "published_at"
|
66
66
|
t.integer "parent_id"
|
67
67
|
t.integer "order"
|
68
68
|
end
|
69
69
|
|
70
|
-
create_table "o_cms_post_categories", id: false, force:
|
70
|
+
create_table "o_cms_post_categories", id: false, force: true do |t|
|
71
71
|
t.integer "post_id"
|
72
72
|
t.integer "category_id"
|
73
73
|
end
|
@@ -75,24 +75,33 @@ ActiveRecord::Schema.define(version: 20161105203727) do
|
|
75
75
|
add_index "o_cms_post_categories", ["category_id"], name: "index_o_cms_post_categories_on_category_id", using: :btree
|
76
76
|
add_index "o_cms_post_categories", ["post_id"], name: "index_o_cms_post_categories_on_post_id", using: :btree
|
77
77
|
|
78
|
-
create_table "o_cms_posts", force:
|
79
|
-
t.string "title"
|
80
|
-
t.string "slug"
|
78
|
+
create_table "o_cms_posts", force: true do |t|
|
79
|
+
t.string "title", limit: nil
|
80
|
+
t.string "slug", limit: nil
|
81
81
|
t.text "body"
|
82
82
|
t.text "excerpt"
|
83
|
-
t.string "featured_image"
|
84
|
-
t.string "meta_title"
|
85
|
-
t.string "meta_description"
|
86
|
-
t.string "meta_keywords"
|
87
|
-
t.datetime "created_at",
|
88
|
-
t.datetime "updated_at",
|
83
|
+
t.string "featured_image", limit: nil
|
84
|
+
t.string "meta_title", limit: nil
|
85
|
+
t.string "meta_description", limit: nil
|
86
|
+
t.string "meta_keywords", limit: nil
|
87
|
+
t.datetime "created_at", null: false
|
88
|
+
t.datetime "updated_at", null: false
|
89
89
|
t.datetime "published_at"
|
90
90
|
end
|
91
91
|
|
92
|
-
create_table "
|
93
|
-
t.string "name"
|
92
|
+
create_table "o_cms_templates", force: true do |t|
|
93
|
+
t.string "name", limit: nil
|
94
|
+
t.text "description"
|
95
|
+
t.text "layout"
|
96
|
+
t.datetime "created_at", null: false
|
97
|
+
t.datetime "updated_at", null: false
|
98
|
+
t.string "slug", limit: nil
|
99
|
+
end
|
100
|
+
|
101
|
+
create_table "roles", force: true do |t|
|
102
|
+
t.string "name", limit: nil
|
94
103
|
t.integer "resource_id"
|
95
|
-
t.string "resource_type"
|
104
|
+
t.string "resource_type", limit: nil
|
96
105
|
t.datetime "created_at"
|
97
106
|
t.datetime "updated_at"
|
98
107
|
end
|
@@ -100,26 +109,26 @@ ActiveRecord::Schema.define(version: 20161105203727) do
|
|
100
109
|
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
|
101
110
|
add_index "roles", ["name"], name: "index_roles_on_name", using: :btree
|
102
111
|
|
103
|
-
create_table "users", force:
|
104
|
-
t.string "email", default: "", null: false
|
105
|
-
t.string "encrypted_password", default: "", null: false
|
106
|
-
t.string "reset_password_token"
|
112
|
+
create_table "users", force: true do |t|
|
113
|
+
t.string "email", limit: nil, default: "", null: false
|
114
|
+
t.string "encrypted_password", limit: nil, default: "", null: false
|
115
|
+
t.string "reset_password_token", limit: nil
|
107
116
|
t.datetime "reset_password_sent_at"
|
108
117
|
t.datetime "remember_created_at"
|
109
|
-
t.integer "sign_in_count",
|
118
|
+
t.integer "sign_in_count", default: 0, null: false
|
110
119
|
t.datetime "current_sign_in_at"
|
111
120
|
t.datetime "last_sign_in_at"
|
112
|
-
t.string "current_sign_in_ip"
|
113
|
-
t.string "last_sign_in_ip"
|
114
|
-
t.datetime "created_at",
|
115
|
-
t.datetime "updated_at",
|
121
|
+
t.string "current_sign_in_ip", limit: nil
|
122
|
+
t.string "last_sign_in_ip", limit: nil
|
123
|
+
t.datetime "created_at", null: false
|
124
|
+
t.datetime "updated_at", null: false
|
116
125
|
t.integer "role_id"
|
117
126
|
end
|
118
127
|
|
119
128
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
120
129
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
121
130
|
|
122
|
-
create_table "users_roles", id: false, force:
|
131
|
+
create_table "users_roles", id: false, force: true do |t|
|
123
132
|
t.integer "user_id"
|
124
133
|
t.integer "role_id"
|
125
134
|
end
|
@@ -82,6 +82,18 @@ end
|
|
82
82
|
end
|
83
83
|
galleries = OCms::Gallery.all
|
84
84
|
|
85
|
+
# Templates
|
86
|
+
5.times do
|
87
|
+
OCms::Template.create!(
|
88
|
+
name: RandomData.random_sentence,
|
89
|
+
slug: RandomData.random_slug,
|
90
|
+
description: RandomData.random_paragraph,
|
91
|
+
layout: RandomData.random_sentence
|
92
|
+
)
|
93
|
+
end
|
94
|
+
templates = OCms::Template.all
|
95
|
+
|
96
|
+
|
85
97
|
# Confirmation
|
86
98
|
puts "Seed finished"
|
87
99
|
puts "#{Role.count} roles created"
|
@@ -91,3 +103,4 @@ puts "#{OCms::Post.count} posts created"
|
|
91
103
|
puts "#{OCms::Category.count} categories created"
|
92
104
|
puts "#{OCms::Page.count} pages created"
|
93
105
|
puts "#{OCms::Gallery.count} galleries created"
|
106
|
+
puts "#{OCms::Template.count} templates created"
|