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
@@ -0,0 +1,20 @@
1
+ module Kuhsaft
2
+ class VideoBrick < Brick
3
+
4
+ YOUTUBE = 'youtube'
5
+ VIMEO = 'vimeo'
6
+ EXTERNAL = 'external'
7
+
8
+ attr_accessible :video, :embed_src, :href
9
+ validates :any_source, :presence => true
10
+
11
+ # a video id, an embed code or a link to a video is required
12
+ def any_source
13
+ embed_src.presence || href.presence
14
+ end
15
+
16
+ def self.source_types
17
+ [YOUTUBE, VIMEO, EXTERNAL]
18
+ end
19
+ end
20
+ end
@@ -3,7 +3,7 @@
3
3
  class Kuhsaft::AssetUploader < CarrierWave::Uploader::Base
4
4
 
5
5
  # Include RMagick or ImageScience support:
6
- include CarrierWave::RMagick
6
+ include CarrierWave::MiniMagick
7
7
  #include CarrierWave::ImageScience
8
8
 
9
9
  # Choose what kind of storage to use for this uploader:
@@ -35,7 +35,7 @@ class Kuhsaft::AssetUploader < CarrierWave::Uploader::Base
35
35
  resize_to_fill(100, 100) if @file.present? && @file.content_type.present? && @file.content_type.include?('image')
36
36
  end
37
37
  end
38
-
38
+
39
39
  # Add a white list of extensions which are allowed to be uploaded.
40
40
  # For images you might use something like this:
41
41
  def extension_white_list
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+ module Kuhsaft
3
+ class ImageBrickImageUploader < CarrierWave::Uploader::Base
4
+ # include CarrierWave::RMagick
5
+ include CarrierWave::MiniMagick
6
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
7
+ # include Sprockets::Helpers::RailsHelper
8
+ # include Sprockets::Helpers::IsolatedHelper
9
+
10
+ storage :file
11
+
12
+ # Override the directory where uploaded files will be stored.
13
+ # This is a sensible default for uploaders that are meant to be mounted:
14
+ def store_dir
15
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
16
+ end
17
+
18
+ # Provide a default URL as a default if there hasn't been a file uploaded:
19
+ # def default_url
20
+ # # For Rails 3.1+ asset pipeline compatibility:
21
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
22
+ #
23
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
24
+ # end
25
+
26
+
27
+ # Process files as they are uploaded:
28
+ # process :scale => [200, 300]
29
+ #
30
+ # def scale(width, height)
31
+ # # do something
32
+ # end
33
+
34
+ # Create different versions of your uploaded files:
35
+ version :converted do
36
+ process :process_brick_image_size
37
+ end
38
+
39
+ version :thumb, :from_version => :converted do
40
+ process :resize_to_fill => [160, 90]
41
+ end
42
+
43
+ # Add a white list of extensions which are allowed to be uploaded.
44
+ # For images you might use something like this:
45
+ def extension_white_list
46
+ %w(jpg jpeg gif png)
47
+ end
48
+
49
+ def process_brick_image_size
50
+ image_size = Kuhsaft::ImageSize.find_by_name(model.image_size)
51
+ if image_size.present?
52
+ resize_to_fill(image_size.width, image_size.height)
53
+ end
54
+ end
55
+
56
+ # Override the filename of the uploaded files:
57
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
58
+ # def filename
59
+ # "something.jpg" if original_filename
60
+ # end
61
+
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ %div{ :class => accordion_brick.to_style_class, :id => accordion_brick.to_style_id }
2
+ - accordion_brick.bricks.each do |brick|
3
+ = render brick
@@ -0,0 +1,8 @@
1
+ %div{ :class => accordion_item_brick.to_style_class }
2
+ .accordion-heading
3
+ %a.accordion-toggle{ 'data-toggle' => 'collapse', 'data-parent' => "##{accordion_item_brick.brick_list.to_style_id}", :href => "##{accordion_item_brick.to_style_id}" }
4
+ = accordion_item_brick.caption
5
+ .accordion-body.collapse{ :id => accordion_item_brick.to_style_id, :class => (accordion_item_brick.brick_list.bricks.first == accordion_item_brick ? 'in' : '') }
6
+ .accordion-inner
7
+ - accordion_item_brick.bricks.each do |brick|
8
+ = render brick
@@ -0,0 +1 @@
1
+ = form.input :caption, :as => :string, :input_html => { :class => 'span6' }
@@ -0,0 +1,10 @@
1
+ - if brick_list.respond_to?(:user_can_add_childs?) && brick_list.user_can_add_childs? && Kuhsaft::BrickType.count > 0
2
+ %a.btn.btn-small.btn-primary.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
3
+ = t('.add_element')
4
+ %span.caret
5
+ %ul.dropdown-menu.pull-right
6
+ - Kuhsaft::BrickType.grouped.group_by(&:group).each do |group, types|
7
+ - types.each do |type|
8
+ %li
9
+ = link_to type.class_name.constantize.model_name.human, kuhsaft.cms_bricks_path(:brick => { :type => type.class_name, :brick_list_id => brick_list.id, :brick_list_type => brick_list.brick_list_type }), :remote => true, :method => :post
10
+ .divider
@@ -0,0 +1,7 @@
1
+ - if render_language_switch?
2
+ .pull-right
3
+ %ul.nav.nav-pills
4
+ - I18n.available_locales.each do |locale|
5
+ %li{ :class => (:active if I18n.locale.to_s == locale.to_s) }
6
+ = link_to locale.to_s.upcase, url_for(:content_locale => locale)
7
+ .clear
@@ -0,0 +1,5 @@
1
+ - if brick.bricks.empty?
2
+ .centered.empty-state
3
+ .muted= t('.empty')
4
+ .btn-group
5
+ = render 'brick_type_dropdown', :brick_list => brick
@@ -0,0 +1,6 @@
1
+ = link_to 'Kuhsaft CMS', '#', :class => 'brand'
2
+ %p.navbar-text.pull-right
3
+ = link_to t('.logout'), kuhsaft.destroy_cms_admin_session_path, :method => :delete
4
+ %ul.nav
5
+ %li
6
+ = link_to Kuhsaft::Page.model_name.human(:count => 2), kuhsaft.cms_pages_path
@@ -1,3 +1,3 @@
1
1
  - content_for :admin_toolbar do
