kuhsaft 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -0
  3. data/Rakefile +6 -5
  4. data/app/assets/javascripts/ckeditor/plugins/adv_link/LICENSE.txt +674 -0
  5. data/app/assets/javascripts/ckeditor/plugins/adv_link/README.md +62 -0
  6. data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/anchor.js.coffee +81 -0
  7. data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/link.js.coffee +1353 -0
  8. data/app/assets/javascripts/ckeditor/plugins/adv_link/images/anchor.png +0 -0
  9. data/app/assets/javascripts/ckeditor/plugins/adv_link/images/hidpi/anchor.png +0 -0
  10. data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/de.js +68 -0
  11. data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/en.js +68 -0
  12. data/app/assets/javascripts/ckeditor/plugins/adv_link/plugin.js.coffee +282 -0
  13. data/app/assets/javascripts/kuhsaft/cms/application.js.coffee.erb +42 -4
  14. data/app/assets/stylesheets/kuhsaft/application.css.sass +0 -3
  15. data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +26 -11
  16. data/app/controllers/kuhsaft/api/pages_controller.rb +14 -0
  17. data/app/controllers/kuhsaft/cms/admin_controller.rb +1 -1
  18. data/app/controllers/kuhsaft/cms/assets_controller.rb +7 -7
  19. data/app/controllers/kuhsaft/cms/bricks_controller.rb +15 -4
  20. data/app/controllers/kuhsaft/cms/pages_controller.rb +8 -15
  21. data/app/controllers/kuhsaft/pages_controller.rb +16 -6
  22. data/app/controllers/kuhsaft/sitemaps_controller.rb +13 -0
  23. data/app/helpers/cms_helper.rb +4 -4
  24. data/app/helpers/kuhsaft/admin_helper.rb +0 -1
  25. data/app/helpers/kuhsaft/cms/admin_helper.rb +1 -2
  26. data/app/helpers/kuhsaft/cms/pages_helper.rb +2 -7
  27. data/app/helpers/pages_helper.rb +8 -37
  28. data/app/helpers/sitemaps_helper.rb +12 -0
  29. data/app/models/kuhsaft/accordion_item_brick.rb +1 -1
  30. data/app/models/kuhsaft/anchor_brick.rb +1 -1
  31. data/app/models/kuhsaft/asset.rb +26 -23
  32. data/app/models/kuhsaft/asset_brick.rb +2 -1
  33. data/app/models/kuhsaft/brick.rb +38 -16
  34. data/app/models/kuhsaft/brick_type.rb +2 -2
  35. data/app/models/kuhsaft/brick_type_filter.rb +0 -2
  36. data/app/models/kuhsaft/column_brick.rb +0 -1
  37. data/app/models/kuhsaft/image_brick.rb +2 -2
  38. data/app/models/kuhsaft/image_size.rb +0 -1
  39. data/app/models/kuhsaft/link_brick.rb +1 -1
  40. data/app/models/kuhsaft/page.rb +111 -107
  41. data/app/models/kuhsaft/page_type.rb +1 -1
  42. data/app/models/kuhsaft/partition.rb +12 -12
  43. data/app/models/kuhsaft/placeholder_brick.rb +8 -0
  44. data/app/models/kuhsaft/publish_state.rb +9 -10
  45. data/app/models/kuhsaft/slider_brick.rb +0 -2
  46. data/app/models/kuhsaft/text_brick.rb +1 -1
  47. data/app/models/kuhsaft/two_column_brick.rb +0 -1
  48. data/app/models/kuhsaft/video_brick.rb +1 -2
  49. data/app/uploaders/kuhsaft/asset_brick_asset_uploader.rb +39 -38
  50. data/app/uploaders/kuhsaft/asset_uploader.rb +43 -43
  51. data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +7 -34
  52. data/app/views/kuhsaft/asset_bricks/asset_brick/_edit.html.haml +3 -2
  53. data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +2 -2
  54. data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +17 -10
  55. data/app/views/kuhsaft/cms/bricks/_new.html.haml +34 -0
  56. data/app/views/kuhsaft/cms/bricks/create.js.haml +6 -0
  57. data/app/views/kuhsaft/cms/bricks/destroy.js.haml +4 -0
  58. data/app/views/kuhsaft/cms/bricks/new.js.haml +11 -0
  59. data/app/views/kuhsaft/cms/pages/_branch.html.haml +2 -2
  60. data/app/views/kuhsaft/cms/pages/_form.html.haml +29 -18
  61. data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -7
  62. data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +3 -0
  63. data/app/views/kuhsaft/pages/show.html.haml +1 -9
  64. data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +1 -1
  65. data/app/views/kuhsaft/sitemaps/index.xml.haml +9 -0
  66. data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +4 -4
  67. data/app/views/layouts/kuhsaft/cms/application.html.haml +4 -3
  68. data/config/initializers/simple_form.rb +4 -4
  69. data/config/initializers/simple_form_bootstrap.rb +14 -14
  70. data/config/locales/de.yml +203 -0
  71. data/config/locales/en.yml +282 -0
  72. data/config/locales/kuhsaft.de.yml +14 -0
  73. data/config/locales/kuhsaft.en.yml +60 -0
  74. data/config/locales/models/kuhsaft/image_brick/de.yml +1 -0
  75. data/config/locales/models/kuhsaft/image_brick/en.yml +16 -0
  76. data/config/locales/models/kuhsaft/text_brick/de.yml +3 -0
  77. data/config/locales/models/kuhsaft/text_brick/en.yml +16 -0
  78. data/config/locales/models/kuhsaft/video_brick/en.yml +15 -0
  79. data/config/locales/views/kuhsaft/cms/pages/de.yml +3 -0
  80. data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +1 -1
  81. data/config/routes.rb +18 -9
  82. data/db/migrate/10_add_redirect_url_to_kuhsaft_pages.rb +1 -1
  83. data/db/migrate/11_update_url_and_redirect_url_value.rb +4 -4
  84. data/db/migrate/13_add_page_title_to_pages.rb +1 -1
  85. data/db/migrate/15_add_alt_text_to_bricks.rb +5 -0
  86. data/db/migrate/16_update_default_value_for_page_type.rb +9 -0
  87. data/db/migrate/17_set_page_type_to_content_for_empty_fields.rb +7 -0
  88. data/lib/generators/kuhsaft/assets/install_generator.rb +1 -2
  89. data/lib/generators/kuhsaft/translations/add_generator.rb +19 -4
  90. data/lib/kuhsaft.rb +1 -0
  91. data/lib/kuhsaft/brick_list.rb +6 -8
  92. data/lib/kuhsaft/engine.rb +5 -1
  93. data/lib/kuhsaft/orderable.rb +22 -19
  94. data/lib/kuhsaft/partial_extractor.rb +1 -1
  95. data/lib/kuhsaft/searchable.rb +8 -11
  96. data/lib/kuhsaft/translatable.rb +35 -19
  97. data/lib/kuhsaft/version.rb +1 -1
  98. data/lib/tasks/kuhsaft_tasks.rake +12 -0
  99. data/lib/templates/kuhsaft/assets/ck-config.js.coffee +7 -0
  100. data/lib/templates/kuhsaft/translations/add_translation.html.erb +4 -10
  101. data/spec/controllers/kuhsaft/api/pages_controller_spec.rb +70 -0
  102. data/spec/controllers/kuhsaft/pages_controller_spec.rb +18 -14
  103. data/spec/controllers/kuhsaft/sitemaps_controller_spec.rb +13 -0
  104. data/spec/dummy/app/assets/javascripts/kuhsaft/cms/ck-config.js.coffee +7 -0
  105. data/spec/dummy/config/application.rb +2 -1
  106. data/spec/dummy/config/database.yml +1 -1
  107. data/spec/factories.rb +3 -3
  108. data/spec/features/cms_pages_spec.rb +13 -13
  109. data/spec/features/search_spec.rb +16 -18
  110. data/spec/helpers/kuhsaft/cms/pages_helper_spec.rb +2 -1
  111. data/spec/kuhsaft_spec.rb +1 -1
  112. data/spec/lib/brick_list_spec.rb +1 -1
  113. data/spec/lib/page_tree_spec.rb +10 -6
  114. data/spec/lib/searchable_spec.rb +4 -4
  115. data/spec/lib/translatable_spec.rb +114 -44
  116. data/spec/models/anchor_brick_spec.rb +1 -1
  117. data/spec/models/asset_spec.rb +1 -1
  118. data/spec/models/brick_spec.rb +1 -1
  119. data/spec/models/page_spec.rb +48 -37
  120. data/spec/models/publish_state_spec.rb +9 -9
  121. data/spec/spec_helper.rb +43 -21
  122. data/spec/support/kuhsaft_spec_helper.rb +2 -2
  123. data/spec/support/write_expectation.rb +57 -0
  124. data/spec/views/kuhsaft/sitemaps/index.xml.haml_spec.rb +67 -0
  125. metadata +119 -4
