ecm_cms_core 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/app/admin/ecm/ecm_core/folders.rb +46 -0
- data/app/admin/ecm/ecm_core/templates.rb +57 -0
- data/app/controllers/ecm/cms_core/page_controller.rb +55 -0
- data/app/controllers/page_controller.rb +2 -0
- data/app/helpers/ecm/cms_core_helper.rb +48 -0
- data/app/models/ecm/cms_core/folder.rb +65 -0
- data/app/models/ecm/cms_core/template.rb +150 -0
- data/config/locales/ecm.cms_core.de.yml +22 -0
- data/config/locales/ecm.cms_core.en.yml +22 -0
- data/config/locales/ecm.cms_core.folder.de.yml +13 -0
- data/config/locales/ecm.cms_core.folder.en.yml +13 -0
- data/config/locales/ecm.cms_core.forms.de.yml +8 -0
- data/config/locales/ecm.cms_core.template.de.yml +21 -0
- data/config/locales/ecm.cms_core.template.en.yml +21 -0
- data/db/migrate/001_create_ecm_cms_core_folders.rb +16 -0
- data/db/migrate/002_create_ecm_cms_core_templates.rb +19 -0
- data/lib/ecm/cms_core/engine.rb +25 -0
- data/lib/ecm/cms_core/version.rb +5 -0
- data/lib/ecm_cms_core.rb +13 -0
- data/lib/generators/ecm/cms_core/active_admin/active_admin_generator.rb +16 -0
- data/lib/generators/ecm/cms_core/active_admin/templates/folders.rb +44 -0
- data/lib/generators/ecm/cms_core/active_admin/templates/templates.rb +52 -0
- data/lib/generators/ecm/cms_core/controller/controller_generator.rb +15 -0
- data/lib/generators/ecm/cms_core/controller/templates/page_controller.rb +3 -0
- data/lib/generators/ecm/cms_core/install/install_generator.rb +34 -0
- data/lib/generators/ecm/cms_core/locales/locales_generator.rb +17 -0
- data/lib/generators/ecm/cms_core/locales/templates/ecm.cms-core.de.yml +48 -0
- data/lib/generators/ecm/cms_core/locales/templates/ecm.cms-core.en.yml +48 -0
- data/lib/generators/ecm/cms_core/migrations/migrations_generator.rb +28 -0
- data/lib/generators/ecm/cms_core/migrations/templates/create_ecm_cms_core_folders.rb +20 -0
- data/lib/generators/ecm/cms_core/migrations/templates/create_ecm_cms_core_templates.rb +23 -0
- data/lib/generators/ecm/cms_core/models/models_generator.rb +16 -0
- data/lib/generators/ecm/cms_core/models/templates/folder.rb +58 -0
- data/lib/generators/ecm/cms_core/models/templates/template.rb +127 -0
- data/lib/generators/ecm/cms_core/routes/routes_generator.rb +18 -0
- data/lib/generators/ecm/cms_core/routes/templates/routes.rb +14 -0
- data/lib/tasks/ecm_cms_core_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/admin/dashboards.rb +44 -0
- data/test/dummy/app/assets/javascripts/active_admin.js +1 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/active_admin.css.scss +6 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/frontend_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/admin_user.rb +11 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +60 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/active_admin.rb +133 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +232 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/admin_user.de.yml +16 -0
- data/test/dummy/config/locales/devise.en.yml +58 -0
- data/test/dummy/config/locales/ecm.admin.de.yml +5 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +75 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120622191421_devise_create_admin_users.rb +49 -0
- data/test/dummy/db/migrate/20120622211430_create_admin_notes.rb +17 -0
- data/test/dummy/db/migrate/20120622211431_move_admin_notes_to_comments.rb +25 -0
- data/test/dummy/db/migrate/20120622211432_create_ecm_cms_core_folders.ecm_cms_core_engine.rb +17 -0
- data/test/dummy/db/migrate/20120622211433_create_ecm_cms_core_templates.ecm_cms_core_engine.rb +20 -0
- data/test/dummy/db/schema.rb +78 -0
- data/test/dummy/lib/i18n_controller.rb +13 -0
- data/test/dummy/log/development.log +3914 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/admin_users.yml +11 -0
- data/test/dummy/test/unit/admin_user_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/C18/0B0/sprockets%2F35b3b1439378240b7f536115a153938b +0 -0
- data/test/dummy/tmp/cache/assets/C71/090/sprockets%2F931c90486b551252ac56132ab76b3d24 +0 -0
- data/test/dummy/tmp/cache/assets/C77/210/sprockets%2Ff90b51d7105d6180b8164f81f4018e40 +0 -0
- data/test/dummy/tmp/cache/assets/C7A/1D0/sprockets%2F0189934c63685d1fb1126608daf1425a +0 -0
- data/test/dummy/tmp/cache/assets/C86/B30/sprockets%2F85e65103906606f93dcb5680baf75803 +0 -0
- data/test/dummy/tmp/cache/assets/C88/8B0/sprockets%2F6680b99d2ee676651202ae63a78c4632 +0 -0
- data/test/dummy/tmp/cache/assets/CAD/7E0/sprockets%2F935781681cef3fc00956d32115cdd521 +0 -0
- data/test/dummy/tmp/cache/assets/CB0/2A0/sprockets%2F3481651900e045da49fced159c2c9814 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
- data/test/dummy/tmp/cache/assets/CDD/E00/sprockets%2Fb2e579afe803008df59253c7710ad551 +0 -0
- data/test/dummy/tmp/cache/assets/CEA/0A0/sprockets%2Ff1bd29507924f5fa43fb777b0d681295 +0 -0
- data/test/dummy/tmp/cache/assets/CF3/0B0/sprockets%2F0052f1e917b02a5ad4b2ca961221a8f4 +0 -0
- data/test/dummy/tmp/cache/assets/CFD/150/sprockets%2Fdb3d5b419b4002d3340c24b493d8bb95 +0 -0
- data/test/dummy/tmp/cache/assets/D08/3C0/sprockets%2Fbe501c50446a7f55d74e3d4a7920bb56 +0 -0
- data/test/dummy/tmp/cache/assets/D0A/5C0/sprockets%2Fb89637e3b60cf2ddbb055339f23a8421 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/A90/sprockets%2Fc50f8f2a758b0942172763af9a33b0ef +0 -0
- data/test/dummy/tmp/cache/assets/D1B/200/sprockets%2Fee63896e56c8fa545d2a92d3145a760d +0 -0
- data/test/dummy/tmp/cache/assets/D2E/DE0/sprockets%2F7668bdc951df66f9d93210ed7689bb57 +0 -0
- data/test/dummy/tmp/cache/assets/D30/D00/sprockets%2F506e8247250c45c101b1f6cefe7b22fb +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
- data/test/dummy/tmp/cache/assets/D3A/240/sprockets%2Fbd5ec81e43457436f38d6f2e21eb311b +0 -0
- data/test/dummy/tmp/cache/assets/D3D/B50/sprockets%2F60f3b6e7ec4196f82f701a039db5a55a +0 -0
- data/test/dummy/tmp/cache/assets/D46/720/sprockets%2Fef62800e7785cd1f7f7d7edb3960000e +0 -0
- data/test/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5B/860/sprockets%2F79ae2a01f99104da404ed31a8fea230d +0 -0
- data/test/dummy/tmp/cache/assets/D5D/6B0/sprockets%2F690ac8bc288fe688ce9d76121687c8bf +0 -0
- data/test/dummy/tmp/cache/assets/D5F/AE0/sprockets%2F6057dd9be3e736fad88777c09689bfe1 +0 -0
- data/test/dummy/tmp/cache/assets/D6B/E60/sprockets%2Ff93ae30e51558cab50c5867ffa4a714a +0 -0
- data/test/dummy/tmp/cache/assets/D7F/600/sprockets%2Fafd454e9dc29d3ce8f5fc810465219f6 +0 -0
- data/test/dummy/tmp/cache/assets/D84/500/sprockets%2Fe598c3010e9ff8a9fc930e84eb2b8f38 +0 -0
- data/test/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
- data/test/dummy/tmp/cache/assets/D96/0A0/sprockets%2F115d14ce48fada6837943c0e5b0a8eda +0 -0
- data/test/dummy/tmp/cache/assets/D97/060/sprockets%2F16cc3664c109be5b82c1521e4fe1fdfe +0 -0
- data/test/dummy/tmp/cache/assets/D9A/7F0/sprockets%2Fa9dc360a17e439e63ada3f389e053cda +0 -0
- data/test/dummy/tmp/cache/assets/D9C/4F0/sprockets%2Ffd36b6361b4bd8d3425f9aa35ff53dc1 +0 -0
- data/test/dummy/tmp/cache/assets/DAB/5A0/sprockets%2F2da87e72599a04cc89c8beec9218dd1a +0 -0
- data/test/dummy/tmp/cache/assets/DAC/1E0/sprockets%2Faf6be87981984ebc9b4f70a346dbea42 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_typography.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0149e15b7f61f5a238cd1c4ab956828760d53144/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/025ab9f29cb4b11e07ac4b96733b80e57356376f/_dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/sass/025ab9f29cb4b11e07ac4b96733b80e57356376f/_logged_out.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_typography.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0a3ebe071aa41297ff474bfea40b9ed55813ab31/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_batch_actions.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_blank_slates.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_links.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_popovers.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_scopes.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_status_tags.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_table_tools.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0db19bf6a4f34e09dc67d80432c747832dda1113/_tables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0f4e444537b0131df87c384df649d22afd80ac5a/_dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/sass/0f4e444537b0131df87c384df649d22afd80ac5a/_logged_out.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1c415517c309043503f3cb2f5eca65b0c9760f76/active_admin.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34122bbb9d39040bce83b198dfa3e2499be58cd0/_bourbon.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34df7e5f74ec615651dab1b9694e84563b724cb5/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34df7e5f74ec615651dab1b9694e84563b724cb5/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34df7e5f74ec615651dab1b9694e84563b724cb5/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34df7e5f74ec615651dab1b9694e84563b724cb5/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/34df7e5f74ec615651dab1b9694e84563b724cb5/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4330ed9682443ec12b5cc9718d9ca0f970e72645/print.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_button.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_clearfix.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_font-face.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_font-family.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_hide-text.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_html5-input-types.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_position.scssc +0 -0
- data/test/dummy/tmp/cache/sass/521b993c9acd187272527f2007471941399e49e7/_timing-functions.scssc +0 -0
- data/test/dummy/tmp/cache/sass/5a8f06dfcf99c0436939674b51a4e9800b2066e8/_footer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/5a8f06dfcf99c0436939674b51a4e9800b2066e8/_main_structure.scssc +0 -0
- data/test/dummy/tmp/cache/sass/5a8f06dfcf99c0436939674b51a4e9800b2066e8/_title_bar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_animation.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_appearance.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_background-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_background-size.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_border-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_border-radius.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_box-shadow.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_box-sizing.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_flex-box.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_inline-block.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_prefixer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_transform.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_transition.scssc +0 -0
- data/test/dummy/tmp/cache/sass/686dc179041c7d3a972dc3ec33726e7ae1e4ab05/_user-select.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_blank_slates.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_links.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_scopes.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_status_tags.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_table_tools.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/799f94dffbb29370035dd8035c06b45b72790fc5/_tables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_deprecated-webkit-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_flex-grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_grid-width.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_modular-scale.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_render-gradients.scssc +0 -0
- data/test/dummy/tmp/cache/sass/972efe55173f6628b13c5cb56b5b0f9b84985155/_tint-shade.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a6e19f0ba7c994b5cd1f8fcd2ef7cb5a62017be7/_bourbon.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a86a1245039dd9da2b0a1422db19889ca592daee/_footer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a86a1245039dd9da2b0a1422db19889ca592daee/_main_structure.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a86a1245039dd9da2b0a1422db19889ca592daee/_title_bar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_animation.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_appearance.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_background-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_background-size.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_border-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_border-radius.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_box-shadow.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_box-sizing.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_flex-box.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_inline-block.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_transform.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_transition.scssc +0 -0
- data/test/dummy/tmp/cache/sass/c572ddc25b7a57596b711c26460dab735895a907/_user-select.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_deprecated-webkit-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_flex-grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_grid-width.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_modular-scale.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_render-gradients.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_tint-shade.scssc +0 -0
- data/test/dummy/tmp/cache/sass/eab4ec523f2b3fe0ce62881e5ddde80ea26c42ed/_transition-property-name.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_button.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_clearfix.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_font-family.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_html5-input-types.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_position.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ecba858b902d0403d7e616a9f9672a7729dd00f2/_timing-functions.scssc +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/ecm_cms_core_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +669 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'EcmCmsCore'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.libs << 'lib'
|
32
|
+
t.libs << 'test'
|
33
|
+
t.pattern = 'test/**/*_test.rb'
|
34
|
+
t.verbose = false
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
task :default => :test
|
@@ -0,0 +1,46 @@
|
|
1
|
+
include CollectiveIdea::Acts::NestedSet::Helper
|
2
|
+
|
3
|
+
if defined?(ActiveAdmin)
|
4
|
+
ActiveAdmin.register Ecm::CmsCore::Folder do
|
5
|
+
menu :label => Ecm::CmsCore::Folder.model_name.human(:count => 10), :parent => I18n.t('ecm.cms_core.active_admin.menu')
|
6
|
+
|
7
|
+
scope :all
|
8
|
+
scope :root_folders
|
9
|
+
|
10
|
+
form do |f|
|
11
|
+
f.inputs do
|
12
|
+
f.input :parent, :as => :select, :collection => nested_set_options(Ecm::CmsCore::Folder, f.object) { |i| "#{'    ' * i.level} |--#{i.basename}".html_safe }
|
13
|
+
f.input :basename
|
14
|
+
end
|
15
|
+
f.buttons
|
16
|
+
end
|
17
|
+
|
18
|
+
index :title => Ecm::CmsCore::Folder.model_name.human(:count => 10) do
|
19
|
+
column :tree_label, :sortable => false
|
20
|
+
column :templates_count
|
21
|
+
column :created_at
|
22
|
+
column :updated_at
|
23
|
+
|
24
|
+
default_actions
|
25
|
+
end
|
26
|
+
|
27
|
+
show :title => :to_s do |folder|
|
28
|
+
attributes_table do
|
29
|
+
row :parent
|
30
|
+
row :basename
|
31
|
+
end
|
32
|
+
|
33
|
+
panel Ecm::CmsCore::Template.model_name.human(:count => 10) do
|
34
|
+
table_for folder.templates do
|
35
|
+
column Ecm::CmsCore::Template.human_attribute_name(:filename), :filename
|
36
|
+
column Ecm::CmsCore::Template.human_attribute_name(:partial), :formatted_partial_flag
|
37
|
+
column Ecm::CmsCore::Template.human_attribute_name(:created_at), :created_at
|
38
|
+
column Ecm::CmsCore::Template.human_attribute_name(:updated_at), :updated_at
|
39
|
+
column do |template|
|
40
|
+
link_to I18n.t('active_admin.view'), admin_ecm_cms_core_template_path(template), :class => "member_link view_link"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
if defined?(ActiveAdmin)
|
2
|
+
ActiveAdmin.register Ecm::CmsCore::Template do
|
3
|
+
menu :label => Ecm::CmsCore::Template.model_name.human(:count => :other), :parent => I18n.t('ecm.cms_core.active_admin.menu')
|
4
|
+
|
5
|
+
scope :all
|
6
|
+
scope :templates
|
7
|
+
scope :partials
|
8
|
+
|
9
|
+
|
10
|
+
form do |f|
|
11
|
+
f.inputs do
|
12
|
+
f.input :folder, :as => :select, :collection => nested_set_options(Ecm::CmsCore::Folder) { |i| "#{'    ' * i.level} |--#{i.basename}".html_safe }
|
13
|
+
f.input :basename
|
14
|
+
f.input :title
|
15
|
+
f.input :meta_description
|
16
|
+
f.input :body
|
17
|
+
f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
|
18
|
+
end
|
19
|
+
# f.inputs I18n.t("active_admin.forms.sections.#{resource.class.to_s.tableize.gsub('::', '/')}.advanced") do
|
20
|
+
f.inputs :"ecm/cms_core/template.advanced" do
|
21
|
+
f.input :layout
|
22
|
+
f.input :format, :as => :select, :collection => Mime::SET.symbols.map(&:to_s)
|
23
|
+
f.input :handler, :as => :select, :collection => ActionView::Template::Handlers.extensions.map(&:to_s)
|
24
|
+
f.input :partial
|
25
|
+
end
|
26
|
+
f.buttons
|
27
|
+
end
|
28
|
+
|
29
|
+
index :title => Ecm::CmsCore::Template.model_name.human(:count => 10) do
|
30
|
+
column :folder, :sortable => :pathname
|
31
|
+
column :filename, :sortable => :basename
|
32
|
+
column :formatted_partial_flag, :sortable => :partial
|
33
|
+
column :created_at
|
34
|
+
column :updated_at
|
35
|
+
|
36
|
+
default_actions
|
37
|
+
end
|
38
|
+
|
39
|
+
show :title => :to_s do
|
40
|
+
attributes_table do
|
41
|
+
row :folder
|
42
|
+
row :filename
|
43
|
+
row :title
|
44
|
+
row :meta_description
|
45
|
+
row :formatted_partial_flag
|
46
|
+
row :created_at
|
47
|
+
row :updated_at
|
48
|
+
end
|
49
|
+
|
50
|
+
panel Ecm::CmsCore::Template.human_attribute_name(:body) do
|
51
|
+
div do
|
52
|
+
textilize(ecm_cms_core_template.body).html_safe
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Ecm
|
2
|
+
module CmsCore
|
3
|
+
class PageController < ::FrontendController
|
4
|
+
include Ecm::CmsCoreHelper
|
5
|
+
|
6
|
+
append_view_path Template::Resolver.instance
|
7
|
+
|
8
|
+
def render_404
|
9
|
+
respond_to do |format|
|
10
|
+
format.html { render :file => "#{Rails.root}/public/404.html", :status => :not_found, :layout => nil }
|
11
|
+
format.xml { head :not_found }
|
12
|
+
format.any { head :not_found }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def respond
|
17
|
+
page, pathname, basename = extract_names_from_params
|
18
|
+
|
19
|
+
if template = Template.where(:pathname => pathname).where(:basename => basename).where(:locale => I18n.locale).first
|
20
|
+
@meta_description = template.meta_description
|
21
|
+
@title = template.title
|
22
|
+
layout = template.layout unless template.layout.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
if layout.respond_to?(:length) && layout.length > 0
|
27
|
+
render :template => page, :layout => template.layout
|
28
|
+
else
|
29
|
+
render :template => page
|
30
|
+
end
|
31
|
+
rescue ActionView::MissingTemplate
|
32
|
+
render_404
|
33
|
+
end
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
37
|
+
def extract_names_from_params
|
38
|
+
page = params[:page]
|
39
|
+
page ||= "/home/index"
|
40
|
+
pathname = "#{I18n.locale}"
|
41
|
+
|
42
|
+
subpath = page.split("/").reverse.drop(1).reverse.join("/").sub(/(\/)+$/,'')
|
43
|
+
if subpath.length > 0
|
44
|
+
pathname << "#{subpath}"
|
45
|
+
end
|
46
|
+
pathname << '/' unless pathname.end_with?('/')
|
47
|
+
basename = page.split("/").last
|
48
|
+
logger.debug("pathname: #{pathname}")
|
49
|
+
logger.debug("basename: #{basename}")
|
50
|
+
return page, pathname, basename
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Ecm::CmsCoreHelper
|
2
|
+
def cms_body_classes
|
3
|
+
url_for().gsub("/", " ").strip!
|
4
|
+
end
|
5
|
+
|
6
|
+
def cms_page_stylesheets(namespace = nil)
|
7
|
+
output = ""
|
8
|
+
if namespace
|
9
|
+
namespace_string = "#{namespace}/"
|
10
|
+
else
|
11
|
+
namespace_string = ""
|
12
|
+
end
|
13
|
+
url_for().split("/").each do |path_part|
|
14
|
+
output << stylesheet_link_tag("#{namespace_string}#{path_part}.css", :media => 'screen') unless path_part.blank? || path_part.length == 1
|
15
|
+
end
|
16
|
+
output.html_safe
|
17
|
+
end
|
18
|
+
|
19
|
+
def cms_title(site_title = "Change me")
|
20
|
+
return "#{site_title} - #{@title}" if @title
|
21
|
+
site_title
|
22
|
+
end
|
23
|
+
|
24
|
+
def cms_meta_description
|
25
|
+
@meta_description
|
26
|
+
end
|
27
|
+
|
28
|
+
def render_fragment(name)
|
29
|
+
if controller_name == 'page'
|
30
|
+
page = (params[:page].nil?) ? "home" : params[:page]
|
31
|
+
else
|
32
|
+
page = request.fullpath.gsub(/\/#{I18n.locale}\//, '')
|
33
|
+
end
|
34
|
+
|
35
|
+
path = "#{name.to_s}/#{page}"
|
36
|
+
full_path = "#{I18n.locale}/#{path}"
|
37
|
+
|
38
|
+
begin
|
39
|
+
render path
|
40
|
+
rescue ActionView::MissingTemplate => e
|
41
|
+
if Rails.env.production?
|
42
|
+
return nil
|
43
|
+
else
|
44
|
+
return I18n.t("ecm.cms_core.warnings.missing_fragment", :name => full_path)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Ecm
|
2
|
+
module CmsCore
|
3
|
+
class Folder < ActiveRecord::Base
|
4
|
+
self.table_name = 'ecm_cms_core_folders'
|
5
|
+
|
6
|
+
has_many :templates, :dependent => :destroy
|
7
|
+
|
8
|
+
validates :basename, :presence => true, :uniqueness => { :scope => :parent_id }
|
9
|
+
|
10
|
+
acts_as_nested_set :depth_column => 'depth', :counter_cache => :children_count
|
11
|
+
attr_protected :lft, :rgt
|
12
|
+
|
13
|
+
before_validation :update_path
|
14
|
+
after_save :update_children, :if => Proc.new { |folder| folder.pathname_changed? or folder.basename_changed? }
|
15
|
+
after_save :update_templates, :if => Proc.new { |folder| folder.pathname_changed? or folder.basename_changed? }
|
16
|
+
|
17
|
+
default_scope order(:lft)
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
self.fullname
|
21
|
+
# self.tree_label
|
22
|
+
end
|
23
|
+
|
24
|
+
def tree_label
|
25
|
+
"#{'    ' * self.level} |--#{self.basename}".html_safe
|
26
|
+
end
|
27
|
+
|
28
|
+
def fullname
|
29
|
+
if self.basename == "/"
|
30
|
+
"/"
|
31
|
+
else
|
32
|
+
"#{self.pathname}#{self.basename}/"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def update_path
|
37
|
+
if self.parent
|
38
|
+
self.pathname = self.parent.fullname
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_path!
|
43
|
+
self.update_path
|
44
|
+
self.save
|
45
|
+
end
|
46
|
+
|
47
|
+
def update_children
|
48
|
+
self.children.each do |folder|
|
49
|
+
folder.update_path!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def update_templates
|
54
|
+
self.templates.each do |template|
|
55
|
+
template.update_pathname!
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.root_folders
|
60
|
+
self.roots
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module Ecm
|
2
|
+
module CmsCore
|
3
|
+
class Template < ActiveRecord::Base
|
4
|
+
self.table_name = 'ecm_cms_core_templates'
|
5
|
+
|
6
|
+
belongs_to :folder, :counter_cache => true
|
7
|
+
|
8
|
+
validates :pathname, :presence => true
|
9
|
+
validates :basename, :presence => true, :uniqueness => { :scope => :folder_id }
|
10
|
+
validates :format, :inclusion => ::Mime::SET.symbols.map(&:to_s), :allow_nil => true, :allow_blank => true
|
11
|
+
validates :locale, :inclusion => ::I18n.available_locales.map(&:to_s)
|
12
|
+
validates :handler, :inclusion => ::ActionView::Template::Handlers.extensions.map(&:to_s)
|
13
|
+
|
14
|
+
after_initialize :set_defaults
|
15
|
+
|
16
|
+
before_validation :update_pathname
|
17
|
+
|
18
|
+
attr_accessible :folder_id, :basename, :title, :meta_description, :body, :layout, :locale, :format, :handler, :partial
|
19
|
+
|
20
|
+
def set_defaults
|
21
|
+
unless self.persisted?
|
22
|
+
self.locale ||= I18n.default_locale
|
23
|
+
self.format ||= 'html'
|
24
|
+
self.handler ||= 'texterb'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def update_pathname
|
29
|
+
self.pathname = self.folder.fullname unless self.folder.blank?
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_pathname!
|
33
|
+
self.update_pathname
|
34
|
+
self.save!
|
35
|
+
end
|
36
|
+
|
37
|
+
after_save do
|
38
|
+
Resolver.instance.clear_cache
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.partials
|
42
|
+
where("partial = ?", true)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.templates
|
46
|
+
where("partial = ?", false)
|
47
|
+
end
|
48
|
+
|
49
|
+
def filename
|
50
|
+
if format.blank?
|
51
|
+
"#{basename}.#{locale}.#{handler}"
|
52
|
+
else
|
53
|
+
"#{basename}.#{locale}.#{format}.#{handler}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def formatted_partial_flag
|
58
|
+
::I18n.t(self.partial.to_s)
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_s
|
62
|
+
"#{self.pathname}#{self.basename}"
|
63
|
+
end
|
64
|
+
|
65
|
+
class Resolver < ActionView::Resolver
|
66
|
+
require "singleton"
|
67
|
+
include Singleton
|
68
|
+
|
69
|
+
def find_templates(name, prefix, partial, details)
|
70
|
+
if prefix.length > 0
|
71
|
+
pathname = "#{normalize_array(details[:locale]).first}/#{prefix}/"
|
72
|
+
else
|
73
|
+
pathname = "#{normalize_array(details[:locale]).first}/"
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
# ActiveRecord::Base.logger.debug("prefix: #{prefix}")
|
78
|
+
ActiveRecord::Base.logger.debug("pathname: #{pathname}")
|
79
|
+
ActiveRecord::Base.logger.debug("basename: #{name}")
|
80
|
+
|
81
|
+
conditions = {
|
82
|
+
# :pathname => normalize_path(name, prefix),
|
83
|
+
:pathname => pathname,
|
84
|
+
:basename => name,
|
85
|
+
:locale => normalize_array(details[:locale]).first,
|
86
|
+
:format => normalize_array(details[:formats]).first,
|
87
|
+
:handler => normalize_array(details[:handlers]),
|
88
|
+
:partial => partial || false
|
89
|
+
}
|
90
|
+
|
91
|
+
format = conditions.delete(:format)
|
92
|
+
query = Ecm::CmsCore::Template.where(conditions)
|
93
|
+
|
94
|
+
# 2) Check for templates with the given format or format is nil
|
95
|
+
query = query.where(["format = ? OR format = ''", format])
|
96
|
+
|
97
|
+
# 3) Ensure templates with format come first
|
98
|
+
query = query.order("format DESC")
|
99
|
+
|
100
|
+
# 4) Now trigger the query passing on conditions to initialization
|
101
|
+
query.map do |record|
|
102
|
+
initialize_template(record, details)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Normalize name and prefix, so the tuple ["index", "users"] becomes
|
107
|
+
# "users/index" and the tuple ["template", nil] becomes "template".
|
108
|
+
def normalize_path(name, prefix)
|
109
|
+
prefix.present? ? "#{prefix}/#{name}" : name
|
110
|
+
end
|
111
|
+
|
112
|
+
# Normalize arrays by converting all symbols to strings.
|
113
|
+
def normalize_array(array)
|
114
|
+
array.map(&:to_s)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Initialize an ActionView::Template object based on the record found.
|
118
|
+
def initialize_template(record, details)
|
119
|
+
source = record.body
|
120
|
+
identifier = "Template - #{record.id} - #{record.pathname.inspect}"
|
121
|
+
handler = ::ActionView::Template.registered_template_handler(record.handler)
|
122
|
+
|
123
|
+
# 5) Check for the record.format, if none is given, try the template
|
124
|
+
# handler format and fallback to the one given on conditions
|
125
|
+
format = record.format && Mime[record.format]
|
126
|
+
format ||= handler.default_format if handler.respond_to?(:default_format)
|
127
|
+
format ||= details[:formats]
|
128
|
+
|
129
|
+
details = {
|
130
|
+
:format => format,
|
131
|
+
:updated_at => record.updated_at,
|
132
|
+
:virtual_path => virtual_path(record.pathname, record.partial)
|
133
|
+
}
|
134
|
+
|
135
|
+
::ActionView::Template.new(source, identifier, handler, details)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Make paths as "users/user" become "users/_user" for partials.
|
139
|
+
def virtual_path(path, partial)
|
140
|
+
return path unless partial
|
141
|
+
if index = path.rindex("/")
|
142
|
+
path.insert(index + 1, "_")
|
143
|
+
else
|
144
|
+
"_#{path}"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
de:
|
2
|
+
:false: "nein"
|
3
|
+
:true: "ja"
|
4
|
+
active_admin:
|
5
|
+
scopes:
|
6
|
+
all: "Alle"
|
7
|
+
templates: "Seiten"
|
8
|
+
root_folders: "Wurzelordner"
|
9
|
+
partials: "Fragmente"
|
10
|
+
ecm:
|
11
|
+
cms_core:
|
12
|
+
active_admin:
|
13
|
+
menu: "CMS"
|
14
|
+
warnings:
|
15
|
+
missing_fragment: "Fehlendes Fragment: %{name}"
|
16
|
+
formtastic:
|
17
|
+
:yes: 'Ja'
|
18
|
+
:no: 'Nein'
|
19
|
+
:create: '%{model} erstellen'
|
20
|
+
:update: '%{model} aktualisieren'
|
21
|
+
:submit: '%{model} speichern'
|
22
|
+
:required: 'benötigt'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
en:
|
2
|
+
:false: "nein"
|
3
|
+
:true: "ja"
|
4
|
+
active_admin:
|
5
|
+
scopes:
|
6
|
+
all: "All"
|
7
|
+
templates: "Templates"
|
8
|
+
root_folders: "Root folders"
|
9
|
+
partials: "Partials"
|
10
|
+
ecm:
|
11
|
+
cms_core:
|
12
|
+
active_admin:
|
13
|
+
menu: "CMS"
|
14
|
+
warnings:
|
15
|
+
missing_fragment: "Missing fragment: %{name}"
|
16
|
+
formtastic:
|
17
|
+
:yes: 'Yes'
|
18
|
+
:no: 'No'
|
19
|
+
:create: 'create %{model}'
|
20
|
+
:update: 'update %{model}'
|
21
|
+
:submit: 'submit %{model}'
|
22
|
+
:required: 'required'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
de:
|
2
|
+
activerecord:
|
3
|
+
attributes:
|
4
|
+
ecm/cms_core/template:
|
5
|
+
basename: "Name"
|
6
|
+
body: "Inhalt"
|
7
|
+
layout: "Layout"
|
8
|
+
locale: "Sprache"
|
9
|
+
filename: "Dateiname"
|
10
|
+
folder: "Ordner"
|
11
|
+
formatted_partial_flag: "Fragment"
|
12
|
+
format: "Format"
|
13
|
+
handler: "Handler"
|
14
|
+
meta_description: "Meta Description"
|
15
|
+
partial: "Fragment"
|
16
|
+
pathname: "Pfad"
|
17
|
+
title: "Titel"
|
18
|
+
models:
|
19
|
+
ecm/cms_core/template:
|
20
|
+
one: "Seite"
|
21
|
+
other: "Seiten"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
en:
|
2
|
+
activerecord:
|
3
|
+
attributes:
|
4
|
+
ecm/cms_core/template:
|
5
|
+
basename: "Name"
|
6
|
+
body: "Content"
|
7
|
+
layout: "Layout"
|
8
|
+
locale: "Language"
|
9
|
+
filename: "Filename"
|
10
|
+
folder: "Folder"
|
11
|
+
formatted_partial_flag: "Partial"
|
12
|
+
format: "Format"
|
13
|
+
handler: "Handler"
|
14
|
+
meta_description: "Meta Description"
|
15
|
+
partial: "Partial"
|
16
|
+
pathname: "Path"
|
17
|
+
title: "Title"
|
18
|
+
models:
|
19
|
+
ecm/cms_core/template:
|
20
|
+
one: "Page"
|
21
|
+
other: "Pages"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateEcmCmsCoreFolders < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_cms_core_folders do |t|
|
4
|
+
t.references :parent
|
5
|
+
t.string :basename
|
6
|
+
t.string :pathname
|
7
|
+
t.integer :lft
|
8
|
+
t.integer :rgt
|
9
|
+
t.integer :depth
|
10
|
+
t.integer :children_count, :default => 0
|
11
|
+
t.integer :templates_count, :default => 0
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateEcmCmsCoreTemplates < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_cms_core_templates do |t|
|
4
|
+
t.references :folder
|
5
|
+
t.string :pathname
|
6
|
+
t.string :basename
|
7
|
+
t.string :title
|
8
|
+
t.text :meta_description
|
9
|
+
t.text :body
|
10
|
+
t.string :layout
|
11
|
+
t.string :locale
|
12
|
+
t.string :format
|
13
|
+
t.string :handler
|
14
|
+
t.boolean :partial, :default => false
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ecm
|
2
|
+
module CmsCore
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
paths["config/locales"] << File.dirname(__FILE__) + '/../../../config/locales'
|
5
|
+
|
6
|
+
# Enabling assets precompiling under rails 3.1 or greater
|
7
|
+
if Rails.version >= '3.1'
|
8
|
+
initializer "ecm_pictures.asset_pipeline" do |app|
|
9
|
+
app.config.assets.precompile << 'ecm_cms_core.js'
|
10
|
+
app.config.assets.precompile << 'ecm_cms_core.css'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
config.to_prepare do
|
15
|
+
ApplicationController.helper(Ecm::CmsCoreHelper)
|
16
|
+
end
|
17
|
+
|
18
|
+
initializer :ecm_pictures_engine do
|
19
|
+
ActiveAdmin.setup do |active_admin_config|
|
20
|
+
active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/../../../app/admin']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|