2
- = link_to t('.create'), new_cms_asset_path, :class => 'button'
3
- = render 'list'
2
+ = link_to t('.create'), kuhsaft.new_asset_path, :class => 'button'
3
+ = render 'list'
@@ -0,0 +1,38 @@
1
+ .brick-item{ :id => brick.to_brick_item_id, :class => brick.to_style_class }
2
+ = simple_form_for brick, :as => :brick, :url => kuhsaft.cms_brick_path(brick), :remote => true, :html => { :id => nil } do |form|
3
+ .brick-item-header.clearfix
4
+ .pull-left
5
+ - if brick.caption.present?
6
+ = brick.caption
7
+ %span.muted
8
+ = brick.backend_label(:parenthesis => true)
9
+ .pull-right
10
+ .btn-group
11
+ - # delete button
12
+ - if brick.persisted?
13
+ - if brick.user_can_delete?
14
+ = link_to kuhsaft.cms_brick_path(brick), :class => 'btn btn-small btn-danger', :confirm => t('kuhsaft.cms.bricks.brick_item.confirm'), :method => :delete, :remote => true do
15
+ %i.icon-trash.icon-white
16
+
17
+ - # addable child dropdown menu
18
+ - if brick.respond_to?(:brick_list)
19
+ = render 'brick_type_dropdown', :brick_list => brick
20
+
21
+ - brick_content = render(brick.to_edit_partial_path, :brick => brick, :form => form)
22
+ - if brick_content.present?
23
+ .brick-item-content
24
+ = brick_content
25
+ - if brick.user_can_save?
26
+ - # save button
27
+ .clearfix
28
+ .pull-right
29
+ = form.button :submit, :class => 'btn btn-success btn-small ', :value => t('.save')
30
+
31
+
32
+ - if brick.renders_own_childs?
33
+ .brick-item-childs
34
+ = render brick.to_edit_childs_partial_path, :brick => brick
35
+ - else
36
+ - if brick.respond_to?(:bricks)
37
+ .brick-item-childs
38
+ = render 'kuhsaft/cms/bricks/brick_list', :brick_list => brick
@@ -0,0 +1,4 @@
1
+ .brick-list{ :id => brick_list.to_brick_list_id }
2
+ = render 'empty_state', :brick => brick_list
3
+ - brick_list.bricks.each do |brick|
4
+ = render 'kuhsaft/cms/bricks/brick_item', :brick => brick
@@ -0,0 +1 @@
1
+ $("##{@brick.brick_list.to_brick_list_id}.brick-list").append("#{j(render('kuhsaft/cms/bricks/brick_item', :brick => @brick))}").find("> .empty-state").remove()
@@ -0,0 +1,7 @@
1
+ var brick = $("##{@brick.to_brick_item_id}")
2
+ var brickList = brick.parent()
3
+ brick.remove()
4
+
5
+ if(brickList.children().length == 0){
6
+ brickList.html("#{j(render('empty_state', :brick => @parent_brick))}")
7
+ }
@@ -0,0 +1,2 @@
1
+ $("##{@brick.to_brick_item_id}").replaceWith("#{j(render('kuhsaft/cms/bricks/brick_item', :brick => @brick))}")
2
+ $("##{@brick.to_brick_item_id}").addClass("saved")
@@ -1,11 +1,19 @@
1
1
  - unless pages.blank?