@@ -2,7 +2,7 @@ module Kuhsaft
2
2
  class PageType
3
3
  REDIRECT = 'redirect'
4
4
  NAVIGATION = 'navigation'
5
- CONTENT = ''
5
+ CONTENT = 'content'
6
6
 
7
7
  def self.all
8
8
  [CONTENT, REDIRECT, NAVIGATION]
@@ -1,18 +1,18 @@
1
1
  module Kuhsaft
2
2
  class Partition
3
- attr_reader :name, :id
3
+ attr_reader :name, :id
4
4
 
5
- def initialize(name, id)
6
- @name = name
7
- @id = id
8
- end
5
+ def initialize(name, id)
6
+ @name = name
7
+ @id = id
8
+ end
9
9
 
10
- def self.style_for_index(style, idx)
11
- [
12
- ['span8', 'span4'],
13
- ['span6', 'span6'],
14
- ['span4', 'span8']
15
- ][style][idx]
16
- end
10
+ def self.style_for_index(style, idx)
11
+ [
12
+ %w(span8 span4),
13
+ %w(span6 span6),
14
+ %w(span4 span8)
15
+ ][style][idx]
17
16
  end
17
+ end
18
18
  end
@@ -9,5 +9,13 @@ module Kuhsaft
9
9
  def user_can_add_childs?
