kuhsaft 0.3.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. data/README.md +127 -77
  2. data/Rakefile +15 -10
  3. data/app/assets/javascripts/kuhsaft/application.js +2 -0
  4. data/app/assets/javascripts/kuhsaft/cms/application.js +16 -4
  5. data/app/assets/javascripts/kuhsaft/cms/customizations.js +1 -0
  6. data/app/assets/stylesheets/kuhsaft/application.css.sass +4 -0
  7. data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +125 -0
  8. data/app/assets/stylesheets/kuhsaft/cms/customizations.css.sass +1 -0
  9. data/app/controllers/kuhsaft/application_controller.rb +5 -0
  10. data/app/controllers/kuhsaft/cms/admin_controller.rb +8 -10
  11. data/app/controllers/kuhsaft/cms/bricks_controller.rb +35 -0
  12. data/app/controllers/kuhsaft/cms/pages_controller.rb +16 -19
  13. data/app/controllers/kuhsaft/pages_controller.rb +4 -10
  14. data/app/helpers/cms_helper.rb +3 -3
  15. data/app/helpers/kuhsaft/application_helper.rb +21 -0
  16. data/app/helpers/kuhsaft/cms/application_helper.rb +10 -0
  17. data/app/helpers/kuhsaft/cms/pages_helper.rb +14 -0
  18. data/app/helpers/pages_helper.rb +18 -21
  19. data/app/models/kuhsaft/accordion_brick.rb +16 -0
  20. data/app/models/kuhsaft/accordion_item_brick.rb +22 -0
  21. data/app/models/kuhsaft/brick.rb +85 -0
  22. data/app/models/kuhsaft/brick_type.rb +7 -0
  23. data/app/models/kuhsaft/cms.rb +7 -0
  24. data/app/models/kuhsaft/cms/admin.rb +20 -0
  25. data/app/models/kuhsaft/column_brick.rb +23 -0
  26. data/app/models/kuhsaft/image_brick.rb +19 -0
  27. data/app/models/kuhsaft/image_size.rb +52 -0
  28. data/app/models/kuhsaft/link_brick.rb +19 -0
  29. data/app/models/kuhsaft/page.rb +83 -101
  30. data/app/models/kuhsaft/partition.rb +18 -0
  31. data/app/models/kuhsaft/placeholder_brick.rb +11 -0
  32. data/app/models/kuhsaft/slider_brick.rb +16 -0
  33. data/app/models/kuhsaft/text_brick.rb +9 -0
  34. data/app/models/kuhsaft/two_column_brick.rb +50 -0
  35. data/app/models/kuhsaft/video_brick.rb +20 -0
  36. data/app/uploaders/kuhsaft/asset_uploader.rb +2 -2
  37. data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +63 -0
  38. data/app/views/kuhsaft/accordion_bricks/_accordion_brick.html.haml +3 -0
  39. data/app/{assets/stylesheets/kuhsaft/cms/base/partials/_forms.css.sass → views/kuhsaft/accordion_bricks/accordion_brick/_edit.html.haml} +0 -0
  40. data/app/views/kuhsaft/accordion_item_bricks/_accordion_item_brick.html.haml +8 -0
  41. data/app/views/kuhsaft/accordion_item_bricks/accordion_item_brick/_edit.html.haml +1 -0
  42. data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +10 -0
  43. data/app/views/kuhsaft/cms/admin/_content_language_switch.html.haml +7 -0
  44. data/app/views/kuhsaft/cms/admin/_empty_state.html.haml +5 -0
  45. data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +6 -0
  46. data/app/views/kuhsaft/cms/assets/index.html.haml +2 -2
  47. data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +38 -0
  48. data/app/views/kuhsaft/cms/bricks/_brick_list.html.haml +4 -0
  49. data/app/views/kuhsaft/cms/bricks/create.js.haml +1 -0
  50. data/app/views/kuhsaft/cms/bricks/destroy.js.haml +7 -0
  51. data/app/views/kuhsaft/cms/bricks/update.js.haml +2 -0
  52. data/app/views/kuhsaft/cms/pages/_branch.html.haml +17 -9
  53. data/app/views/kuhsaft/cms/pages/_form.html.haml +25 -60
  54. data/app/views/kuhsaft/cms/pages/edit.html.haml +14 -8
  55. data/app/views/kuhsaft/cms/pages/index.html.haml +8 -8
  56. data/app/views/kuhsaft/cms/pages/new.html.haml +1 -10
  57. data/app/views/kuhsaft/column_bricks/_column_brick.html.haml +3 -0
  58. data/app/views/kuhsaft/{cms/page_parts/edit.html.haml → column_bricks/column_brick/_edit.html.haml} +0 -0
  59. data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -0
  60. data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +10 -0
  61. data/app/views/kuhsaft/link_bricks/_link_brick.html.haml +3 -0
  62. data/app/views/kuhsaft/link_bricks/link_brick/_edit.html.haml +3 -0
  63. data/app/views/kuhsaft/pages/show.html.haml +5 -3
  64. data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +2 -0
  65. data/app/views/kuhsaft/placeholder_bricks/placeholder_brick/_edit.html.haml +1 -0
  66. data/app/views/kuhsaft/slider_bricks/_slider_brick.html.haml +10 -0
  67. data/app/views/kuhsaft/{cms/page_parts/index.html.haml → slider_bricks/slider_brick/_edit.html.haml} +0 -0
  68. data/app/views/kuhsaft/text_bricks/_text_brick.html.haml +12 -0
  69. data/app/views/kuhsaft/text_bricks/text_brick/_edit.html.haml +2 -0
  70. data/app/views/kuhsaft/two_column_bricks/_two_column_brick.html.haml +3 -0
  71. data/app/views/kuhsaft/two_column_bricks/two_column_brick/_childs.html.haml +5 -0
  72. data/app/views/kuhsaft/two_column_bricks/two_column_brick/_edit.html.haml +1 -0
  73. data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +9 -0
  74. data/app/views/kuhsaft/video_bricks/video_brick/_edit.html.haml +8 -0
  75. data/app/views/layouts/kuhsaft/cms/application.html.haml +20 -0
  76. data/config/initializers/devise.rb +231 -0
  77. data/config/initializers/simple_form.rb +142 -0
  78. data/config/initializers/simple_form_bootstrap.rb +45 -0
  79. data/config/locales/kuhsaft.en.yml +4 -1
  80. data/config/locales/models/kuhsaft/accordion_brick/de.yml +4 -0
  81. data/config/locales/models/kuhsaft/accordion_item_brick/de.yml +7 -0
  82. data/config/locales/models/kuhsaft/column_brick/de.yml +6 -0
  83. data/config/locales/models/kuhsaft/image_brick/de.yml +10 -0
  84. data/config/locales/models/kuhsaft/image_size/de.yml +13 -0
  85. data/config/locales/models/kuhsaft/link_brick/de.yml +9 -0
  86. data/config/locales/models/kuhsaft/page/de.yml +17 -0
  87. data/config/locales/models/kuhsaft/placeholder_brick/de.yml +8 -0
  88. data/config/locales/models/kuhsaft/slider_brick/de.yml +4 -0
  89. data/config/locales/models/kuhsaft/text_brick/de.yml +8 -0
  90. data/config/locales/models/kuhsaft/two_column_brick/de.yml +7 -0
  91. data/config/locales/models/kuhsaft/video_brick/de.yml +9 -0
  92. data/config/locales/simple_form.en.yml +26 -0
  93. data/config/locales/views/kuhsaft/cms/admin/de.yml +10 -0
  94. data/config/locales/views/kuhsaft/cms/bricks/de.yml +8 -0
  95. data/config/locales/views/kuhsaft/cms/pages/de.yml +9 -0
  96. data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +7 -0
  97. data/config/locales/views/kuhsaft/text_brick/de.yml +6 -0
  98. data/config/locales/views/layouts/de.yml +6 -0
  99. data/config/routes.rb +10 -11
  100. data/db/migrate/01_create_kuhsaft_pages.rb +31 -0
  101. data/db/migrate/02_create_kuhsaft_bricks.rb +23 -0
  102. data/db/migrate/03_create_kuhsaft_brick_types.rb +12 -0
  103. data/db/migrate/04_create_kuhsaft_assets.rb +10 -0
  104. data/db/migrate/05_create_kuhsaft_cms_admins.rb +46 -0
  105. data/db/migrate/06_add_template_name_to_kuhsaft_bricks.rb +7 -0
  106. data/db/seeds.rb +14 -0
  107. data/lib/generators/kuhsaft/translations/add_generator.rb +26 -0
  108. data/lib/kuhsaft.rb +8 -1
  109. data/lib/kuhsaft/brick_list.rb +71 -0
  110. data/lib/kuhsaft/engine.rb +17 -12
  111. data/lib/kuhsaft/partial_extractor.rb +21 -0
  112. data/lib/kuhsaft/translatable.rb +40 -0
  113. data/lib/kuhsaft/version.rb +1 -1
  114. data/lib/tasks/kuhsaft_tasks.rake +10 -0
  115. data/lib/templates/kuhsaft/translations/add_translation.html.erb +13 -0
  116. data/spec/dummy/Rakefile +1 -1
  117. data/spec/dummy/app/assets/javascripts/application.js +9 -3
  118. data/spec/dummy/app/assets/stylesheets/application.css +11 -5
  119. data/spec/dummy/app/controllers/application_controller.rb +0 -6
  120. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  121. data/spec/dummy/config/application.rb +24 -7
  122. data/spec/dummy/config/boot.rb +3 -2
  123. data/spec/dummy/config/database.yml +6 -3
  124. data/spec/dummy/config/environments/development.rb +8 -1
  125. data/spec/dummy/config/environments/production.rb +9 -2
  126. data/spec/dummy/config/environments/test.rb +4 -9
  127. data/spec/dummy/config/initializers/inflections.rb +5 -0
  128. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  129. data/spec/dummy/config/initializers/session_store.rb +1 -1
  130. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  131. data/spec/dummy/config/locales/en.yml +2 -2
  132. data/spec/dummy/config/routes.rb +2 -57
  133. data/spec/dummy/db/{migrate/.gitkeep → .gitkeep} +0 -0
  134. data/spec/dummy/public/500.html +0 -1
  135. data/spec/dummy/{lib/tasks → public/stylesheets}/.gitkeep +0 -0
  136. data/spec/factories.rb +11 -17
  137. data/spec/features/cms_auth_spec.rb +9 -0
  138. data/spec/features/cms_pages_spec.rb +23 -0
  139. data/spec/helpers/kuhsaft/cms/application_helper_spec.rb +25 -0
  140. data/spec/lib/brick_list_spec.rb +39 -0
  141. data/spec/lib/engine_spec.rb +25 -0
  142. data/spec/lib/translatable_spec.rb +85 -0
  143. data/spec/models/accordion_brick_spec.rb +32 -0
  144. data/spec/models/accordion_item_brick_spec.rb +50 -0
  145. data/spec/models/asset_spec.rb +25 -23
  146. data/spec/models/brick_spec.rb +110 -0
  147. data/spec/models/cms/admin_spec.rb +26 -0
  148. data/spec/models/column_brick_spec.rb +32 -0
  149. data/spec/models/image_brick_spec.rb +36 -0
  150. data/spec/models/image_size_spec.rb +36 -0
  151. data/spec/models/link_brick_spec.rb +45 -0
  152. data/spec/models/page_spec.rb +262 -281
  153. data/spec/models/placeholder_brick_spec.rb +40 -0
  154. data/spec/models/slider_brick_spec.rb +20 -0
  155. data/spec/models/text_brick_spec.rb +14 -0
  156. data/spec/models/two_column_brick_spec.rb +72 -0
  157. data/spec/models/video_brick_spec.rb +26 -0
  158. data/spec/spec_helper.rb +60 -51
  159. data/spec/support/kuhsaft_spec_helper.rb +4 -28
  160. data/spec/support/request_macros.rb +19 -0
  161. data/vendor/assets/javascripts/redactor.min.js +12 -0
  162. data/vendor/assets/stylesheets/redactor.css +692 -0
  163. metadata +402 -346
  164. data/.gitignore +0 -19
  165. data/.rspec +0 -2
  166. data/.rvmrc +0 -47
  167. data/CHANGELOG.md +0 -81
  168. data/Gemfile +0 -2
  169. data/Guardfile +0 -25
  170. data/LICENSE +0 -7
  171. data/app/assets/images/kuhsaft/add-child-page.png +0 -0
  172. data/app/assets/images/kuhsaft/closedhand.cur +0 -0
  173. data/app/assets/images/kuhsaft/delete.png +0 -0
  174. data/app/assets/images/kuhsaft/header-bg.jpg +0 -0
  175. data/app/assets/images/kuhsaft/module-nav-tab-bg.png +0 -0
  176. data/app/assets/images/kuhsaft/openhand.cur +0 -0
  177. data/app/assets/images/kuhsaft/page-edit-icon.png +0 -0
  178. data/app/assets/images/kuhsaft/page-new-icon.png +0 -0
  179. data/app/assets/images/kuhsaft/page-part-draggable-area.png +0 -0
  180. data/app/assets/images/kuhsaft/page-tree-breadcrumb-arrow.png +0 -0
  181. data/app/assets/images/kuhsaft/pages-breadcrumb-icon.png +0 -0
  182. data/app/assets/images/kuhsaft/tab-bg.png +0 -0
  183. data/app/assets/images/kuhsaft/toggle-arrow-closed.png +0 -0
  184. data/app/assets/images/kuhsaft/toggle-arrow-open.png +0 -0
  185. data/app/assets/images/kuhsaft/wrapper-bg.png +0 -0
  186. data/app/assets/javascripts/kuhsaft/cms/backend.js +0 -34
  187. data/app/assets/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +0 -192
  188. data/app/assets/javascripts/kuhsaft/cms/jquery.elastic.source.js +0 -161
  189. data/app/assets/javascripts/kuhsaft/cms/jquery.min.js +0 -18
  190. data/app/assets/javascripts/kuhsaft/cms/jquery_ujs.js +0 -336
  191. data/app/assets/stylesheets/kuhsaft/cms/application.css +0 -6
  192. data/app/assets/stylesheets/kuhsaft/cms/base/base.css.sass +0 -9
  193. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_assets.css.sass +0 -15
  194. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_buttons.css.sass +0 -34
  195. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_generic.css.sass +0 -342
  196. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_simple_form.css.sass +0 -76
  197. data/app/controllers/kuhsaft/cms/page_parts_controller.rb +0 -34
  198. data/app/models/kuhsaft/localized_page.rb +0 -81
  199. data/app/models/kuhsaft/page_part.rb +0 -12
  200. data/app/models/kuhsaft/page_part/content.rb +0 -76
  201. data/app/models/kuhsaft/page_part/markdown.rb +0 -8
  202. data/app/views/kuhsaft/cms/page_parts/destroy.js.haml +0 -1
  203. data/app/views/kuhsaft/cms/page_parts/new.html.haml +0 -0
  204. data/app/views/kuhsaft/cms/page_parts/show.html.haml +0 -0
  205. data/app/views/kuhsaft/cms/page_parts/update.js.haml +0 -0
  206. data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +0 -1
  207. data/app/views/kuhsaft/page_part/markdowns/_show_markdown.html.haml +0 -1
  208. data/app/views/kuhsaft/pages/index.html.haml +0 -0
  209. data/app/views/layouts/kuhsaft/admin.html.haml +0 -35
  210. data/config/initializers/generators.rb +0 -7
  211. data/config/initializers/page_parts.rb +0 -17
  212. data/kuhsaft.gemspec +0 -39
  213. data/lib/generators/kuhsaft/install/assets_generator.rb +0 -12
  214. data/lib/generators/kuhsaft/install/migrations_generator.rb +0 -43
  215. data/lib/templates/kuhsaft/install/acts_as_taggable_on_migration.rb +0 -37
  216. data/lib/templates/kuhsaft/install/add_fulltext_to_localized_page.rb +0 -9
  217. data/lib/templates/kuhsaft/install/add_page_type_to_localized_pages.rb +0 -9
  218. data/lib/templates/kuhsaft/install/add_published_at_to_localized_pages.rb +0 -9
  219. data/lib/templates/kuhsaft/install/add_tags_to_page_part_contents.rb +0 -9
  220. data/lib/templates/kuhsaft/install/add_type_to_page_part_contents.rb +0 -9
  221. data/lib/templates/kuhsaft/install/add_url_to_localized_pages.rb +0 -9
  222. data/lib/templates/kuhsaft/install/create_assets.rb +0 -12
  223. data/lib/templates/kuhsaft/install/create_kuhsaft_localized_pages.rb +0 -19
  224. data/lib/templates/kuhsaft/install/create_kuhsaft_pages.rb +0 -14
  225. data/lib/templates/kuhsaft/install/create_page_part_contents.rb +0 -14
  226. data/spec/controllers/cms_assets_controller_spec.rb +0 -26
  227. data/spec/controllers/cms_pages_controller_spec.rb +0 -65
  228. data/spec/controllers/page_parts_controller_spec.rb +0 -60
  229. data/spec/controllers/pages_controller_spec.rb +0 -30
  230. data/spec/dummy/app/assets/images/rails.png +0 -0
  231. data/spec/helpers/cms_helper_spec.rb +0 -22
  232. data/spec/helpers/pages_helper_spec.rb +0 -119
  233. data/spec/integration/navigation_spec.rb +0 -9
  234. data/spec/models/localized_page_spec.rb +0 -266
  235. data/spec/models/page_part_content_spec.rb +0 -95
  236. data/spec/models/page_part_spec.rb +0 -17
  237. data/spec/requests/cms_pages_spec.rb +0 -27
  238. data/spec/routing/assets_routing_spec.rb +0 -63
  239. data/spec/routing/page_part_routing_spec.rb +0 -70
  240. data/spec/routing/pages_routing_spec.rb +0 -74