2
2
  - pages.each do |page|
3
- %li.can-drag{ :'data-id' => page.id, :'data-put-url' => cms_page_path(page) }
4
- .branch
5
- = link_to page.title.presence || t('.not_translated'), edit_cms_page_path(page), :class => ('to-translate' if page.title.blank?)
6
- = link_to t('.add'), new_cms_page_path(:parent_id => page.id), :class => 'icon add-child-page'
7
- = link_to t('.delete'), cms_page_path(page), :confirm => t('.confirm', :page_title => page.title), :method => :delete, :class => 'icon delete' if page.childs.empty?
8
- .clear
9
- - unless page.childs.empty?
10
- %ul.sortable
11
- = render :partial => 'branch', :locals => { :pages => page.childs }
3
+ .branch-group{ :'data-id' => page.id, :'data-put-url' => kuhsaft.cms_page_path(page) }
4
+ .row-fluid.branch
5
+ .span9
6
+ .branch-title
7
+ = link_to page.title.presence, kuhsaft.edit_cms_page_path(page), :class => 'btn btn-link'
8
+ .span3
9
+ .pull-right
10
+ - if page.children.empty?
11
+ = link_to kuhsaft.cms_page_path(page), :confirm => t('kuhsaft.cms.admin.confirm_delete', :name => page.title), :method => :delete, :class => 'btn btn-small btn-danger' do
12
+ %i.icon-trash.icon-white
13
+
14
+ = link_to kuhsaft.new_cms_page_path(:parent_id => page.id), :class => 'btn btn-small' do
15
+ %i.icon-plus-sign
16
+ = t('kuhsaft.cms.pages.index.add_page')
17
+
18
+ - unless page.children.empty?
19
+ = render :partial => 'branch', :locals => { :pages => page.children }
@@ -1,63 +1,28 @@
1
- = simple_form_for @page, :url => url do |page|
2
- = page.fields_for :localized_pages, @localized_page do |localized|
3
-
4
- .lightened-box
5
- %h1{ :class => "#{@page.persisted? ? 'edit' : 'new'}-page" }= page_title
6
- = localized.input :locale, :as => :hidden
7
- = localized.input :title, :required => false
8
- = localized.input :slug, :required => false, :input_html => { :class => :dimmed }
9
- .clear
10
-
11
- .page-part-list
12
- - @localized_page.page_parts.each do |page_part_object|
13
- .colored-box.draggable-box.page-part.can-drag{ :'data-id' => page_part_object.id, :'data-put-url' => cms_page_page_part_path(page_part_object, :page_id => @page) }
14
- = localized.fields_for :page_parts, page_part_object do |page_part|
15
- .actions
16
- .drag-handler
17
- - unless page_part.object.persisted?
18
- = page_part.input :type, :as => :hidden, :input_html => { :value => page_part.object.class.to_s }
1
+ %ul.nav.nav-tabs.js-tabs
2
+ %li{ :class => metadata_tab_active(@page) }
3
+ = link_to t('.tab_metadata'), '#page-metadata', 'data-toggle' => :tab
4
+ %li{ :class => content_tab_active(@page) }
5
+ = link_to t('.tab_content'), '#page-content', 'data-toggle' => :tab
19
6
 