10
10
  false
11
11
  end
12
+
13
+ def partial_name
14
+ "kuhsaft/placeholder_bricks/partials/#{template_name}"
15
+ end
16
+
17
+ def cache_key
18
+ super + partial_digest(partial_name)
19
+ end
12
20
  end
13
21
  end
@@ -1,25 +1,24 @@
1
1
  module Kuhsaft
2
2
  class PublishState
3
-
4
3
  extend ActiveModel::Translation
5
-
4
+
6
5
  UNPUBLISHED = 0
7
6
  PUBLISHED = 1
8
7
  PUBLISHED_AT = 2
9
-
8
+
10
9
  attr_reader :name
11
10
  attr_reader :value
12
-
13
- def initialize options
14
- options.each_pair { |k,v| instance_variable_set("@#{k}", v) if respond_to?(k) }
11
+
12
+ def initialize(options)
13
+ options.each_pair { |k, v| instance_variable_set("@#{k}", v) if respond_to?(k) }
15
14
  end
16
15
 
17
16
  def self.all
18
17
  @all ||= [
19
- PublishState.new(:name => 'published', :value => PUBLISHED),
20
- PublishState.new(:name => 'unpublished', :value => UNPUBLISHED),
21
- PublishState.new(:name => 'published_at', :value => PUBLISHED_AT)
18
+ PublishState.new(name: 'published', value: PUBLISHED),
19
+ PublishState.new(name: 'unpublished', value: UNPUBLISHED),
20
+ PublishState.new(name: 'published_at', value: PUBLISHED_AT)
22
21
  ]
23
22
  end
24
23
  end
25
- end
24
+ end
@@ -14,7 +14,5 @@ module Kuhsaft
14
14
  def allowed_brick_types
15
15
  %w(Kuhsaft::ImageBrick Kuhsaft::VideoBrick)
16
16
  end
17
-
18
17
  end
19
18
  end
20
-
@@ -5,7 +5,7 @@ module Kuhsaft
5
5
  include ActionView::Helpers::SanitizeHelper
6
6
  HTML_ENTITIES = HTMLEntities.new
7
7
 