data/README.md CHANGED
@@ -1,9 +1,6 @@
1
- # Kuhsaft. A CMS as simple as it could be
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
- Yiiihaaaaaa! Howdy, Let's milk the cow!
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
- rails generate kuhsaft:install:migrations
42
+ rake kuhsaft:install:migrations
40
43
  rake db:migrate
44
+ rake db:seed
41
45
 
42
- If you are upgrading, run those installers again and hopefully we will generate just the migrations you need.
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
- (NOTE: Steps below should hopefully not be necessary in future versions:)
48
+ Mount the kuhsaft engine in your routing file:
45
49
 
46
- Finally, you need to add a before filter to the application controller (for now...)
50
+ MyApp::Application.routes.draw do
51
+ # add your app routes here
52
+ mount Kuhsaft::Engine => "/"
53
+ end
47
54
 
48
- ApplicationController < ActionController::Base
49
- before_filter :available_locales
55
+ Load the Kuhsaft assets into your app, so you have working grids, widgets etc:
50
56
 
51
- def available_locales
52
- Kuhsaft::Page.translation_locales = ['de', 'en', 'fr']
53
- end
54
- end
57
+ # application.css.sass
58
+ @import 'kuhsaft/application'
55
59
 
56
- If you want to use devise for protecting the admin parts, do this in an initializer:
60
+ # application.js.coffee
61
+ //= require 'kuhsaft/application'
57
62
 
