kuhsaft 2.2.6 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/app/models/kuhsaft/asset.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module Kuhsaft
|
2
|
+
class Asset < ActiveRecord::Base
|
3
|
+
scope :by_date, -> { order('updated_at DESC') }
|
4
|
+
mount_uploader :file, Kuhsaft::AssetUploader
|
5
|
+
|
6
|
+
def file_type
|
7
|
+
return unless file.path.present?
|
8
|
+
|
9
|
+
ext = File.extname(file.path).split('.').last
|
10
|
+
ext.to_sym if ext.present?
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
File.basename(file.path) if file.present? && file.path.present?
|
15
|
+
end
|
16
|
+
|
17
|
+
def path
|
18
|
+
file.url
|
19
|
+
end
|
20
|
+
|
21
|
+
def path=(val)
|
22
|
+
# do nothing
|
23
|
+
end
|
24
|
+
|
25
|
+
def filename
|
26
|
+
try(:file).try(:file).try(:filename)
|
8
27
|
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def name
|
12
|
-
File.basename(file.path) if file.present? && file.path.present?
|
13
|
-
end
|
14
|
-
|
15
|
-
def path
|
16
|
-
file.url
|
17
|
-
end
|
18
|
-
|
19
|
-
def path=val
|
20
|
-
# do nothing
|
21
|
-
end
|
22
|
-
|
23
|
-
def filename
|
24
|
-
try(:file).try(:file).try(:filename)
|
25
28
|
end
|
26
29
|
end
|
data/app/models/kuhsaft/brick.rb
CHANGED
@@ -2,10 +2,10 @@ module Kuhsaft
|
|
2
2
|
class Brick < ActiveRecord::Base
|
3
3
|
include Kuhsaft::BrickList
|
4
4
|
|
5
|
-
belongs_to :brick_list, :
|
5
|
+
belongs_to :brick_list, polymorphic: true, touch: true
|
6
6
|
|
7
|
-
scope :localized, -> { where(:
|
8
|
-
default_scope
|
7
|
+
scope :localized, -> { where(locale: I18n.locale) }
|
8
|
+
default_scope { order('position ASC').localized }
|
9
9
|
|
10
10
|
serialize :display_styles, Array
|
11
11
|
|
@@ -16,7 +16,17 @@ module Kuhsaft
|
|
16
16
|
:type,
|
17
17
|
:brick_list_id,
|
18
18
|
:brick_list_type,
|
19
|
-
:
|
19
|
+
presence: true
|
20
|
+
|
21
|
+
validates :template_name,
|
22
|
+
:type,
|
23
|
+
:locale,
|
24
|
+
:caption,
|
25
|
+
:link_style,
|
26
|
+
:image_size,
|
27
|
+
:video,
|
28
|
+
:alt_text,
|
29
|
+
length: { maximum: 255 }
|
20
30
|
|
21
31
|
after_initialize do
|
22
32
|
self.position ||= has_siblings? ? brick_list.bricks.maximum(:position).to_i + 1 : 1
|
@@ -39,15 +49,13 @@ module Kuhsaft
|
|
39
49
|
end
|
40
50
|
|
41
51
|
def to_edit_partial_path
|
42
|
-
path =
|
52
|
+
path = to_partial_path.split '/'
|
43
53
|
path << 'edit'
|
44
54
|
path.join '/'
|
45
55
|
end
|
46
56
|
|
47
57
|
def has_siblings?
|
48
|
-
|
49
|
-
brick_list.bricks.any?
|
50
|
-
end
|
58
|
+
brick_list.present? && brick_list.bricks.any?
|
51
59
|
end
|
52
60
|
|
53
61
|
#
|
@@ -56,7 +64,7 @@ module Kuhsaft
|
|
56
64
|
# Returns the path to this partial.
|
57
65
|
#
|
58
66
|
def to_edit_childs_partial_path
|
59
|
-
path =
|
67
|
+
path = to_partial_path.split '/'
|
60
68
|
path << 'childs'
|
61
69
|
path.join '/'
|
62
70
|
end
|
@@ -74,12 +82,12 @@ module Kuhsaft
|
|
74
82
|
|
75
83
|
def set_position
|
76
84
|
self.position = if self.position.present?
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
85
|
+
self.position
|
86
|
+
elsif self.respond_to?(:brick_list) && brick_list.respond_to?(:bricks)
|
87
|
+
brick_list.bricks.maximum(:position).to_i + 1
|
88
|
+
else
|
89
|
+
1
|
90
|
+
end
|
83
91
|
end
|
84
92
|
|
85
93
|
def brick_list_type
|
@@ -88,7 +96,7 @@ module Kuhsaft
|
|
88
96
|
|
89
97
|
# Returns a css classname suitable for use in the frontend
|
90
98
|
def to_style_class
|
91
|
-
([self.class.to_s.underscore.dasherize.gsub('/', '-')] +
|
99
|
+
([self.class.to_s.underscore.dasherize.gsub('/', '-')] + display_styles).join(' ')
|
92
100
|
end
|
93
101
|
|
94
102
|
# Returns a unique DOM id suitable for use in the frontend
|
@@ -101,6 +109,12 @@ module Kuhsaft
|
|
101
109
|
[]
|
102
110
|
end
|
103
111
|
|
112
|
+
def translated_available_display_styles
|
113
|
+
available_display_styles.map do |style|
|
114
|
+
[I18n.t("#{self.class.to_s.demodulize.underscore}.display_styles.#{style}"), style]
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
104
118
|
def backend_label(options = {})
|
105
119
|
label = self.class.model_name.human
|
106
120
|
if options[:parenthesis] == true
|
@@ -109,5 +123,13 @@ module Kuhsaft
|
|
109
123
|
label
|
110
124
|
end
|
111
125
|
end
|
126
|
+
|
127
|
+
def partial_digest(name)
|
128
|
+
ActionView::Digestor.digest(name, 'haml', ApplicationController.new.lookup_context, partial: true)
|
129
|
+
end
|
130
|
+
|
131
|
+
def cache_key
|
132
|
+
super + partial_digest(to_partial_path)
|
133
|
+
end
|
112
134
|
end
|
113
135
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Kuhsaft
|
2
2
|
class BrickType < ActiveRecord::Base
|
3
3
|
scope :grouped, -> { order('`group`, `id` asc') }
|
4
|
-
scope :enabled, -> { where(:
|
5
|
-
scope :constrained, ->(list) { where(:
|
4
|
+
scope :enabled, -> { where(enabled: true) }
|
5
|
+
scope :constrained, ->(list) { where(class_name: list) }
|
6
6
|
end
|
7
7
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
2
|
module Kuhsaft
|
3
3
|
class BrickTypeFilter < SimpleDelegator
|
4
|
-
|
5
4
|
def empty?
|
6
5
|
!(respond_to?(:user_can_add_childs?) && user_can_add_childs? && !allowed.empty?)
|
7
6
|
end
|
@@ -15,6 +14,5 @@ module Kuhsaft
|
|
15
14
|
Kuhsaft::BrickType.enabled.constrained(allowed_brick_types)
|
16
15
|
end
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
end
|
@@ -2,8 +2,8 @@ module Kuhsaft
|
|
2
2
|
class ImageBrick < Brick
|
3
3
|
include Kuhsaft::ImageUploaderMounting
|
4
4
|
|
5
|
-
validates :image,
|
6
|
-
|
5
|
+
validates :image,
|
6
|
+
:image_size, presence: true
|
7
7
|
|
8
8
|
def collect_fulltext
|
9
9
|
[super, caption].join(' ')
|
data/app/models/kuhsaft/page.rb
CHANGED
@@ -1,142 +1,146 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module Kuhsaft
|
2
|
+
class Page < ActiveRecord::Base
|
3
|
+
include Kuhsaft::Engine.routes.url_helpers
|
4
|
+
include Kuhsaft::Orderable
|
5
|
+
include Kuhsaft::Translatable
|
6
|
+
include Kuhsaft::BrickList
|
7
|
+
include Kuhsaft::Searchable
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
has_ancestry
|
10
|
+
acts_as_brick_list
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
:slug,
|
14
|
-
:keywords,
|
15
|
-
:description,
|
16
|
-
:body,
|
17
|
-
:redirect_url,
|
18
|
-
:url
|
12
|
+
translate :title, :page_title, :slug, :keywords, :description,
|
13
|
+
:body, :redirect_url, :url
|
19
14
|
|
20
|
-
|
15
|
+
default_scope { order 'position ASC' }
|
21
16
|
|
22
|
-
|
23
|
-
|
17
|
+
scope :published, -> { where published: Kuhsaft::PublishState::PUBLISHED }
|
18
|
+
scope :translated, -> { where "url_#{I18n.locale} is not null" }
|
24
19
|
|
25
|
-
|
26
|
-
scope :content_page, -> { where(
|
27
|
-
["page_type is NULL or page_type = ?",
|
28
|
-
Kuhsaft::PageType::CONTENT]) }
|
20
|
+
scope :content_page, -> { where page_type: Kuhsaft::PageType::CONTENT }
|
29
21
|
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
scope :navigation, lambda { |slug|
|
23
|
+
where(
|
24
|
+
locale_attr(:slug) => slug,
|
25
|
+
locale_attr(:page_type) => Kuhsaft::PageType::NAVIGATION)
|
26
|
+
}
|
33
27
|
|
34
|
-
|
28
|
+
before_validation :create_slug, :create_url
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
validates :title, presence: true
|
31
|
+
validates :slug, presence: true
|
32
|
+
validates :redirect_url, presence: true, if: :redirect?
|
33
|
+
validates :title, :slug, :keywords, :page_type, length: { maximum: 255 }
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
class << self
|
36
|
+
def flat_tree(pages = nil)
|
37
|
+
arrange_as_array
|
38
|
+
end
|
39
|
+
|
40
|
+
def arrange_as_array(options = {}, hash = nil)
|
41
|
+
hash ||= arrange(options)
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
arr = []
|
44
|
+
hash.each do |node, children|
|
45
|
+
arr << node
|
46
|
+
arr += arrange_as_array(options, children) unless children.empty?
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
hash.each do |node, children|
|
50
|
-
arr << node
|
51
|
-
arr += arrange_as_array(options, children) unless children.empty?
|
49
|
+
arr
|
52
50
|
end
|
51
|
+
end
|
53
52
|
|
54
|
-
|
53
|
+
def without_self
|
54
|
+
self.class.where 'id != ?', id
|
55
55
|
end
|
56
|
-
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
def published?
|
58
|
+
published == Kuhsaft::PublishState::PUBLISHED
|
59
|
+
end
|
61
60
|
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
def state_class
|
62
|
+
published? ? 'published' : 'unpublished'
|
63
|
+
end
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
'published'
|
69
|
-
else
|
70
|
-
'unpublished'
|
65
|
+
def redirect?
|
66
|
+
page_type == Kuhsaft::PageType::REDIRECT
|
71
67
|
end
|
72
|
-
end
|
73
68
|
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
def navigation?
|
70
|
+
page_type == Kuhsaft::PageType::NAVIGATION
|
71
|
+
end
|
77
72
|
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
def parent_pages
|
74
|
+
ancestors
|
75
|
+
end
|
81
76
|
|
82
|
-
|
83
|
-
|
84
|
-
|
77
|
+
def translated?
|
78
|
+
url.present? && title.present? && slug.present?
|
79
|
+
end
|
85
80
|
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
def link
|
82
|
+
if bricks.count == 0 && children.count > 0
|
83
|
+
children.first.link
|
84
|
+
else
|
85
|
+
url_with_locale
|
86
|
+
end
|
87
|
+
end
|
89
88
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
# TODO: needs naming and routing refactoring (url/locale/path/slug)
|
90
|
+
def path_segments
|
91
|
+
paths = parent.present? ? parent.path_segments : []
|
92
|
+
paths << slug unless navigation?
|
93
|
+
paths
|
95
94
|
end
|
96
|
-
end
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
paths << slug unless navigation?
|
102
|
-
paths
|
103
|
-
end
|
96
|
+
def url_without_locale
|
97
|
+
path_segments.join('/')
|
98
|
+
end
|
104
99
|
|
105
|
-
|
106
|
-
|
107
|
-
|
100
|
+
def url_with_locale
|
101
|
+
opts = { locale: I18n.locale }
|
102
|
+
url = url_without_locale
|
103
|
+
opts[:url] = url if url.present?
|
104
|
+
page_path(opts)
|
105
|
+
end
|
108
106
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
opts[:url] = url if url.present?
|
113
|
-
page_path(opts)
|
114
|
-
end
|
107
|
+
def create_url
|
108
|
+
self.url = url_with_locale[1..-1]
|
109
|
+
end
|
115
110
|
|
116
|
-
|
117
|
-
|
118
|
-
|
111
|
+
def create_slug
|
112
|
+
has_slug = title.present? && slug.blank?
|
113
|
+
self.slug = title.downcase.parameterize if has_slug
|
114
|
+
end
|
119
115
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
116
|
+
def nesting_name
|
117
|
+
num_dashes = parent_pages.size
|
118
|
+
num_dashes = 0 if num_dashes < 0
|
119
|
+
"#{'-' * num_dashes} #{title}".strip
|
120
|
+
end
|
124
121
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
"#{'-' * num_dashes} #{self.title}".strip
|
129
|
-
end
|
122
|
+
def brick_list_type
|
123
|
+
'Kuhsaft::Page'
|
124
|
+
end
|
130
125
|
|
131
|
-
|
132
|
-
|
133
|
-
|
126
|
+
def to_style_class
|
127
|
+
'kuhsaft-page'
|
128
|
+
end
|
134
129
|
|
135
|
-
|
136
|
-
|
137
|
-
|
130
|
+
def allowed_brick_types
|
131
|
+
Kuhsaft::BrickType.enabled.pluck(:class_name) - ['Kuhsaft::AccordionItemBrick']
|
132
|
+
end
|
133
|
+
|
134
|
+
def cache_key
|
135
|
+
super + bricks.map(&:cache_key).join
|
136
|
+
end
|
138
137
|
|
139
|
-
|
140
|
-
|
138
|
+
def as_json(options = {})
|
139
|
+
Hash.new.tap do |json|
|
140
|
+
json['title'] = send("title_#{I18n.locale}")
|
141
|
+
json['pretty_url'] = '/' + send("url_#{I18n.locale}")
|
142
|
+
json['url'] = "/pages/#{id}"
|
143
|
+
end
|
144
|
+
end
|
141
145
|
end
|
142
146
|
end
|