kuhsaft 2.2.6 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -0
- data/Rakefile +6 -5
- data/app/assets/javascripts/ckeditor/plugins/adv_link/LICENSE.txt +674 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/README.md +62 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/anchor.js.coffee +81 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/link.js.coffee +1353 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/images/anchor.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/images/hidpi/anchor.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/de.js +68 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/en.js +68 -0
- data/app/assets/javascripts/ckeditor/plugins/adv_link/plugin.js.coffee +282 -0
- data/app/assets/javascripts/kuhsaft/cms/application.js.coffee.erb +42 -4
- data/app/assets/stylesheets/kuhsaft/application.css.sass +0 -3
- data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +26 -11
- data/app/controllers/kuhsaft/api/pages_controller.rb +14 -0
- data/app/controllers/kuhsaft/cms/admin_controller.rb +1 -1
- data/app/controllers/kuhsaft/cms/assets_controller.rb +7 -7
- data/app/controllers/kuhsaft/cms/bricks_controller.rb +15 -4
- data/app/controllers/kuhsaft/cms/pages_controller.rb +8 -15
- data/app/controllers/kuhsaft/pages_controller.rb +16 -6
- data/app/controllers/kuhsaft/sitemaps_controller.rb +13 -0
- data/app/helpers/cms_helper.rb +4 -4
- data/app/helpers/kuhsaft/admin_helper.rb +0 -1
- data/app/helpers/kuhsaft/cms/admin_helper.rb +1 -2
- data/app/helpers/kuhsaft/cms/pages_helper.rb +2 -7
- data/app/helpers/pages_helper.rb +8 -37
- data/app/helpers/sitemaps_helper.rb +12 -0
- data/app/models/kuhsaft/accordion_item_brick.rb +1 -1
- data/app/models/kuhsaft/anchor_brick.rb +1 -1
- data/app/models/kuhsaft/asset.rb +26 -23
- data/app/models/kuhsaft/asset_brick.rb +2 -1
- data/app/models/kuhsaft/brick.rb +38 -16
- data/app/models/kuhsaft/brick_type.rb +2 -2
- data/app/models/kuhsaft/brick_type_filter.rb +0 -2
- data/app/models/kuhsaft/column_brick.rb +0 -1
- data/app/models/kuhsaft/image_brick.rb +2 -2
- data/app/models/kuhsaft/image_size.rb +0 -1
- data/app/models/kuhsaft/link_brick.rb +1 -1
- data/app/models/kuhsaft/page.rb +111 -107
- data/app/models/kuhsaft/page_type.rb +1 -1
- data/app/models/kuhsaft/partition.rb +12 -12
- data/app/models/kuhsaft/placeholder_brick.rb +8 -0
- data/app/models/kuhsaft/publish_state.rb +9 -10
- data/app/models/kuhsaft/slider_brick.rb +0 -2
- data/app/models/kuhsaft/text_brick.rb +1 -1
- data/app/models/kuhsaft/two_column_brick.rb +0 -1
- data/app/models/kuhsaft/video_brick.rb +1 -2
- data/app/uploaders/kuhsaft/asset_brick_asset_uploader.rb +39 -38
- data/app/uploaders/kuhsaft/asset_uploader.rb +43 -43
- data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +7 -34
- data/app/views/kuhsaft/asset_bricks/asset_brick/_edit.html.haml +3 -2
- data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +2 -2
- data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +17 -10
- data/app/views/kuhsaft/cms/bricks/_new.html.haml +34 -0
- data/app/views/kuhsaft/cms/bricks/create.js.haml +6 -0
- data/app/views/kuhsaft/cms/bricks/destroy.js.haml +4 -0
- data/app/views/kuhsaft/cms/bricks/new.js.haml +11 -0
- data/app/views/kuhsaft/cms/pages/_branch.html.haml +2 -2
- data/app/views/kuhsaft/cms/pages/_form.html.haml +29 -18
- data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -7
- data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +3 -0
- data/app/views/kuhsaft/pages/show.html.haml +1 -9
- data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +1 -1
- data/app/views/kuhsaft/sitemaps/index.xml.haml +9 -0
- data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +4 -4
- data/app/views/layouts/kuhsaft/cms/application.html.haml +4 -3
- data/config/initializers/simple_form.rb +4 -4
- data/config/initializers/simple_form_bootstrap.rb +14 -14
- data/config/locales/de.yml +203 -0
- data/config/locales/en.yml +282 -0
- data/config/locales/kuhsaft.de.yml +14 -0
- data/config/locales/kuhsaft.en.yml +60 -0
- data/config/locales/models/kuhsaft/image_brick/de.yml +1 -0
- data/config/locales/models/kuhsaft/image_brick/en.yml +16 -0
- data/config/locales/models/kuhsaft/text_brick/de.yml +3 -0
- data/config/locales/models/kuhsaft/text_brick/en.yml +16 -0
- data/config/locales/models/kuhsaft/video_brick/en.yml +15 -0
- data/config/locales/views/kuhsaft/cms/pages/de.yml +3 -0
- data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +1 -1
- data/config/routes.rb +18 -9
- data/db/migrate/10_add_redirect_url_to_kuhsaft_pages.rb +1 -1
- data/db/migrate/11_update_url_and_redirect_url_value.rb +4 -4
- data/db/migrate/13_add_page_title_to_pages.rb +1 -1
- data/db/migrate/15_add_alt_text_to_bricks.rb +5 -0
- data/db/migrate/16_update_default_value_for_page_type.rb +9 -0
- data/db/migrate/17_set_page_type_to_content_for_empty_fields.rb +7 -0
- data/lib/generators/kuhsaft/assets/install_generator.rb +1 -2
- data/lib/generators/kuhsaft/translations/add_generator.rb +19 -4
- data/lib/kuhsaft.rb +1 -0
- data/lib/kuhsaft/brick_list.rb +6 -8
- data/lib/kuhsaft/engine.rb +5 -1
- data/lib/kuhsaft/orderable.rb +22 -19
- data/lib/kuhsaft/partial_extractor.rb +1 -1
- data/lib/kuhsaft/searchable.rb +8 -11
- data/lib/kuhsaft/translatable.rb +35 -19
- data/lib/kuhsaft/version.rb +1 -1
- data/lib/tasks/kuhsaft_tasks.rake +12 -0
- data/lib/templates/kuhsaft/assets/ck-config.js.coffee +7 -0
- data/lib/templates/kuhsaft/translations/add_translation.html.erb +4 -10
- data/spec/controllers/kuhsaft/api/pages_controller_spec.rb +70 -0
- data/spec/controllers/kuhsaft/pages_controller_spec.rb +18 -14
- data/spec/controllers/kuhsaft/sitemaps_controller_spec.rb +13 -0
- data/spec/dummy/app/assets/javascripts/kuhsaft/cms/ck-config.js.coffee +7 -0
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/config/database.yml +1 -1
- data/spec/factories.rb +3 -3
- data/spec/features/cms_pages_spec.rb +13 -13
- data/spec/features/search_spec.rb +16 -18
- data/spec/helpers/kuhsaft/cms/pages_helper_spec.rb +2 -1
- data/spec/kuhsaft_spec.rb +1 -1
- data/spec/lib/brick_list_spec.rb +1 -1
- data/spec/lib/page_tree_spec.rb +10 -6
- data/spec/lib/searchable_spec.rb +4 -4
- data/spec/lib/translatable_spec.rb +114 -44
- data/spec/models/anchor_brick_spec.rb +1 -1
- data/spec/models/asset_spec.rb +1 -1
- data/spec/models/brick_spec.rb +1 -1
- data/spec/models/page_spec.rb +48 -37
- data/spec/models/publish_state_spec.rb +9 -9
- data/spec/spec_helper.rb +43 -21
- data/spec/support/kuhsaft_spec_helper.rb +2 -2
- data/spec/support/write_expectation.rb +57 -0
- data/spec/views/kuhsaft/sitemaps/index.xml.haml_spec.rb +67 -0
- metadata +119 -4
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
module Kuhsaft
|
|
2
2
|
class Partition
|
|
3
|
-
|
|
3
|
+
attr_reader :name, :id
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
def initialize(name, id)
|
|
6
|
+
@name = name
|
|
7
|
+
@id = id
|
|
8
|
+
end
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
@@ -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
|
|
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(:
|
|
20
|
-
PublishState.new(:
|
|
21
|
-
PublishState.new(:
|
|
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
|
|
@@ -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, :
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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, :
|
|
40
|
-
process :
|
|
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, :
|
|
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, :
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|