58
- Kuhsaft::Cms::PagesController.class_eval do
59
- before_filter :authenticate_user!
60
- end
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
- ## Building a navigation
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
- Create a toplevel page and set the page type to "navigation". You can now get the child pages by using the navigation helper with the slug of that page:
85
+ class ApplicationController < ActionController::Base
86
+ helper Kuhsaft::Engine.helpers
87
+ end
67
88
 
68
- navigation_for(:slug => 'main-navigation') { |pages| ... }
89
+ ## Adding sublime video
69
90
 
70
- ## Integrating custom Models into Kuhsaft (aka Rails Admin Lite)
91
+ Create an initializer file in your app inside `config/initializers` and set the `sublime_video_token`:
71
92
 
72
- There is a chance that Pages and Assets is not enough for you and you
73
- need custom models in your Rails app. It's your lucky day, because
74
- Kuhsaft was designed with the goal to easily integrate into a usual
75
- Rails app.
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
- There is one caveat though: You need to **stay in the Kuhsaft namespaces
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
- There is a high probability that we will ship our own generators for all
82
- this stuff in the future, meanwhile, you'll have to do some manual work:
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
- ```ruby
88
- scope ':locale' do
89
- namespace :cms do
90
- resources :projects
91
- end
92
- end
93
- ```
104
+ ## Configuring the image brick
94
105
 
