Commit a4e6fa5ef01d1bb2003301612fb01938b24deb9b
1 parent
25d69c42
add support wrapper content type, change preview in page edit part
Showing
5 changed files
with
10 additions
and
12 deletions
| @@ -347,8 +347,8 @@ module Kanjai | @@ -347,8 +347,8 @@ module Kanjai | ||
| 347 | @main_field = [] | 347 | @main_field = [] |
| 348 | 348 | ||
| 349 | if page_template = @page_data.page.page_template | 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 | item.field_options.each do |el| | 352 | item.field_options.each do |el| |
| 353 | @main_field << el[:name] if el[:main].to_i == 1 | 353 | @main_field << el[:name] if el[:main].to_i == 1 |
| 354 | end | 354 | end |
| @@ -69,7 +69,7 @@ module Kanjai | @@ -69,7 +69,7 @@ module Kanjai | ||
| 69 | html_attributes['data-id'] = row['attributes']['id'] | 69 | html_attributes['data-id'] = row['attributes']['id'] |
| 70 | html_attributes['data-page_data_id'] = page_data.id | 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 | html += (page_content.get_simple_content).html_safe | 73 | html += (page_content.get_simple_content).html_safe |
| 74 | else | 74 | else |
| 75 | cells = page_content.nil? ? '' : page_content.get_content_frontend(session) | 75 | cells = page_content.nil? ? '' : page_content.get_content_frontend(session) |
| @@ -163,7 +163,8 @@ module Kanjai | @@ -163,7 +163,8 @@ module Kanjai | ||
| 163 | end | 163 | end |
| 164 | 164 | ||
| 165 | def wrap_iframe(page_content) | 165 | def wrap_iframe(page_content) |
| 166 | - content = page_content.get_content_frontend | 166 | + page_content.get_content |
| 167 | +=begin | ||
| 167 | layer = page_content.page_datum.page.page_template.get_html_content | 168 | layer = page_content.page_datum.page.page_template.get_html_content |
| 168 | 169 | ||
| 169 | css_files = [].tap do |n| | 170 | css_files = [].tap do |n| |
| @@ -176,19 +177,14 @@ module Kanjai | @@ -176,19 +177,14 @@ module Kanjai | ||
| 176 | end | 177 | end |
| 177 | end | 178 | end |
| 178 | styles = css_files.collect do |file| | 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 | end | 181 | end |
| 185 | 182 | ||
| 186 | - #css_files = css_files.collect{|link| "<link rel='stylesheet' href='#{link}' />".html_safe }.join('') | ||
| 187 | content += "#{styles.join(' ')}".html_safe | 183 | content += "#{styles.join(' ')}".html_safe |
| 188 | 184 | ||
| 189 | - #<link rel="stylesheet" href="./assets/css/libs.bundle.css" /> | ||
| 190 | 185 | ||
| 191 | "<iframe width='100%' frameBorder='0' src='data:text/html;charset=utf-8,#{ERB::Util.url_encode(content)}'></iframe>" | 186 | "<iframe width='100%' frameBorder='0' src='data:text/html;charset=utf-8,#{ERB::Util.url_encode(content)}'></iframe>" |
| 187 | +=end | ||
| 192 | end | 188 | end |
| 193 | 189 | ||
| 194 | 190 |
| @@ -19,6 +19,8 @@ module Kanjai | @@ -19,6 +19,8 @@ module Kanjai | ||
| 19 | template_part = page.page_template.template_parts.find_by_code(content_type) | 19 | template_part = page.page_template.template_parts.find_by_code(content_type) |
| 20 | if (template_part.part_type == 'content') | 20 | if (template_part.part_type == 'content') |
| 21 | return ['kanjai/admin/pages/content_types/content', {template_part: template_part}] | 21 | return ['kanjai/admin/pages/content_types/content', {template_part: template_part}] |
| 22 | + else | ||
| 23 | + return ['kanjai/admin/pages/content_types/empty_content', {}] | ||
| 22 | end | 24 | end |
| 23 | end | 25 | end |
| 24 | end | 26 | end |