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
data/README.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
**IMPORTANT: Kuhsaft >= 0.3.0 runs only on Rails 3.1. If you are stuck on
|
4
|
-
Rails 3 go for the 0.2 Versions**
|
1
|
+
[![Build Status](https://api.travis-ci.org/screenconcept/kuhsaft.png)](http://travis-ci.org/screenconcept/kuhsaft)
|
5
2
|
|
6
|
-
|
3
|
+
# Kuhsaft. A CMS as simple as it could be
|
7
4
|
|
8
5
|
## The Who, What and Why?
|
9
6
|
|
@@ -14,11 +11,17 @@ ourselves and our customers that makes the of-the-shelf website project a
|
|
14
11
|
hasselfree thing. On one side easy to set up, integrate and customize (good for
|
15
12
|
devs) on the other hand it should be easily usable by anyone.
|
16
13
|
|
14
|
+
## What's in it
|
15
|
+
|
16
|
+
* A modular system to integrate any type of content structure
|
17
|
+
* Multilanguage content
|
18
|
+
* much more
|
19
|
+
|
17
20
|
# Requirements
|
18
21
|
|
19
|
-
Kuhsaft requires
|
22
|
+
Kuhsaft requires:
|
20
23
|
|
21
|
-
* A Rails 3 app to be integrated into
|
24
|
+
* A Rails 3.2 app to be integrated into
|
22
25
|
* ImageMagick
|
23
26
|
* An ActiveRecord compatible DB
|
24
27
|
|
@@ -36,108 +39,155 @@ to get the gem
|
|
36
39
|
|
37
40
|
Then install the assets and the migrations and run them:
|
38
41
|
|
39
|
-
|
42
|
+
rake kuhsaft:install:migrations
|
40
43
|
rake db:migrate
|
44
|
+
rake db:seed
|
41
45
|
|
42
|
-
|
46
|
+
You might want to change the language suffixes on the fields inside the create_kuhsaft_pages migration, depending on your app's default_locale.
|
43
47
|
|
44
|
-
|
48
|
+
Mount the kuhsaft engine in your routing file:
|
45
49
|
|
46
|
-
|
50
|
+
MyApp::Application.routes.draw do
|
51
|
+
# add your app routes here
|
52
|
+
mount Kuhsaft::Engine => "/"
|
53
|
+
end
|
47
54
|
|
48
|
-
|
49
|
-
before_filter :available_locales
|
55
|
+
Load the Kuhsaft assets into your app, so you have working grids, widgets etc:
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
57
|
+
# application.css.sass
|
58
|
+
@import 'kuhsaft/application'
|
55
59
|
|
56
|
-
|
60
|
+
# application.js.coffee
|
61
|
+
//= require 'kuhsaft/application'
|
57
62
|
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
## Modifying the backend CSS
|
64
|
+
Simply override the custom css in your app with your own style at `assets/stylesheets/kuhsaft/cms/customizations.css.sass`
|
65
|
+
|
66
|
+
## Modifying the backend javascript
|
67
|
+
Simply override the custom javascript in your app with your own script at `assets/javascripts/kuhsaft/cms/customizations.js.coffee`
|
68
|
+
|
69
|
+
## Testing
|
70
|
+
|
71
|
+
There's a dummy app inside spec/dummy. Get it running by executing the following steps:
|
72
|
+
|
73
|
+
* remove eventual migrations inside `spec/dummy/db/migrate`
|
74
|
+
* run `rake kuhsaft:install:migrations` again
|
75
|
+
* run `rake db:migrate` and `rake db:seed`
|
76
|
+
|
77
|
+
Start up the dummy app. The first two steps also make sure you're ready to run `rspec spec` to run the test suite. (Todo: This workflow must be improved))
|
61
78
|
|
62
79
|
# Usage
|
63
80
|
|
64
|
-
##
|
81
|
+
## Making Kuhsaft helpers available to your app
|
82
|
+
|
83
|
+
As defined in the rails docs, load the helpers from our isolated Kuhsaft engine inside your application controller:
|
65
84
|
|
66
|
-
|
85
|
+
class ApplicationController < ActionController::Base
|
86
|
+
helper Kuhsaft::Engine.helpers
|
87
|
+
end
|
67
88
|
|
68
|
-
|
89
|
+
## Adding sublime video
|
69
90
|
|
70
|
-
|
91
|
+
Create an initializer file in your app inside `config/initializers` and set the `sublime_video_token`:
|
71
92
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
93
|
+
Kuhsaft::Engine.configure do
|
94
|
+
# Get the token from the MySites section on the sublime video site
|
95
|
+
config.sublime_video_token = '123abcd'
|
96
|
+
end
|
76
97
|
|
77
|
-
|
78
|
-
for your admin controllers and views** if you want to use the Kuhsaft UI
|
79
|
-
as a backend to your models.
|
98
|
+
Require the sublime javascript with the following helper:
|
80
99
|
|
81
|
-
|
82
|
-
|
100
|
+
# in your application layout in the head section
|
101
|
+
sublime_video_include_tag
|
83
102
|
|
84
|
-
Add the route to your resource, within the locale scope and the cms
|
85
|
-
namespace:
|
86
103
|
|
87
|
-
|
88
|
-
scope ':locale' do
|
89
|
-
namespace :cms do
|
90
|
-
resources :projects
|
91
|
-
end
|
92
|
-
end
|
93
|
-
```
|
104
|
+
## Configuring the image brick
|
94
105
|
|
95
|
-
|
96
|
-
`app/controllers/cms/` and keep it in the `Cms` namespace, e.g:
|
106
|
+
The image brick can process uploaded images into specific sizes. These sizes can be configured inside the engine configuration. You can also use the built-in default sizes:
|
97
107
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
def index
|
102
|
-
# do somethinng
|
108
|
+
# your_app/config/initializers/kuhsaft.rb
|
109
|
+
Kuhsaft::Engine.configure do
|
110
|
+
config.image_sizes.build_defaults! # creates 960x540 and 320x180 sizes
|
103
111
|
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
```
|
107
112
|
|
108
|
-
|
113
|
+
You can also remove the default sizes:
|
109
114
|
|
110
|
-
|
111
|
-
|
112
|
-
|
115
|
+
# your_app/config/initializers/kuhsaft.rb
|
116
|
+
Kuhsaft::Engine.configure do
|
117
|
+
config.image_sizes.clear! # .all is now empty
|
118
|
+
end
|
113
119
|
|
114
|
-
|
120
|
+
And most importantly, you can add custom sizes:
|
115
121
|
|
116
|
-
|
117
|
-
|
118
|
-
|
122
|
+
# your_app/config/initializers/kuhsaft.rb
|
123
|
+
Kuhsaft::Engine.configure do
|
124
|
+
config.image_sizes.add(:side_box_vertical, 180, 460)
|
125
|
+
config.image_sizes.add(:footer_teaser, 320, 220)
|
126
|
+
end
|
119
127
|
|
120
|
-
|
121
|
-
- Kuhsaft::Page.translation_locales.each do |locale|
|
122
|
-
%li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, cms_projects_path(:locale => locale)
|
128
|
+
The `name` option is a unique identifier, which is also used for translating the dropdown in the brick. You can add your translation by using the translation path:
|
123
129
|
|
124
|
-
|
125
|
-
-@projects.each do |project|
|
126
|
-
%li.can-drag.project
|
127
|
-
.branch
|
128
|
-
=link_to project.name, cms_project_path(project)
|
129
|
-
```
|
130
|
+
activerecord.attributes.kuhsaft/image_size.sizes.#{name}
|
130
131
|
|
131
|
-
|
132
|
-
as well.
|
132
|
+
## Adding custom templates with placeholder bricks
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
to render the additional navigation tabs in the Kuhsaft UI:
|
134
|
+
* Save your partial in `views/kuhsaft/placeholder_bricks/partials/_your_partial.html.haml`
|
135
|
+
* Add translations for your partial in `config/locales/models/kuhsaft/placeholder_brick/locale.yml`
|
137
136
|
|
138
|
-
```ruby
|
139
|
-
= admin_tab('Projects', cms_projects_path())
|
140
137
|
```
|
138
|
+
de:
|
139
|
+
your_partial: Your Partial
|
140
|
+
```
|
141
|
+
|
142
|
+
## Adding additional content languages
|
143
|
+
|
144
|
+
If you wan't to translate your pages into another language, generate a new translation migration:
|
145
|
+
|
146
|
+
# translate your pages into french
|
147
|
+
rails g kuhsaft:translations:add fr
|
148
|
+
|
149
|
+
This creates a new migration file inside `db/migrate` of your app. Run the migration as you normally do:
|
150
|
+
|
151
|
+
rake db:migrate
|
152
|
+
|
153
|
+
Finally, add the new translation locale to your `available_locales` inside your apps `application.rb`:
|
154
|
+
|
155
|
+
config.available_locales = [:en, :fr]
|
156
|
+
|
157
|
+
## Building a navigation
|
158
|
+
|
159
|
+
Building a navigation is simple, access to the page tree is available through the common methods built into the ancestry gem. Just make sure you are only accessing published pages for your production site, using the `published` scope.
|
160
|
+
|
161
|
+
### 2 level navigation example using simple-navigation
|
162
|
+
|
163
|
+
SimpleNavigation::Configuration.run do |navigation|
|
164
|
+
navigation.items do |primary|
|
165
|
+
# build first level
|
166
|
+
Kuhsaft::Page.roots.published.each do |page|
|
167
|
+
primary.item page.id, page.title, page.link do |sub_item|
|
168
|
+
# build second level
|
169
|
+
page.children.published.each do |subpage|
|
170
|
+
sub_item.item subpage.id, subpage.title, subpage.link
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
## Modifying the backend navigation
|
178
|
+
|
179
|
+
Simply override the default partial for the main navigation in your app with your own file at `kuhsaft/cms/admin/_main_navigation.html.haml`
|
180
|
+
|
181
|
+
## Adding your own Bricks
|
182
|
+
|
183
|
+
* Create your Brick model in `app/models`, for example `CaptionBrick`, which inherits from `Kuhsaft::Brick`.
|
184
|
+
* Create a migration which adds the necessary fields to the `kuhsaft_bricks` table.
|
185
|
+
* If your brick should be accessible via UI, add a BrickType into the seeds or add a migration:
|
186
|
+
`Kuhsaft::BrickType.create(:class_name => 'CaptionBrick', :group => 'elements')`
|
187
|
+
* Add the `edit` and `show` partials to your views, e.g: `app/views/caption_bricks/caption_brick/_edit.html.haml`
|
188
|
+
* Add the `childs` partial to your views, if you want to render your bricks childs with your own html: `app/views/caption_bricks/caption_brick/_childs.html.haml`
|
189
|
+
* Implement the `fulltext` method on your brick, return anything you want to be searchable.
|
190
|
+
* Customize the edit form behaviour of your brick by overriding methods like `to_style_class?`. See the `Brick` and `BrickList` files for more methods.
|
141
191
|
|
142
192
|
# LICENSE
|
143
193
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,11 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
1
|
+
#!/usr/bin/env rake
|
3
2
|
begin
|
4
|
-
require 'bundler'
|
5
|
-
Bundler::GemHelper.install_tasks
|
3
|
+
require 'bundler/setup'
|
6
4
|
rescue LoadError
|
7
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
8
6
|
end
|
9
7
|
|
10
|
-
require '
|
11
|
-
require 'rdoc/task'
|
12
|
-
|
13
|
-
require 'rspec/core'
|
8
|
+
require 'rspec'
|
14
9
|
require 'rspec/core/rake_task'
|
15
10
|
|
16
11
|
RSpec::Core::RakeTask.new(:spec) do |specs|
|
@@ -19,10 +14,20 @@ end
|
|
19
14
|
|
20
15
|
task :default => :spec
|
21
16
|
|
22
|
-
|
17
|
+
begin
|
18
|
+
require 'rdoc/task'
|
19
|
+
rescue LoadError
|
20
|
+
require 'rdoc/rdoc'
|
21
|
+
require 'rake/rdoctask'
|
22
|
+
RDoc::Task = Rake::RDocTask
|
23
|
+
end
|
24
|
+
|
25
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
23
26
|
rdoc.rdoc_dir = 'rdoc'
|
24
27
|
rdoc.title = 'Kuhsaft'
|
25
|
-
rdoc.options << '--line-numbers'
|
28
|
+
rdoc.options << '--line-numbers'
|
26
29
|
rdoc.rdoc_files.include('README.rdoc')
|
27
30
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
28
31
|
end
|
32
|
+
|
33
|
+
Bundler::GemHelper.install_tasks
|
@@ -4,8 +4,20 @@
|
|
4
4
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
5
|
// the compiled file.
|
6
6
|
//
|
7
|
-
//= require jquery
|
7
|
+
//= require jquery
|
8
8
|
//= require jquery_ujs
|
9
|
-
//= require
|
10
|
-
//= require
|
11
|
-
//=
|
9
|
+
//= require redactor
|
10
|
+
//= require bootstrap
|
11
|
+
//= require_tree .
|
12
|
+
|
13
|
+
function loadTextEditor(elem){
|
14
|
+
elem.find(".js-editor").redactor({})
|
15
|
+
}
|
16
|
+
|
17
|
+
$(function(){
|
18
|
+
loadTextEditor($("body"))
|
19
|
+
})
|
20
|
+
|
21
|
+
$("body").ajaxSuccess(function(){
|
22
|
+
loadTextEditor($("body"))
|
23
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
// Override this empty file to add custom JS behaviour!
|
@@ -0,0 +1,125 @@
|
|
1
|
+
// This is a manifest file that'll automatically include all the stylesheets available in this directory
|
2
|
+
// and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
3
|
+
// the top of the compiled file, but it's generally better to create a new file per style scope.
|
4
|
+
// = require redactor
|
5
|
+
// = require_self
|
6
|
+
// = require_tree .
|
7
|
+
|
8
|
+
|
9
|
+
$baseBorderRadius: 0px
|
10
|
+
$borderRadiusLarge: 0px
|
11
|
+
$borderRadiusSmall: 0px
|
12
|
+
|
13
|
+
@import bootstrap
|
14
|
+
@import compass/css3
|
15
|
+
|
16
|
+
// base styles
|
17
|
+
|
18
|
+
h1
|
19
|
+
margin-top: 1em
|
20
|
+
margin-bottom: 0.5em
|
21
|
+
font-size: 3.5em
|
22
|
+
|
23
|
+
form
|
24
|
+
margin: 0 !important
|
25
|
+
|
26
|
+
// bootrap overrides
|
27
|
+
|
28
|
+
.breadcrumb
|
29
|
+
background: #fff
|
30
|
+
opacity: 0.4
|
31
|
+
+single-transition(all, 0.3s)
|
32
|
+
|
33
|
+
.breadcrumb:hover
|
34
|
+
opacity: 1
|
35
|
+
|
36
|
+
.dropdown-menu
|
37
|
+
text-align: left
|
38
|
+
|
39
|
+
.container.cms
|
40
|
+
padding-top: 60px
|
41
|
+
|
42
|
+
// modules
|
43
|
+
|
44
|
+
.brick-caption
|
45
|
+
font-size: 1.25em
|
46
|
+
|
47
|
+
.brick-caption
|
48
|
+
@extend .muted
|
49
|
+
font-weight: normal
|
50
|
+
font-style: italic
|
51
|
+
|
52
|
+
.brick-item-header
|
53
|
+
background: #efefef
|
54
|
+
padding: 0.5em
|
55
|
+
|
56
|
+
.btn
|
57
|
+
+opacity(0)
|
58
|
+
+single-transition(oapcity, 0.2s)
|
59
|
+
|
60
|
+
&:hover
|
61
|
+
.btn
|
62
|
+
+opacity(1)
|
63
|
+
|
64
|
+
.brick-list
|
65
|
+
padding-left: 2em
|
66
|
+
|
67
|
+
// The single column brick and the page-content (the "root") needs no level indentation
|
68
|
+
// It usually acts as a helper container and is therefore not relevant
|
69
|
+
// for the visual hierarchy
|
70
|
+
.kuhsaft-column-brick
|
71
|
+
border: 0px solid #fff
|
72
|
+
> .brick-item-childs
|
73
|
+
> .brick-list
|
74
|
+
padding-left: 0
|
75
|
+
#page-content
|
76
|
+
> .brick-list
|
77
|
+
padding-left: 0
|
78
|
+
|
79
|
+
.tab-content
|
80
|
+
display: table
|
81
|
+
width: 100%
|
82
|
+
|
83
|
+
.brick-item
|
84
|
+
border: 1px solid #e3e3e3
|
85
|
+
// collapse multiple borders
|
86
|
+
margin: -1px
|
87
|
+
|
88
|
+
.brick-item-content
|
89
|
+
padding: 1em
|
90
|
+
|
91
|
+
.empty-state
|
92
|
+
margin: 1em
|
93
|
+
|
94
|
+
.muted
|
95
|
+
padding: 0.5em
|
96
|
+
|
97
|
+
.clear
|
98
|
+
clear: both
|
99
|
+
|
100
|
+
.centered
|
101
|
+
text-align: center
|
102
|
+
|
103
|
+
.actions
|
104
|
+
margin-top: 1em
|
105
|
+
margin-bottom: 1em
|
106
|
+
text-align: right
|
107
|
+
|
108
|
+
.branch
|
109
|
+
border-bottom: 1px solid #ccc
|
110
|
+
padding: 0.35em 0
|
111
|
+
|
112
|
+
.branch-group
|
113
|
+
.branch-group
|
114
|
+
.branch-title
|
115
|
+
margin-left: 2em
|
116
|
+
|
117
|
+
.branch-group
|
118
|
+
.branch-title
|
119
|
+
margin-left: 4em
|
120
|
+
|
121
|
+
.branch-group
|
122
|
+
.branch-title
|
123
|
+
margin-left: 6em
|
124
|
+
|
125
|
+
@import bootstrap-responsive
|