|
...
|
...
|
@@ -9,14 +9,14 @@ module Kanjai |
|
9
|
9
|
has_many :page_content_markers, dependent: :destroy
|
|
10
|
10
|
accepts_nested_attributes_for :page_content_markers
|
|
11
|
11
|
|
|
12
|
|
- def self.edit_template(content_type)
|
|
|
12
|
+ def self.edit_template(page, content_type)
|
|
13
|
13
|
case content_type
|
|
14
|
14
|
when 'rte_editor'
|
|
15
|
15
|
return ['kanjai/admin/pages/content_types/rte_editor', {}]
|
|
16
|
16
|
when 'plugin'
|
|
17
|
17
|
return ['kanjai/admin/pages/content_types/plugin', {}]
|
|
18
|
18
|
else
|
|
19
|
|
- template_part = TemplatePart.find_by_code(content_type)
|
|
|
19
|
+ template_part = page.page_template.template_parts.find_by_code(content_type)
|
|
20
|
20
|
if (template_part.part_type == 'content')
|
|
21
|
21
|
return ['kanjai/admin/pages/content_types/content', {template_part: template_part}]
|
|
22
|
22
|
end
|
|
...
|
...
|
@@ -35,7 +35,7 @@ module Kanjai |
|
35
|
35
|
|
|
36
|
36
|
page_template = self.page.page_template
|
|
37
|
37
|
if page_template
|
|
38
|
|
- subpart = TemplatePart.find_by_code(type_content)
|
|
|
38
|
+ subpart = page_template.template_parts.find_by_code(type_content)
|
|
39
|
39
|
if subpart
|
|
40
|
40
|
#find repeat block
|
|
41
|
41
|
repeat_element = subpart.field_options.select{|item| item[:name] == 'repeat' }.first
|
|
...
|
...
|
@@ -85,7 +85,7 @@ module Kanjai |
|
85
|
85
|
if type_content != 'rte_editor'
|
|
86
|
86
|
page_template = self.page.page_template
|
|
87
|
87
|
if page_template
|
|
88
|
|
- subpart = TemplatePart.find_by_code(type_content)
|
|
|
88
|
+ subpart = page_template.template_parts.find_by_code(type_content)
|
|
89
|
89
|
if subpart
|
|
90
|
90
|
#find current max row_item
|
|
91
|
91
|
row_item = self.page_content_markers.collect(&:row_item).max
|
|
...
|
...
|
@@ -143,7 +143,7 @@ module Kanjai |
|
143
|
143
|
self.controller_name.constantize.render self.action_name.to_sym, assigns: hash
|
|
144
|
144
|
else
|
|
145
|
145
|
page_template = self.page.page_template
|
|
146
|
|
- subpart = TemplatePart.find_by_code(self.type_content)
|
|
|
146
|
+ subpart = page_template.template_parts.find_by_code(self.type_content)
|
|
147
|
147
|
if subpart
|
|
148
|
148
|
html = Kanjai::TemplateGenerator.subpart_generate(page_template, 'content', subpart.elements, self.marker_hash, self.id)
|
|
149
|
149
|
else
|
|
...
|
...
|
@@ -154,7 +154,7 @@ module Kanjai |
|
154
|
154
|
end
|
|
155
|
155
|
|
|
156
|
156
|
def get_simple_content
|
|
157
|
|
- subpart = TemplatePart.find_by_code(self.type_content)
|
|
|
157
|
+ subpart = page.page_template.template_parts.find_by_code(self.type_content)
|
|
158
|
158
|
subpart.source
|
|
159
|
159
|
end
|
|
160
|
160
|
|
...
|
...
|
|