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.
- data/app/admin/active_admin/views_helper.rb +8 -8
- data/app/admin/activeadmin_selleo_cms/asset.rb +1 -8
- data/app/admin/activeadmin_selleo_cms/page.rb +8 -6
- data/app/admin/activeadmin_selleo_cms/section.rb +44 -0
- data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +1 -1
- data/app/assets/javascripts/ckeditor/config.js +171 -0
- data/app/controllers/cms_controller.rb +12 -0
- data/app/controllers/locales_controller.rb +6 -0
- data/app/controllers/pages_controller.rb +36 -0
- data/app/controllers/searches_controller.rb +6 -0
- data/app/helpers/pages_helper.rb +40 -0
- data/app/models/activeadmin_selleo_cms/icon.rb +1 -1
- data/app/models/activeadmin_selleo_cms/layout.rb +43 -2
- data/app/models/activeadmin_selleo_cms/page.rb +63 -10
- data/app/models/activeadmin_selleo_cms/section.rb +16 -0
- data/app/views/admin/assets/destroy.js.erb +1 -0
- data/app/views/admin/pages/_form.html.haml +11 -15
- data/app/views/admin/pages/_translated_fields.html.haml +11 -1
- data/app/views/admin/sections/_form.html.haml +36 -0
- data/app/views/pages/show.html.haml +5 -0
- data/app/views/{activeadmin_selleo_cms/searches → searches}/show.html.haml +0 -0
- data/config/initializers/active_admin.rb +6 -0
- data/config/initializers/i18n.rb +2 -0
- data/config/locales/cms.en.yml +2 -1
- data/config/routes.rb +12 -3
- data/db/migrate/20121129142932_create_activeadmin_selleo_cms_pages.rb +1 -1
- data/db/migrate/20130108153415_add_redirect_to_first_sub_page.rb +10 -0
- data/db/migrate/20130109132745_add_fields_to_page.rb +9 -0
- data/lib/activeadmin-selleo-cms/engine.rb +4 -0
- data/lib/activeadmin-selleo-cms/version.rb +1 -1
- data/lib/tasks/rebuild.rake +20 -0
- data/spec/dummy/app/views/layouts/application.html.erb +1 -5
- data/spec/dummy/app/views/layouts/cms.html.erb +11 -3
- data/spec/dummy/app/views/layouts/haml.html.haml +1 -0
- 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
- 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
- data/spec/dummy/db/migrate/{20130103215142_create_ckeditor_assets.activeadmin_selleo_cms.rb → 20130117150802_create_ckeditor_assets.activeadmin_selleo_cms.rb} +0 -0
- 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
- 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
- data/spec/dummy/db/migrate/{20130103215145_create_translations.activeadmin_selleo_cms.rb → 20130117150805_create_translations.activeadmin_selleo_cms.rb} +0 -0
- 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
- data/spec/dummy/db/migrate/20130117150807_add_redirect_to_first_sub_page.activeadmin_selleo_cms.rb +11 -0
- data/spec/dummy/db/migrate/20130117150808_add_fields_to_page.activeadmin_selleo_cms.rb +10 -0
- data/spec/dummy/db/schema.rb +9 -7
- data/spec/dummy/db/snapshots/test_database.sql +2 -2
- data/spec/dummy/log/test.log +125756 -0
- data/spec/dummy/tmp/cache/assets/CB7/190/sprockets%2F136a9350fa75f3336af293952861ed6d +0 -0
- data/spec/dummy/tmp/cache/assets/CD3/3E0/sprockets%2F373fa62090ab111ae606b963e1b8c793 +0 -0
- data/spec/dummy/tmp/cache/assets/D2C/2E0/sprockets%2Fa031c32e27ced12f81d4326f8b52fb23 +0 -0
- data/spec/dummy/tmp/cache/assets/D63/6C0/sprockets%2F1ae1f1cf9d92d0e61b7006171a39fd4d +0 -0
- data/spec/dummy/tmp/cache/assets/DB2/EA0/sprockets%2Ffead656b8b83fbae9f69435c33b4649d +0 -0
- data/spec/dummy/tmp/cache/assets/E37/3E0/sprockets%2F9e6d2d17ed6da64a2f1876d4cdfefcd1 +0 -0
- data/spec/dummy/tmp/capybara/capybara-201301081556598147527968.html +13 -0
- data/spec/dummy/tmp/capybara/capybara-201301081558042145012026.html +23 -0
- data/spec/dummy/tmp/capybara/capybara-201301081559296090328502.html +24 -0
- data/spec/dummy/tmp/capybara/capybara-201301101624594727125473.html +13 -0
- data/spec/dummy/tmp/capybara/capybara-201301101625068619114008.html +13 -0
- data/spec/dummy/tmp/capybara/capybara-201301101625104331710400.html +13 -0
- data/spec/dummy/tmp/capybara/capybara-201301101625154735808799.html +13 -0
- data/spec/factories/pages.rb +4 -2
- data/spec/models/activeadmin_selleo_cms/layout_spec.rb +4 -0
- data/spec/models/activeadmin_selleo_cms/page_spec.rb +98 -3
- data/spec/requests/pages_spec.rb +8 -0
- data/spec/spec_helper.rb +3 -2
- data/spec/support/pages_helper.rb +5 -2
- metadata +90 -41
- data/app/controllers/activeadmin_selleo_cms/application_controller.rb +0 -13
- data/app/controllers/activeadmin_selleo_cms/locales_controller.rb +0 -8
- data/app/controllers/activeadmin_selleo_cms/pages_controller.rb +0 -15
- data/app/controllers/activeadmin_selleo_cms/searches_controller.rb +0 -8
- data/app/helpers/activeadmin_selleo_cms/application_helper.rb +0 -31
- data/app/views/activeadmin_selleo_cms/pages/show.html.haml +0 -3
@@ -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,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
|