20
- = render :partial => page_part.object.edit_partial_path, :locals => { :input_form => page_part }
21
- = page_part.label :tag_list
22
- .page-part-helpers
23
- = page_part.text_field :tag_list, :placeholder => t('.separate_by_comma'), :class => 'page-part-tags string'
24
- .actions
25
- = page.button :submit, :class => 'small-input-button'
26
- .destroy-handler
27
- = link_to t('.destroy_page_part'), cms_page_page_part_path(page_part.object, :page_id => @page), :confirm => t('.confirm'), :method => :delete, :remote => true
28
- .clear
29
- - if localized.object.persisted? && !@page.redirect?
30
- .lightened-box.add-page-part
31
- %label.string{ :for => :page_part_type }= t('.add_element')
32
- = page.collection_select :page_part_type, Kuhsaft::PagePart::Content.page_part_types, :to_s, :to_name
33
- = page.button :submit, :name => :add_page_part, :value => t('.add_page_part')
34
- .clear
7
+ .tab-content
8
+ #page-metadata.tab-pane{ :class => metadata_tab_active(@page) }
9
+ = simple_form_for @page, :url => url, :html => { :class => 'form-horizontal' } do |form|
10
+ = form.input :title, :required => false, :input_html => { :class => :span5 }
11
+ = form.input :slug, :required => false, :input_html => { :class => :span5 }
12
+ = form.input :parent_id, :collection => Kuhsaft::Page.flat_tree, :label_method => :nesting_name, :selected => params[:parent_id].presence || @page.parent_id.presence, :prompt => 'None', :input_html => { :class => :span3 }
13
+ = form.input :page_type, :collection => Kuhsaft::PageType.all, :prompt => false, :input_html => { :class => :span3 }
14
+ = form.input :url, :as => :string if @page.redirect?
15
+ = form.input :keywords, :input_html => { :class => :span5 }
16
+ = form.input :description, :as => :text, :input_html => { :class => :span5, :rows => 4 }
17
+ = form.input :published, :as => :boolean
35
18
 
36
- .darkened-box
37
- %h3.toggle.closed= t('.metainformation')
38
- .collapsable.hidden
39
- = page.input :parent_id, :collection => Kuhsaft::Page.flat_tree(), :label_method => :nesting_name, :selected => params[:parent_id].presence || page.object.parent_id.presence, :prompt => 'None', :label_html => { :class => :string }
40
- = localized.input :page_type, :collection => Kuhsaft::PageType.all, :prompt => false, :label_html => { :class => :string }
41
- = localized.input :url, :as => :string if @page.redirect?
42
- - unless localized.object.page_type == Kuhsaft::PageType::REDIRECT
43
- = localized.input :keywords
44
- = localized.input :description, :input_html => { :class => :small }, :label_html => { :class => :string }
45
- .lightened-box.publish-information
46
- .column.grid-3
47
- = localized.radio_button :published, Kuhsaft::PublishState::UNPUBLISHED
48
- = localized.label :published, t('.unpublished'), :class => :radio, :for => :kuhsaft_page_localized_pages_attributes_0_published_0
49
- .column.grid-3
50
- = localized.radio_button :published, Kuhsaft::PublishState::PUBLISHED
51
- = localized.label :published, t('.published'), :class => :radio, :for => :kuhsaft_page_localized_pages_attributes_0_published_1
52
- .column.grid-5
53
- = localized.radio_button :published, Kuhsaft::PublishState::PUBLISHED_AT
54
- = localized.label :published, t('.published_at'), :class => :radio, :for => :kuhsaft_page_localized_pages_attributes_0_published_2
55
- = localized.text_field :published_at, :class => 'small string', :placeholder => 'dd.mm.yyyy HH:MM'
56
- .column.grid-2
57
- = page.button :submit, :class => 'input-button'
58
- .clear
19
+ .form-actions
20
+ = form.button :submit, :class => 'btn btn-primary'
59
21
 
60
- :javascript
61
- $(".toggle").click(function(){
62
- $(this).toggleClass("closed").next(".collapsable").toggleClass("hidden")
63
- })
22
+ #page-content.tab-pane{ :class => content_tab_active(@page) }
23
+ - if @page.persisted?
24
+ .clearfix
25
+ .actions
26
+ .btn-group
27
+ = render 'brick_type_dropdown', :brick_list => @page
28
+ = render 'kuhsaft/cms/bricks/brick_list', :brick_list => @page
@@ -1,11 +1,17 @@
1
- - content_for :cms_language_tabs do
2
- - Kuhsaft::Page.translation_locales.each do |locale|
3
- %li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, edit_cms_page_path(:locale => locale)
4
-
5
- .page-tree-breadcrumb
6
- = link_to(t('.pages'), cms_pages_path)
1
+ = render 'content_language_switch'
2
+ %ul.breadcrumb
3
+ %li
4
+ = link_to Kuhsaft::Page.model_name.human(:count => 2), kuhsaft.cms_pages_path
5
+ %span.divider /
7
6
  - @page.parent_pages.each do |parent_page|