95
- Put your admin controller for the model in question in
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
- ```ruby
99
- module Cms
100
- class ProjectsController < Kuhsaft::Cms::AdminController
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
- As you can see you have to inherit from `Kuhsaft::Cms::AdminController`
113
+ You can also remove the default sizes:
109
114
 
110
- As with the controllers, you have to respect the namespaces when adding
111
- the view. For the example above, we would create an index view in
112
- `app/views/cms/projects/`
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
- As an example, the view might look something like this:
120
+ And most importantly, you can add custom sizes:
115
121
 
116
- ```ruby
117
- - content_for :admin_toolbar do
118
- = link_to t('.create'), new_cms_project_path, :class => 'button'
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
- - content_for :cms_language_tabs do
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
- %ul.pages-root.sortable
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
- Note that we can acess the admin_toolbar and the language tabs from here
132
- as well.
132
+ ## Adding custom templates with placeholder bricks
133
133
 
134
- Finally, you need to create a partial called
135
- `_admin_navigation.html.haml` in `app/views/cms/`. This partial is used
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
- # encoding: UTF-8
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 'rake'
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
- Rake::RDocTask.new(:rdoc) do |rdoc|
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' << '--inline-source'
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
@@ -0,0 +1,2 @@
1
+ //= require bootstrap
2
+ //= require_self
@@ -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.min
7
+ //= require jquery
8
8
  //= require jquery_ujs
9
- //= require ./jquery-ui-1.8.12.custom.min
10
- //= require ./jquery.elastic.source
11
- //= require ./backend
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,4 @@
1
+ // = require_self
2
+
3
+ @import bootstrap
4
+
@@ -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