activeadmin-selleo-cms 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/app/admin/active_admin/views_helper.rb +8 -8
  2. data/app/admin/activeadmin_selleo_cms/asset.rb +1 -8
  3. data/app/admin/activeadmin_selleo_cms/page.rb +8 -6
  4. data/app/admin/activeadmin_selleo_cms/section.rb +44 -0
  5. data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +1 -1
  6. data/app/assets/javascripts/ckeditor/config.js +171 -0
  7. data/app/controllers/cms_controller.rb +12 -0
  8. data/app/controllers/locales_controller.rb +6 -0
  9. data/app/controllers/pages_controller.rb +36 -0
  10. data/app/controllers/searches_controller.rb +6 -0
  11. data/app/helpers/pages_helper.rb +40 -0
  12. data/app/models/activeadmin_selleo_cms/icon.rb +1 -1
  13. data/app/models/activeadmin_selleo_cms/layout.rb +43 -2
  14. data/app/models/activeadmin_selleo_cms/page.rb +63 -10
  15. data/app/models/activeadmin_selleo_cms/section.rb +16 -0
  16. data/app/views/admin/assets/destroy.js.erb +1 -0
  17. data/app/views/admin/pages/_form.html.haml +11 -15
  18. data/app/views/admin/pages/_translated_fields.html.haml +11 -1
  19. data/app/views/admin/sections/_form.html.haml +36 -0
  20. data/app/views/pages/show.html.haml +5 -0
  21. data/app/views/{activeadmin_selleo_cms/searches → searches}/show.html.haml +0 -0
  22. data/config/initializers/active_admin.rb +6 -0
  23. data/config/initializers/i18n.rb +2 -0
  24. data/config/locales/cms.en.yml +2 -1
  25. data/config/routes.rb +12 -3
  26. data/db/migrate/20121129142932_create_activeadmin_selleo_cms_pages.rb +1 -1
  27. data/db/migrate/20130108153415_add_redirect_to_first_sub_page.rb +10 -0
  28. data/db/migrate/20130109132745_add_fields_to_page.rb +9 -0
  29. data/lib/activeadmin-selleo-cms/engine.rb +4 -0
  30. data/lib/activeadmin-selleo-cms/version.rb +1 -1
  31. data/lib/tasks/rebuild.rake +20 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +1 -5
  33. data/spec/dummy/app/views/layouts/cms.html.erb +11 -3
  34. data/spec/dummy/app/views/layouts/haml.html.haml +1 -0
  35. data/spec/dummy/db/migrate/{20130103215140_create_activeadmin_selleo_cms_pages.activeadmin_selleo_cms.rb → 20130117150800_create_activeadmin_selleo_cms_pages.activeadmin_selleo_cms.rb} +1 -1
  36. data/spec/dummy/db/migrate/{20130103215141_create_activeadmin_selleo_cms_locales.activeadmin_selleo_cms.rb → 20130117150801_create_activeadmin_selleo_cms_locales.activeadmin_selleo_cms.rb} +0 -0
  37. data/spec/dummy/db/migrate/{20130103215142_create_ckeditor_assets.activeadmin_selleo_cms.rb → 20130117150802_create_ckeditor_assets.activeadmin_selleo_cms.rb} +0 -0
  38. data/spec/dummy/db/migrate/{20130103215143_create_activeadmin_selleo_cms_sections.activeadmin_selleo_cms.rb → 20130117150803_create_activeadmin_selleo_cms_sections.activeadmin_selleo_cms.rb} +0 -0
  39. data/spec/dummy/db/migrate/{20130103215144_create_activeadmin_selleo_cms_searches.activeadmin_selleo_cms.rb → 20130117150804_create_activeadmin_selleo_cms_searches.activeadmin_selleo_cms.rb} +0 -0
  40. data/spec/dummy/db/migrate/{20130103215145_create_translations.activeadmin_selleo_cms.rb → 20130117150805_create_translations.activeadmin_selleo_cms.rb} +0 -0
  41. data/spec/dummy/db/migrate/{20130103215146_create_activeadmin_selleo_cms_assets.activeadmin_selleo_cms.rb → 20130117150806_create_activeadmin_selleo_cms_assets.activeadmin_selleo_cms.rb} +0 -0
  42. data/spec/dummy/db/migrate/20130117150807_add_redirect_to_first_sub_page.activeadmin_selleo_cms.rb +11 -0
  43. data/spec/dummy/db/migrate/20130117150808_add_fields_to_page.activeadmin_selleo_cms.rb +10 -0
  44. data/spec/dummy/db/schema.rb +9 -7
  45. data/spec/dummy/db/snapshots/test_database.sql +2 -2
  46. data/spec/dummy/log/test.log +125756 -0
  47. data/spec/dummy/tmp/cache/assets/CB7/190/sprockets%2F136a9350fa75f3336af293952861ed6d +0 -0
  48. data/spec/dummy/tmp/cache/assets/CD3/3E0/sprockets%2F373fa62090ab111ae606b963e1b8c793 +0 -0
  49. data/spec/dummy/tmp/cache/assets/D2C/2E0/sprockets%2Fa031c32e27ced12f81d4326f8b52fb23 +0 -0
  50. data/spec/dummy/tmp/cache/assets/D63/6C0/sprockets%2F1ae1f1cf9d92d0e61b7006171a39fd4d +0 -0
  51. data/spec/dummy/tmp/cache/assets/DB2/EA0/sprockets%2Ffead656b8b83fbae9f69435c33b4649d +0 -0
  52. data/spec/dummy/tmp/cache/assets/E37/3E0/sprockets%2F9e6d2d17ed6da64a2f1876d4cdfefcd1 +0 -0
  53. data/spec/dummy/tmp/capybara/capybara-201301081556598147527968.html +13 -0
  54. data/spec/dummy/tmp/capybara/capybara-201301081558042145012026.html +23 -0
  55. data/spec/dummy/tmp/capybara/capybara-201301081559296090328502.html +24 -0
  56. data/spec/dummy/tmp/capybara/capybara-201301101624594727125473.html +13 -0
  57. data/spec/dummy/tmp/capybara/capybara-201301101625068619114008.html +13 -0
  58. data/spec/dummy/tmp/capybara/capybara-201301101625104331710400.html +13 -0
  59. data/spec/dummy/tmp/capybara/capybara-201301101625154735808799.html +13 -0
  60. data/spec/factories/pages.rb +4 -2
  61. data/spec/models/activeadmin_selleo_cms/layout_spec.rb +4 -0
  62. data/spec/models/activeadmin_selleo_cms/page_spec.rb +98 -3
  63. data/spec/requests/pages_spec.rb +8 -0
  64. data/spec/spec_helper.rb +3 -2
  65. data/spec/support/pages_helper.rb +5 -2
  66. metadata +90 -41
  67. data/app/controllers/activeadmin_selleo_cms/application_controller.rb +0 -13
  68. data/app/controllers/activeadmin_selleo_cms/locales_controller.rb +0 -8
  69. data/app/controllers/activeadmin_selleo_cms/pages_controller.rb +0 -15
  70. data/app/controllers/activeadmin_selleo_cms/searches_controller.rb +0 -8
  71. data/app/helpers/activeadmin_selleo_cms/application_helper.rb +0 -31
  72. data/app/views/activeadmin_selleo_cms/pages/show.html.haml +0 -3