8
- validates_presence_of :text
8
+ validates :text, presence: true
9
9
 
10
10
  def user_can_add_childs?
11
11
  false
@@ -1,6 +1,5 @@
1
1
  module Kuhsaft
2
2
  class TwoColumnBrick < ColumnBrick
3
-
4
3
  before_create :add_columns
5
4
 
6
5
  #
@@ -1,11 +1,10 @@
1
1
  module Kuhsaft
2
2
  class VideoBrick < Brick
3
-
4
3
  YOUTUBE = 'youtube'
5
4
  VIMEO = 'vimeo'
6
5
  EXTERNAL = 'external'
7
6
 
8
- validates :any_source, :presence => true
7
+ validates :any_source, presence: true
9
8
 
10
9
  # a video id, an embed code or a link to a video is required
11
10
  def any_source
@@ -1,42 +1,43 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Kuhsaft::AssetBrickAssetUploader < CarrierWave::Uploader::Base
4
-
5
- # Include RMagick or ImageScience support:
6
- # include CarrierWave::MiniMagick
7
- #include CarrierWave::ImageScience
8
-
9
- # Choose what kind of storage to use for this uploader:
10
- storage :file
11
- # storage :s3
12
-
13
- # Override the directory where uploaded files will be stored.
14
- # This is a sensible default for uploaders that are meant to be mounted:
15
- def store_dir
16
- "uploads/#{model.class.name.underscore.gsub(/^kuhsaft/,'cms')}/#{mounted_as}/#{model.id}"
3
+ module Kuhsaft
4
+ class AssetBrickAssetUploader < CarrierWave::Uploader::Base
5
+ # Include RMagick or ImageScience support:
6
+ # include CarrierWave::MiniMagick
7
+ # include CarrierWave::ImageScience
8
+
9
+ # Choose what kind of storage to use for this uploader:
10
+ storage :file
11
+ # storage :s3
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ model_identifier = model.class.name.underscore.gsub(/^kuhsaft/, 'cms')
17
+ "uploads/#{model_identifier}/#{mounted_as}/#{model.id}"
18
+ end
19
+
20
+ # Provide a default URL as a default if there hasn't been a file uploaded:
21
+ # def default_url
22
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
23
+ # end
24
+
25
+ # Process files as they are uploaded:
26
+ # process :scale => [200, 300]
27
+ #
28
+ # def scale(width, height)
29
+ # # do something
30
+ # end
31
+
32
+ # Add a white list of extensions which are allowed to be uploaded.
33
+ # For images you might use something like this:
34
+ def extension_white_list
35
+ %w(pdf doc docx xls xlsx ppt pptx)
36
+ end
37
+
38
+ # Override the filename of the uploaded files:
39
+ # def filename
40
+ # "something.jpg" if original_filename
41
+ # end
17
42
  end
18
-
19
- # Provide a default URL as a default if there hasn't been a file uploaded:
20
- # def default_url
21
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
22
- # end
23
-
24
- # Process files as they are uploaded:
25
- # process :scale => [200, 300]
26
- #
27
- # def scale(width, height)
28
- # # do something
29
- # end
30
-
31
- # Add a white list of extensions which are allowed to be uploaded.
32
- # For images you might use something like this:
33
- def extension_white_list
34
- %w(pdf doc docx xls xlsx ppt pptx)
35
- end
36
-
37
- # Override the filename of the uploaded files:
38
- # def filename
39
- # "something.jpg" if original_filename
40
- # end
41
-
42
43
  end
@@ -1,50 +1,50 @@
1
1
  # encoding: utf-8
2
+ module Kuhsaft
3
+ class AssetUploader < CarrierWave::Uploader::Base
4
+ # Include RMagick or ImageScience support:
5
+ include CarrierWave::MiniMagick
6
+ # include CarrierWave::ImageScience
7
+
8
+ # Choose what kind of storage to use for this uploader:
9
+ storage :file
10
+ # storage :s3
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/#{mounted_as}/#{model.id}"
16
+ end
2
17
 
