Commit a4e6fa5ef01d1bb2003301612fb01938b24deb9b

Authored by Andrey Karpikov
1 parent 25d69c42

add support wrapper content type, change preview in page edit part

... ... @@ -347,8 +347,8 @@ module Kanjai
347 347 @main_field = []
348 348
349 349 if page_template = @page_data.page.page_template
350   - @type_contents += page_template.template_parts.where("part_type in ('content')").collect{|p| [p.name, p.code] }
351   - page_template.template_parts.where("part_type in ('content')").each do |item|
  350 + @type_contents += page_template.template_parts.where("part_type in ('content', 'wrapper')").collect{|p| [p.name, p.code] }
  351 + page_template.template_parts.where("part_type in ('content', 'wrapper')").each do |item|
352 352 item.field_options.each do |el|
353 353 @main_field << el[:name] if el[:main].to_i == 1
354 354 end
... ...
... ... @@ -69,7 +69,7 @@ module Kanjai
69 69 html_attributes['data-id'] = row['attributes']['id']
70 70 html_attributes['data-page_data_id'] = page_data.id
71 71
72   - if page_content.type_content.split('-').include?('wrapper')
  72 + if page_content.type_content.split('-').include?('wrapper') || page_content.type_content.split('_').include?('wrapper')
73 73 html += (page_content.get_simple_content).html_safe
74 74 else
75 75 cells = page_content.nil? ? '' : page_content.get_content_frontend(session)
... ... @@ -163,7 +163,8 @@ module Kanjai
163 163 end
164 164
165 165 def wrap_iframe(page_content)
166   - content = page_content.get_content_frontend
  166 + page_content.get_content
  167 +=begin
167 168 layer = page_content.page_datum.page.page_template.get_html_content
168 169
169 170 css_files = [].tap do |n|
... ... @@ -176,19 +177,14 @@ module Kanjai
176 177 end
177 178 end
178 179 styles = css_files.collect do |file|
179   - #begin
180   - "<link rel='stylesheet' href='#{file}'>"
181   - #rescue
182   -
183   - #end
  180 + "<link rel='stylesheet' href='#{file}'>"
184 181 end
185 182
186   - #css_files = css_files.collect{|link| "<link rel='stylesheet' href='#{link}' />".html_safe }.join('')
187 183 content += "#{styles.join(' ')}".html_safe
188 184
189   - #<link rel="stylesheet" href="./assets/css/libs.bundle.css" />
190 185
191 186 "<iframe width='100%' frameBorder='0' src='data:text/html;charset=utf-8,#{ERB::Util.url_encode(content)}'></iframe>"
  187 +=end
192 188 end
193 189
194 190
... ...
... ... @@ -19,6 +19,8 @@ module Kanjai
19 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 + else
  23 + return ['kanjai/admin/pages/content_types/empty_content', {}]
22 24 end
23 25 end
24 26 end
... ...
1 1 module Kanjai
2   - VERSION = "0.0.372"
  2 + VERSION = "0.0.373"
3 3 end
... ...