@@ -1,13 +0,0 @@
1
- module ActiveadminSelleoCms
2
- class ApplicationController < ApplicationController
3
-
4
- before_filter do
5
- set_locale(params[:locale])
6
- end
7
-
8
- def set_locale(locale_code = :en)
9
- I18n.locale = locale_code
10
- end
11
-
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- module ActiveadminSelleoCms
2
- class LocalesController < ActiveadminSelleoCms::ApplicationController
3
- def change
4
- I18n.locale = params[:locale]
5
- redirect_to root_url
6
- end
7
- end
8
- end
@@ -1,15 +0,0 @@
1
- module ActiveadminSelleoCms
2
- class PagesController < ActiveadminSelleoCms::ApplicationController
3
- def show
4
- if params[:id] and @page = Page.published.find_by_slug(params[:id])
5
- render action: :show, layout: @page.layout
6
- elsif params[:id]
7
- redirect_to "/#{I18n.locale}"
8
- else
9
- @page = Page.roots.reorder("id ASC").first
10
- render action: :show, layout: @page.layout
11
- end
12
- @page.increment!(:views) if @page
13
- end
14
- end
15
- end
@@ -1,8 +0,0 @@
1
- module ActiveadminSelleoCms
2
- class SearchesController < ActiveadminSelleoCms::ApplicationController
3
- def show
4
- @results = Search.current_locale.search_by_content(params[:id]).map(&:searchable).uniq
5
- render action: :show, layout: 'search'
6
- end
7
- end
8
- end
@@ -1,31 +0,0 @@
1
- module ActiveadminSelleoCms
2
- module ApplicationHelper
3
- def link_to_locale(link_name, locale, page=nil)
4
- if page
5
- link_to link_name, page_path(locale.code, page.translated_attribute(:slug, locale.code))
6
- elsif request.fullpath.match(/^\/\w{2}\/.*/)
7
- link_to link_name, request.fullpath.gsub(/^\/(\w{2})\//, "/#{locale.code}/")
8
- else
9
- link_to link_name, "/#{locale.code}"
10
- end
11
- end
12
-
13
- def link_to_search_result(result)
14
- if result.is_a? Page
15
- link_to result, page_path(I18n.locale, result)
16
- end
17
- end
18
-
19
- def url_to_page(page)
20
- if page.is_link_url
21
- page.link_url
22
- else
23
- page_path(I18n.locale, page)
24
- end
25
- end
26
-
27
- def link_to_page(page, link_name=nil)
28
- link_to (link_name || page.title), url_to_page(page)
29
- end
30
- end
31
- end
@@ -1,3 +0,0 @@
1
- - @page.sections.each do |section|
2
- - content_for section.name.to_sym do
3
- = section.body.html_safe if section.body