3
- class Kuhsaft::AssetUploader < CarrierWave::Uploader::Base
4
-
5
- # Include RMagick or ImageScience support:
6
- include CarrierWave::MiniMagick
7
- #include CarrierWave::ImageScience
8
-
9
- # Choose what kind of storage to use for this uploader:
10
- storage :file
11
- # storage :s3
12
-
13
- # Override the directory where uploaded files will be stored.
14
- # This is a sensible default for uploaders that are meant to be mounted:
15
- def store_dir
16
- "uploads/#{mounted_as}/#{model.id}"
17
- end
18
-
19
- # Provide a default URL as a default if there hasn't been a file uploaded:
20
- # def default_url
21
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
22
- # end
23
-
24
- # Process files as they are uploaded:
25
- # process :scale => [200, 300]
26
- #
27
- # def scale(width, height)
28
- # # do something
29
- # end
18
+ # Provide a default URL as a default if there hasn't been a file uploaded:
19
+ # def default_url
20
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
21
+ # end
22
+
23
+ # Process files as they are uploaded:
24
+ # process :scale => [200, 300]
25
+ #
26
+ # def scale(width, height)
27
+ # # do something
28
+ # end
29
+
30
+ # Create different versions of your uploaded files:
31
+ version :thumb do
32
+ process :resize_images
33
+ def resize_images
34
+ resize_to_fill(100, 100) if @file.present? && @file.content_type.present? &&
35
+ @file.content_type.include?('image')
36
+ end
37
+ end
30
38
 
31
- # Create different versions of your uploaded files:
32
- version :thumb do
33
- process :resize_images
34
- def resize_images
35
- resize_to_fill(100, 100) if @file.present? && @file.content_type.present? && @file.content_type.include?('image')
39
+ # Add a white list of extensions which are allowed to be uploaded.
40
+ # For images you might use something like this:
41
+ def extension_white_list
42
+ %w(jpg jpeg png pdf)
36
43
  end
37
- end
38
44
 
39
- # Add a white list of extensions which are allowed to be uploaded.
40
- # For images you might use something like this:
41
- def extension_white_list
42
- %w(jpg jpeg png pdf)
45
+ # Override the filename of the uploaded files:
46
+ # def filename
47
+ # "something.jpg" if original_filename
48
+ # end
43
49
  end
44
-
45
- # Override the filename of the uploaded files:
46
- # def filename
47
- # "something.jpg" if original_filename
48
- # end
49
-
50
50
  end
@@ -1,47 +1,27 @@
1
1
  # encoding: utf-8
2
2
  module Kuhsaft
3
3
  class ImageBrickImageUploader < CarrierWave::Uploader::Base
4
- # include CarrierWave::RMagick
5
4
  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
5
 
10
6
  storage :file
11
7
 
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
8
  def store_dir
15
- "uploads/#{model.class.name.underscore.gsub(/^kuhsaft/,'cms')}/#{mounted_as}/#{model.id}"
9
+ model_identifier = model.class.name.underscore.gsub(/^kuhsaft/, 'cms')
10
+ "uploads/#{model_identifier}/#{mounted_as}/#{model.id}/#{version_name}"
16
11
  end
17
12
 
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
13
+ def full_filename(for_file)
14
+ File.basename for_file
15
+ end
33
16
 
34
- # Create different versions of your uploaded files:
35
17
  version :converted do
36
18
  process :process_brick_image_size
37
19
  end
38
20
 
39
- version :thumb, :from_version => :converted do
40
- process :resize_to_fill => [160, 90]
21
+ version :thumb, from_version: :converted do
22
+ process resize_to_fill: [160, 90]
41
23
  end
42
24
 
43
- # Add a white list of extensions which are allowed to be uploaded.
44
- # For images you might use something like this:
45
25
  def extension_white_list
46
26
  %w(jpg jpeg gif png)
47
27
  end
@@ -52,12 +32,5 @@ module Kuhsaft
52
32
  resize_to_fill(image_size.width, image_size.height)
53
33
  end
54
34
  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
35
  end
63
36
  end
@@ -1,7 +1,8 @@
1
- = form.input :caption, :as => :string, :input_html => { :class => 'span6' }
1
+ = form.input :caption, as: :string, input_html: { :class => 'span6' }
2
2
  = form.input :asset