8
- = link_to(parent_page.title, edit_cms_page_path(parent_page))
7
+ %li
8
+ - if @page.parent_pages.last == parent_page
9
+ .active
10
+ = parent_page.title
11
+ - else
12
+ = link_to parent_page.title, kuhsaft.edit_cms_page_path(parent_page)
13
+ %span.divider /
9
14
 
15
+ %h1= @page.title
10
16
  .box-container
11
- = render :partial => 'form', :locals => { :url => cms_page_path(@page), :page_title => t('.edit_html', :title => @page.title ) }
17
+ = render :partial => 'form', :locals => { :url => kuhsaft.cms_page_path(@page), :page_title => t('.edit_html', :title => @page.title ) }
@@ -1,8 +1,8 @@
1
- - content_for :cms_language_tabs do
2
- - Kuhsaft::Page.translation_locales.each do |locale|
3
- %li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, cms_pages_path(:locale => locale)
4
-
5
- - content_for :admin_toolbar do
6
- = link_to t('.create'), new_cms_page_path, :class => 'small-button'
7
- %ul.pages-root.sortable
8
- = render :partial => 'branch', :locals => { :pages => @pages }
1
+ %h1= controller.request.host
2
+ .actions.row
3
+ .span9
4
+ .span3
5
+ = link_to kuhsaft.new_cms_page_path, :class => 'btn btn-primary' do
6
+ %i.icon-plus-sign.icon-white
7
+ = t('.add_page')
8
+ = render :partial => 'branch', :locals => { :pages => @pages }
@@ -1,10 +1 @@
1
- - content_for :cms_language_tabs do
2
- - Kuhsaft::Page.translation_locales.each do |locale|
3
- %li{ :class => (:current if params[:locale] == locale.to_s) }= link_to locale.to_s, new_cms_page_path(:locale => locale)
4
-
5
- .page-tree-breadcrumb
6
- - available_parent_pages.each do |parent_page|
7
- = link_to((parent_page[:title].presence || parent_page.title), parent_page[:link].presence || edit_cms_page_path(parent_page))
8
-
9
- .box-container
10
- = render :partial => 'form', :locals => { :url => cms_pages_path, :page_title => t('.new') }
1
+ = render :partial => 'form', :locals => { :url => kuhsaft.cms_pages_path, :page_title => t('.new') }
@@ -0,0 +1,3 @@
1
+ %div{ :class => column_brick.to_style_class }
2
+ - column_brick.bricks.each do |brick|
3
+ = render brick
@@ -0,0 +1,9 @@
1
+ %div{ :class => image_brick.to_style_class }
2
+ = image_tag image_brick.image.converted.url
3
+ - if image_brick.caption.present?
4
+ .image-caption
5
+ - if image_brick.href.present?
6
+ = link_to image_brick.href do
7
+ = image_brick.caption
8
+ - else
9
+ = image_brick.caption
@@ -0,0 +1,10 @@
1
+ - if brick.image.thumb.present?
2
+ .control-group
3
+ %label.control-label= t('.image_preview')
4
+ .controls
5
+ = link_to brick.image.converted.url do
6
+ = image_tag brick.image.thumb
7
+ = form.input :image, :as => :file, :input_html => { :class => 'span3' }
8
+ = form.input :image_size, :collection => Kuhsaft::ImageSize.all, :label_method => :label, :value_method => :name, :input_html => { :class => 'span3' }, :include_blank => false
9
+ = form.input :caption, :as => :string, :input_html => { :class => 'span6' }
10
+ = form.input :href, :as => :string, :input_html => { :class => 'span6' }
@@ -0,0 +1,3 @@
1
+ %div{ :class => link_brick.to_style_class }
2
+ %a{ :href => link_brick.href }
3
+ = link_brick.caption
@@ -0,0 +1,3 @@
1
+ = form.input :href, :as => :string, :input_html => { :class => 'span6' }
2
+ = form.input :caption, :as => :string, :input_html => { :class => 'span6' }
3
+ = form.input :link_style, :collection => Kuhsaft::LinkBrick.styles
@@ -1,3 +1,5 @@
1
- - unless @page.blank?
2
- - @page.page_parts.each do |pp|
3
- = render :partial => pp.show_partial_path, :locals => { :page_part => pp }
1
+ - cache @page do
2
+ - unless @page.blank?
3
+ .page-content
4
+ - @page.bricks.localized.each do |brick|
5
+ = render brick