kuhsaft 0.3.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +127 -77
- data/Rakefile +15 -10
- data/app/assets/javascripts/kuhsaft/application.js +2 -0
- data/app/assets/javascripts/kuhsaft/cms/application.js +16 -4
- data/app/assets/javascripts/kuhsaft/cms/customizations.js +1 -0
- data/app/assets/stylesheets/kuhsaft/application.css.sass +4 -0
- data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +125 -0
- data/app/assets/stylesheets/kuhsaft/cms/customizations.css.sass +1 -0
- data/app/controllers/kuhsaft/application_controller.rb +5 -0
- data/app/controllers/kuhsaft/cms/admin_controller.rb +8 -10
- data/app/controllers/kuhsaft/cms/bricks_controller.rb +35 -0
- data/app/controllers/kuhsaft/cms/pages_controller.rb +16 -19
- data/app/controllers/kuhsaft/pages_controller.rb +4 -10
- data/app/helpers/cms_helper.rb +3 -3
- data/app/helpers/kuhsaft/application_helper.rb +21 -0
- data/app/helpers/kuhsaft/cms/application_helper.rb +10 -0
- data/app/helpers/kuhsaft/cms/pages_helper.rb +14 -0
- data/app/helpers/pages_helper.rb +18 -21
- data/app/models/kuhsaft/accordion_brick.rb +16 -0
- data/app/models/kuhsaft/accordion_item_brick.rb +22 -0
- data/app/models/kuhsaft/brick.rb +85 -0
- data/app/models/kuhsaft/brick_type.rb +7 -0
- data/app/models/kuhsaft/cms.rb +7 -0
- data/app/models/kuhsaft/cms/admin.rb +20 -0
- data/app/models/kuhsaft/column_brick.rb +23 -0
- data/app/models/kuhsaft/image_brick.rb +19 -0
- data/app/models/kuhsaft/image_size.rb +52 -0
- data/app/models/kuhsaft/link_brick.rb +19 -0
- data/app/models/kuhsaft/page.rb +83 -101
- data/app/models/kuhsaft/partition.rb +18 -0
- data/app/models/kuhsaft/placeholder_brick.rb +11 -0
- data/app/models/kuhsaft/slider_brick.rb +16 -0
- data/app/models/kuhsaft/text_brick.rb +9 -0
- data/app/models/kuhsaft/two_column_brick.rb +50 -0
- data/app/models/kuhsaft/video_brick.rb +20 -0
- data/app/uploaders/kuhsaft/asset_uploader.rb +2 -2
- data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +63 -0
- data/app/views/kuhsaft/accordion_bricks/_accordion_brick.html.haml +3 -0
- data/app/{assets/stylesheets/kuhsaft/cms/base/partials/_forms.css.sass → views/kuhsaft/accordion_bricks/accordion_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/accordion_item_bricks/_accordion_item_brick.html.haml +8 -0
- data/app/views/kuhsaft/accordion_item_bricks/accordion_item_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +10 -0
- data/app/views/kuhsaft/cms/admin/_content_language_switch.html.haml +7 -0
- data/app/views/kuhsaft/cms/admin/_empty_state.html.haml +5 -0
- data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +6 -0
- data/app/views/kuhsaft/cms/assets/index.html.haml +2 -2
- data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +38 -0
- data/app/views/kuhsaft/cms/bricks/_brick_list.html.haml +4 -0
- data/app/views/kuhsaft/cms/bricks/create.js.haml +1 -0
- data/app/views/kuhsaft/cms/bricks/destroy.js.haml +7 -0
- data/app/views/kuhsaft/cms/bricks/update.js.haml +2 -0
- data/app/views/kuhsaft/cms/pages/_branch.html.haml +17 -9
- data/app/views/kuhsaft/cms/pages/_form.html.haml +25 -60
- data/app/views/kuhsaft/cms/pages/edit.html.haml +14 -8
- data/app/views/kuhsaft/cms/pages/index.html.haml +8 -8
- data/app/views/kuhsaft/cms/pages/new.html.haml +1 -10
- data/app/views/kuhsaft/column_bricks/_column_brick.html.haml +3 -0
- data/app/views/kuhsaft/{cms/page_parts/edit.html.haml → column_bricks/column_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -0
- data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +10 -0
- data/app/views/kuhsaft/link_bricks/_link_brick.html.haml +3 -0
- data/app/views/kuhsaft/link_bricks/link_brick/_edit.html.haml +3 -0
- data/app/views/kuhsaft/pages/show.html.haml +5 -3
- data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +2 -0
- data/app/views/kuhsaft/placeholder_bricks/placeholder_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/slider_bricks/_slider_brick.html.haml +10 -0
- data/app/views/kuhsaft/{cms/page_parts/index.html.haml → slider_bricks/slider_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/text_bricks/_text_brick.html.haml +12 -0
- data/app/views/kuhsaft/text_bricks/text_brick/_edit.html.haml +2 -0
- data/app/views/kuhsaft/two_column_bricks/_two_column_brick.html.haml +3 -0
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_childs.html.haml +5 -0
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +9 -0
- data/app/views/kuhsaft/video_bricks/video_brick/_edit.html.haml +8 -0
- data/app/views/layouts/kuhsaft/cms/application.html.haml +20 -0
- data/config/initializers/devise.rb +231 -0
- data/config/initializers/simple_form.rb +142 -0
- data/config/initializers/simple_form_bootstrap.rb +45 -0
- data/config/locales/kuhsaft.en.yml +4 -1
- data/config/locales/models/kuhsaft/accordion_brick/de.yml +4 -0
- data/config/locales/models/kuhsaft/accordion_item_brick/de.yml +7 -0
- data/config/locales/models/kuhsaft/column_brick/de.yml +6 -0
- data/config/locales/models/kuhsaft/image_brick/de.yml +10 -0
- data/config/locales/models/kuhsaft/image_size/de.yml +13 -0
- data/config/locales/models/kuhsaft/link_brick/de.yml +9 -0
- data/config/locales/models/kuhsaft/page/de.yml +17 -0
- data/config/locales/models/kuhsaft/placeholder_brick/de.yml +8 -0
- data/config/locales/models/kuhsaft/slider_brick/de.yml +4 -0
- data/config/locales/models/kuhsaft/text_brick/de.yml +8 -0
- data/config/locales/models/kuhsaft/two_column_brick/de.yml +7 -0
- data/config/locales/models/kuhsaft/video_brick/de.yml +9 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/views/kuhsaft/cms/admin/de.yml +10 -0
- data/config/locales/views/kuhsaft/cms/bricks/de.yml +8 -0
- data/config/locales/views/kuhsaft/cms/pages/de.yml +9 -0
- data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +7 -0
- data/config/locales/views/kuhsaft/text_brick/de.yml +6 -0
- data/config/locales/views/layouts/de.yml +6 -0
- data/config/routes.rb +10 -11
- data/db/migrate/01_create_kuhsaft_pages.rb +31 -0
- data/db/migrate/02_create_kuhsaft_bricks.rb +23 -0
- data/db/migrate/03_create_kuhsaft_brick_types.rb +12 -0
- data/db/migrate/04_create_kuhsaft_assets.rb +10 -0
- data/db/migrate/05_create_kuhsaft_cms_admins.rb +46 -0
- data/db/migrate/06_add_template_name_to_kuhsaft_bricks.rb +7 -0
- data/db/seeds.rb +14 -0
- data/lib/generators/kuhsaft/translations/add_generator.rb +26 -0
- data/lib/kuhsaft.rb +8 -1
- data/lib/kuhsaft/brick_list.rb +71 -0
- data/lib/kuhsaft/engine.rb +17 -12
- data/lib/kuhsaft/partial_extractor.rb +21 -0
- data/lib/kuhsaft/translatable.rb +40 -0
- data/lib/kuhsaft/version.rb +1 -1
- data/lib/tasks/kuhsaft_tasks.rake +10 -0
- data/lib/templates/kuhsaft/translations/add_translation.html.erb +13 -0
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +9 -3
- data/spec/dummy/app/assets/stylesheets/application.css +11 -5
- data/spec/dummy/app/controllers/application_controller.rb +0 -6
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/config/application.rb +24 -7
- data/spec/dummy/config/boot.rb +3 -2
- data/spec/dummy/config/database.yml +6 -3
- data/spec/dummy/config/environments/development.rb +8 -1
- data/spec/dummy/config/environments/production.rb +9 -2
- data/spec/dummy/config/environments/test.rb +4 -9
- data/spec/dummy/config/initializers/inflections.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/spec/dummy/config/locales/en.yml +2 -2
- data/spec/dummy/config/routes.rb +2 -57
- data/spec/dummy/db/{migrate/.gitkeep → .gitkeep} +0 -0
- data/spec/dummy/public/500.html +0 -1
- data/spec/dummy/{lib/tasks → public/stylesheets}/.gitkeep +0 -0
- data/spec/factories.rb +11 -17
- data/spec/features/cms_auth_spec.rb +9 -0
- data/spec/features/cms_pages_spec.rb +23 -0
- data/spec/helpers/kuhsaft/cms/application_helper_spec.rb +25 -0
- data/spec/lib/brick_list_spec.rb +39 -0
- data/spec/lib/engine_spec.rb +25 -0
- data/spec/lib/translatable_spec.rb +85 -0
- data/spec/models/accordion_brick_spec.rb +32 -0
- data/spec/models/accordion_item_brick_spec.rb +50 -0
- data/spec/models/asset_spec.rb +25 -23
- data/spec/models/brick_spec.rb +110 -0
- data/spec/models/cms/admin_spec.rb +26 -0
- data/spec/models/column_brick_spec.rb +32 -0
- data/spec/models/image_brick_spec.rb +36 -0
- data/spec/models/image_size_spec.rb +36 -0
- data/spec/models/link_brick_spec.rb +45 -0
- data/spec/models/page_spec.rb +262 -281
- data/spec/models/placeholder_brick_spec.rb +40 -0
- data/spec/models/slider_brick_spec.rb +20 -0
- data/spec/models/text_brick_spec.rb +14 -0
- data/spec/models/two_column_brick_spec.rb +72 -0
- data/spec/models/video_brick_spec.rb +26 -0
- data/spec/spec_helper.rb +60 -51
- data/spec/support/kuhsaft_spec_helper.rb +4 -28
- data/spec/support/request_macros.rb +19 -0
- data/vendor/assets/javascripts/redactor.min.js +12 -0
- data/vendor/assets/stylesheets/redactor.css +692 -0
- metadata +402 -346
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.rvmrc +0 -47
- data/CHANGELOG.md +0 -81
- data/Gemfile +0 -2
- data/Guardfile +0 -25
- data/LICENSE +0 -7
- data/app/assets/images/kuhsaft/add-child-page.png +0 -0
- data/app/assets/images/kuhsaft/closedhand.cur +0 -0
- data/app/assets/images/kuhsaft/delete.png +0 -0
- data/app/assets/images/kuhsaft/header-bg.jpg +0 -0
- data/app/assets/images/kuhsaft/module-nav-tab-bg.png +0 -0
- data/app/assets/images/kuhsaft/openhand.cur +0 -0
- data/app/assets/images/kuhsaft/page-edit-icon.png +0 -0
- data/app/assets/images/kuhsaft/page-new-icon.png +0 -0
- data/app/assets/images/kuhsaft/page-part-draggable-area.png +0 -0
- data/app/assets/images/kuhsaft/page-tree-breadcrumb-arrow.png +0 -0
- data/app/assets/images/kuhsaft/pages-breadcrumb-icon.png +0 -0
- data/app/assets/images/kuhsaft/tab-bg.png +0 -0
- data/app/assets/images/kuhsaft/toggle-arrow-closed.png +0 -0
- data/app/assets/images/kuhsaft/toggle-arrow-open.png +0 -0
- data/app/assets/images/kuhsaft/wrapper-bg.png +0 -0
- data/app/assets/javascripts/kuhsaft/cms/backend.js +0 -34
- data/app/assets/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +0 -192
- data/app/assets/javascripts/kuhsaft/cms/jquery.elastic.source.js +0 -161
- data/app/assets/javascripts/kuhsaft/cms/jquery.min.js +0 -18
- data/app/assets/javascripts/kuhsaft/cms/jquery_ujs.js +0 -336
- data/app/assets/stylesheets/kuhsaft/cms/application.css +0 -6
- data/app/assets/stylesheets/kuhsaft/cms/base/base.css.sass +0 -9
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_assets.css.sass +0 -15
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_buttons.css.sass +0 -34
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_generic.css.sass +0 -342
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_simple_form.css.sass +0 -76
- data/app/controllers/kuhsaft/cms/page_parts_controller.rb +0 -34
- data/app/models/kuhsaft/localized_page.rb +0 -81
- data/app/models/kuhsaft/page_part.rb +0 -12
- data/app/models/kuhsaft/page_part/content.rb +0 -76
- data/app/models/kuhsaft/page_part/markdown.rb +0 -8
- data/app/views/kuhsaft/cms/page_parts/destroy.js.haml +0 -1
- data/app/views/kuhsaft/cms/page_parts/new.html.haml +0 -0
- data/app/views/kuhsaft/cms/page_parts/show.html.haml +0 -0
- data/app/views/kuhsaft/cms/page_parts/update.js.haml +0 -0
- data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +0 -1
- data/app/views/kuhsaft/page_part/markdowns/_show_markdown.html.haml +0 -1
- data/app/views/kuhsaft/pages/index.html.haml +0 -0
- data/app/views/layouts/kuhsaft/admin.html.haml +0 -35
- data/config/initializers/generators.rb +0 -7
- data/config/initializers/page_parts.rb +0 -17
- data/kuhsaft.gemspec +0 -39
- data/lib/generators/kuhsaft/install/assets_generator.rb +0 -12
- data/lib/generators/kuhsaft/install/migrations_generator.rb +0 -43
- data/lib/templates/kuhsaft/install/acts_as_taggable_on_migration.rb +0 -37
- data/lib/templates/kuhsaft/install/add_fulltext_to_localized_page.rb +0 -9
- data/lib/templates/kuhsaft/install/add_page_type_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/add_published_at_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/add_tags_to_page_part_contents.rb +0 -9
- data/lib/templates/kuhsaft/install/add_type_to_page_part_contents.rb +0 -9
- data/lib/templates/kuhsaft/install/add_url_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/create_assets.rb +0 -12
- data/lib/templates/kuhsaft/install/create_kuhsaft_localized_pages.rb +0 -19
- data/lib/templates/kuhsaft/install/create_kuhsaft_pages.rb +0 -14
- data/lib/templates/kuhsaft/install/create_page_part_contents.rb +0 -14
- data/spec/controllers/cms_assets_controller_spec.rb +0 -26
- data/spec/controllers/cms_pages_controller_spec.rb +0 -65
- data/spec/controllers/page_parts_controller_spec.rb +0 -60
- data/spec/controllers/pages_controller_spec.rb +0 -30
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/helpers/cms_helper_spec.rb +0 -22
- data/spec/helpers/pages_helper_spec.rb +0 -119
- data/spec/integration/navigation_spec.rb +0 -9
- data/spec/models/localized_page_spec.rb +0 -266
- data/spec/models/page_part_content_spec.rb +0 -95
- data/spec/models/page_part_spec.rb +0 -17
- data/spec/requests/cms_pages_spec.rb +0 -27
- data/spec/routing/assets_routing_spec.rb +0 -63
- data/spec/routing/page_part_routing_spec.rb +0 -70
- data/spec/routing/pages_routing_spec.rb +0 -74
@@ -2,9 +2,9 @@ Dummy::Application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
@@ -29,14 +29,9 @@ Dummy::Application.configure do
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
#
|
33
|
-
|
34
|
-
# like if you have constraints or database-specific column types
|
35
|
-
# config.active_record.schema_format = :sql
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
36
34
|
|
37
35
|
# Print deprecation notices to the stderr
|
38
36
|
config.active_support.deprecation = :stderr
|
39
|
-
|
40
|
-
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
41
|
-
config.assets.allow_debugging = true
|
42
37
|
end
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = '
|
7
|
+
Dummy::Application.config.secret_token = '5577820f2c8866989aa7588272eba883f77a3da3c23f151633a379a619dcbd803ef1e9cb9cf5f1c4103662fa5c8e149011cbbb3850c0f845c7707c583b937734'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
Dummy::Application.config.session_store :cookie_store, :
|
3
|
+
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters :
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
-
# See
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
3
|
|
4
4
|
en:
|
5
|
-
|
5
|
+
hello: "Hello world"
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -1,58 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# first created -> highest priority.
|
4
|
-
|
5
|
-
# Sample of regular route:
|
6
|
-
# match 'products/:id' => 'catalog#view'
|
7
|
-
# Keep in mind you can assign values other than :controller and :action
|
8
|
-
|
9
|
-
# Sample of named route:
|
10
|
-
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
-
|
13
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
-
# resources :products
|
15
|
-
|
16
|
-
# Sample resource route with options:
|
17
|
-
# resources :products do
|
18
|
-
# member do
|
19
|
-
# get 'short'
|
20
|
-
# post 'toggle'
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# collection do
|
24
|
-
# get 'sold'
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
# Sample resource route with sub-resources:
|
29
|
-
# resources :products do
|
30
|
-
# resources :comments, :sales
|
31
|
-
# resource :seller
|
32
|
-
# end
|
33
|
-
|
34
|
-
# Sample resource route with more complex sub-resources
|
35
|
-
# resources :products do
|
36
|
-
# resources :comments
|
37
|
-
# resources :sales do
|
38
|
-
# get 'recent', :on => :collection
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
# Sample resource route within a namespace:
|
43
|
-
# namespace :admin do
|
44
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
-
# # (app/controllers/admin/products_controller.rb)
|
46
|
-
# resources :products
|
47
|
-
# end
|
48
|
-
|
49
|
-
# You can have the root of your site routed with "root"
|
50
|
-
# just remember to delete public/index.html.
|
51
|
-
# root :to => "welcome#index"
|
52
|
-
|
53
|
-
# See how all your routes lay out with "rake routes"
|
54
|
-
|
55
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
-
# match ':controller(/:action(/:id(.:format)))'
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
mount Kuhsaft::Engine => "/"
|
58
3
|
end
|
File without changes
|
data/spec/dummy/public/500.html
CHANGED
File without changes
|
data/spec/factories.rb
CHANGED
@@ -1,21 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
p.title { "English Title #{Factory.next(:title)}" }
|
4
|
-
p.published 1
|
5
|
-
p.body 'hi'
|
6
|
-
p.url ''
|
7
|
-
p.association :page
|
8
|
-
end
|
1
|
+
FactoryGirl.define do
|
2
|
+
sequence(:title) { |n| n }
|
9
3
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
factory :page, :class => 'Kuhsaft::Page' do |p|
|
5
|
+
p.position 1
|
6
|
+
p.title { "English Title #{FactoryGirl.generate(:title)}" }
|
7
|
+
p.published 1
|
8
|
+
p.body 'lorem ipsum'
|
9
|
+
p.url ''
|
14
10
|
end
|
15
|
-
end
|
16
11
|
|
17
|
-
|
18
|
-
|
12
|
+
factory :asset, :class => Kuhsaft::Asset do |a|
|
13
|
+
a.file File.open("#{Kuhsaft::Engine.root}/spec/dummy/app/assets/images/spec-image.png")
|
14
|
+
end
|
19
15
|
end
|
20
|
-
|
21
|
-
Factory.sequence(:title) { |n| n }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Cms/Pages' do
|
6
|
+
sign_in_cms_admin
|
7
|
+
|
8
|
+
context '#new' do
|
9
|
+
before do
|
10
|
+
visit kuhsaft.new_cms_page_path
|
11
|
+
fill_in 'Titel', :with => 'The Title of the page'
|
12
|
+
fill_in 'Stichwörter', :with => 'My keywords'
|
13
|
+
fill_in 'Beschreibung', :with => 'My Description'
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#create' do
|
17
|
+
it 'creates a new page' do
|
18
|
+
expect { click_on 'Create Seite' }.to change(Kuhsaft::Page, :count).by(1)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::Cms::ApplicationHelper do
|
4
|
+
describe '#render_language_switch?' do
|
5
|
+
context 'when there is one language' do
|
6
|
+
before do
|
7
|
+
I18n.stub(:available_locales).and_return([:de])
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns false' do
|
11
|
+
helper.render_language_switch?.should be_false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when there are multiple languages' do
|
16
|
+
before do
|
17
|
+
I18n.stub(:available_locales).and_return([:de, :en])
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns true' do
|
21
|
+
helper.render_language_switch?.should be_true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::BrickList do
|
4
|
+
|
5
|
+
class TestBrick
|
6
|
+
include Kuhsaft::BrickList
|
7
|
+
end
|
8
|
+
|
9
|
+
let :brick do
|
10
|
+
TestBrick.new
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#collect_fulltext' do
|
14
|
+
context 'with bricks' do
|
15
|
+
it 'collects its childs fulltext' do
|
16
|
+
brick.stub_chain(:bricks, :localized).and_return([mock_model(Kuhsaft::Brick, :collect_fulltext => 'hallo')])
|
17
|
+
brick.collect_fulltext.should == 'hallo'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'with bricks without content' do
|
22
|
+
it 'returns a string' do
|
23
|
+
brick.stub_chain(:bricks, :localized).and_return([])
|
24
|
+
brick.collect_fulltext.should == ''
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'without bricks' do
|
29
|
+
it 'returns a string' do
|
30
|
+
brick.collect_fulltext.should == ''
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'does not fail' do
|
34
|
+
expect { brick.collect_fulltext }.to_not raise_error
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::Engine do
|
4
|
+
|
5
|
+
describe '.configure' do
|
6
|
+
|
7
|
+
describe '.image_sizes' do
|
8
|
+
it 'delegates .clear to ImageSize' do
|
9
|
+
Kuhsaft::ImageSize.should_receive(:clear!)
|
10
|
+
Kuhsaft::Engine.configure do
|
11
|
+
config.image_sizes.clear!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'delegates .add to ImageSize' do
|
16
|
+
Kuhsaft::ImageSize.should_receive(:add).with(:something, 100, 200)
|
17
|
+
Kuhsaft::Engine.configure do
|
18
|
+
config.image_sizes.add(:something, 100, 200)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::Translatable do
|
4
|
+
|
5
|
+
class Demo
|
6
|
+
include Kuhsaft::Translatable
|
7
|
+
translate :name
|
8
|
+
end
|
9
|
+
|
10
|
+
let :model do
|
11
|
+
Demo.new
|
12
|
+
end
|
13
|
+
|
14
|
+
before do
|
15
|
+
I18n.available_locales = [:en, :de]
|
16
|
+
I18n.locale = :en
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
I18n.available_locales = [:en]
|
21
|
+
I18n.locale = :en
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.translate' do
|
25
|
+
it 'defines a getter for each attribute' do
|
26
|
+
model.should respond_to(:name)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'defines a setter for each attributes' do
|
30
|
+
model.should respond_to(:name=)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.locale_attr' do
|
35
|
+
it 'returns a suffixed attribute name' do
|
36
|
+
Demo.locale_attr('text').should == 'text_en'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#locale_attr' do
|
41
|
+
it 'returns a suffixed attribute name' do
|
42
|
+
model.locale_attr('text').should == 'text_en'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'translated attributes' do
|
47
|
+
it 'delegates the getter to the suffixed attribute' do
|
48
|
+
model.should_receive(:name_en).and_return('John')
|
49
|
+
model.name.should == 'John'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'delegates the setter to the suffixed attribute' do
|
53
|
+
model.should_receive(:name_en=).with('Johnny')
|
54
|
+
model.name = 'Johnny'
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'dynamic methods' do
|
58
|
+
it 'delegates boolean accessors' do
|
59
|
+
model.should_receive(:name_en?)
|
60
|
+
model.name?
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'delegates simple dynamic finders' do
|
64
|
+
model.should_receive(:find_by_name_en).with('Max')
|
65
|
+
model.find_by_name('Max')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when changing the locale' do
|
70
|
+
before do
|
71
|
+
I18n.locale = :de
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'delegates the getter to current locale' do
|
75
|
+
model.should_receive(:name_de).and_return('Johannes')
|
76
|
+
model.name.should == 'Johannes'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'delegates the getter to current locale' do
|
80
|
+
model.should_receive(:name_de=).with('Johannes')
|
81
|
+
model.name = 'Johannes'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::AccordionBrick do
|
4
|
+
|
5
|
+
let :accordion_brick do
|
6
|
+
Kuhsaft::AccordionBrick.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#user_can_delete?' do
|
10
|
+
it 'returns true' do
|
11
|
+
accordion_brick.user_can_delete?.should be_true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#renders_own_childs?' do
|
16
|
+
it 'returns false' do
|
17
|
+
accordion_brick.renders_own_childs?.should be_false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#bricks' do
|
22
|
+
it 'can have childs' do
|
23
|
+
accordion_brick.should respond_to(:bricks)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#to_style_class' do
|
28
|
+
it 'includes the bootstrap classname' do
|
29
|
+
accordion_brick.to_style_class.should == 'kuhsaft-accordion-brick accordion'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::AccordionItemBrick do
|
4
|
+
|
5
|
+
let :accordion_item_brick do
|
6
|
+
Kuhsaft::AccordionItemBrick.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#valid' do
|
10
|
+
before do
|
11
|
+
accordion_item_brick.valid?
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'without a #caption' do
|
15
|
+
it 'has en error' do
|
16
|
+
accordion_item_brick.should have(1).error_on(:caption)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#user_can_delete?' do
|
22
|
+
it 'returns true' do
|
23
|
+
accordion_item_brick.user_can_delete?.should be_true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#user_can_save' do
|
28
|
+
it 'returns true' do
|
29
|
+
accordion_item_brick.user_can_save?.should == true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#renders_own_childs?' do
|
34
|
+
it 'returns false' do
|
35
|
+
accordion_item_brick.renders_own_childs?.should be_false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#bricks' do
|
40
|
+
it 'can have childs' do
|
41
|
+
accordion_item_brick.should respond_to(:bricks)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#to_style_class' do
|
46
|
+
it 'includes the bootstrap classname' do
|
47
|
+
accordion_item_brick.to_style_class.should == 'kuhsaft-accordion-item-brick accordion-group'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|