3
+ = form.input :asset_cache, as: :hidden
3
4
  - if brick.asset.present?
4
5
  .countrol-group
5
6
  %label
6
7
  = link_to File.basename(brick.asset.url), brick.asset.url
7
- = form.input :link_style, :collection => Kuhsaft::AssetBrick.styles
8
+ = form.input :link_style, collection: Kuhsaft::AssetBrick.styles
@@ -7,8 +7,8 @@
7
7
  - brick_list.brick_types.allowed.group_by(&:group).each do |group, types|
8
8
  - types.each do |type|
9
9
  %li
10
- = 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
+ = link_to type.class_name.constantize.model_name.human, kuhsaft.new_cms_brick_path(:brick => {:type => type.class_name, :brick_list_id => brick_list.id, :brick_list_type => brick_list.brick_list_type}), :remote => true
11
11
  .divider
12
12
  - else
13
13
  - brick_list.brick_types.allowed.each do |type|
14
- = link_to t('.add_specific_element', :name => 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, :class => 'btn btn-small btn-primary'
14
+ = link_to t('.add_specific_element', :name => type.class_name.constantize.model_name.human), kuhsaft.new_cms_brick_path(:brick => { :type => type.class_name, :brick_list_id => brick_list.id, :brick_list_type => brick_list.brick_list_type }), :remote => true, :class => 'btn btn-small btn-primary'
@@ -1,38 +1,45 @@
1
1
  .brick-item{ :id => brick.to_brick_item_id, :class => brick.to_style_class, 'data-id' => brick.id }
2
2
  = simple_form_for brick, :as => :brick, :url => kuhsaft.cms_brick_path(brick), :remote => !brick.uploader?, :html => { :id => nil }, :wrapper => :bootstrap do |form|
3
3
  = form.hidden_field :position, :class => 'position-field'
4
+ - brick_content = render(brick.to_edit_partial_path, :brick => brick, :form => form)
4
5
  .brick-item-header.clearfix
5
6
  .pull-left
7
+ - if brick_content.present?
8
+ .resize-toggler.btn.btn-small{ 'data-toggle' => 'collapse', 'data-target' => "#brick-content-#{brick.id}" }
9
+ %i.icon-resize-full
10
+ %i.icon-resize-small
6
11
  - if brick.caption.present?
7
12
  = brick.caption
8
13
  %span.muted
9
14
  = brick.backend_label(:parenthesis => true)
10
15
  .pull-right
11
16
  .btn-toolbar
12
- - # delete button
13
17
  - if brick.persisted?
14
- - if brick.user_can_delete?
15
- .btn-group
16
- = 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
17
- %i.icon-trash.icon-white
18
18
 
19
19
  - # possible styles
20
20
  - unless brick.available_display_styles.empty?
21
- .btn-group
22
- %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
21
+ #display-styles.btn-group
22
+ .btn.btn-small
23
23
  %i.icon-tint
24
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
25
+ %span.caret
24
26
  %ul.dropdown-menu.pull-right
25
27
  %li
26
- = form.input :display_styles, :collection => brick.available_display_styles, :as => :check_boxes
28
+ = form.input :display_styles, :collection => brick.translated_available_display_styles, :as => :check_boxes
29
+
30
+ -# delete button
31
+ - if brick.user_can_delete?
32
+ .btn-group
33
+ = link_to kuhsaft.cms_brick_path(brick), :class => 'btn btn-small btn-danger', data: { confirm: t('kuhsaft.cms.bricks.brick_item.confirm') }, :method => :delete, :remote => true do
34
+ %i.icon-trash.icon-white
27
35
 
28
36
  - # addable child dropdown menu
29
37
  - if brick.respond_to?(:brick_list)
30
38
  .btn-group
31
39
  = render 'brick_type_dropdown', :brick_list => brick
32
40
 
33
- - brick_content = render(brick.to_edit_partial_path, :brick => brick, :form => form)
34
41
  - if brick_content.present?
35
- .brick-item-content
42
+ .brick-item-content.collapse.in{ :id => "brick-content-#{brick.id}", 'data-toggle' => true }
36
43
  = brick_content
37
44
  - if brick.user_can_save?
38
45
  - # save button