diff --git a/app/helpers/admin/blocks_helper.rb b/app/helpers/admin/blocks_helper.rb index 354b7d7424a429d260fe4832a3d022b1897964f9..b553623fe1b33de808ff1bff57d202cf9927fb6c 100644 --- a/app/helpers/admin/blocks_helper.rb +++ b/app/helpers/admin/blocks_helper.rb @@ -5,7 +5,9 @@ module Admin::BlocksHelper end def block_component_preview(property, **options) - block_component_render :preview, property, **options + render "admin/communication/blocks/components/preview", + property: property, + **options end def block_component_static(property, **options) diff --git a/app/views/admin/communication/blocks/components/_preview.html.erb b/app/views/admin/communication/blocks/components/_preview.html.erb index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..17720e3b4f93b0a0f21afd1b25f6f8b9739aff29 100644 --- a/app/views/admin/communication/blocks/components/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/_preview.html.erb @@ -0,0 +1,10 @@ +<% +template ||= @block.template +component = template.public_send "#{property}_component" +value = template.public_send(property).to_s +local_assigns[:template] = template +local_assigns[:component] = component +local_assigns[:value] = value +partial = "admin/communication/blocks/components/#{component.kind}/preview" +%> +<%= render partial, **local_assigns %> diff --git a/app/views/admin/communication/blocks/components/image/_preview.html.erb b/app/views/admin/communication/blocks/components/image/_preview.html.erb index 86c97ebd9eef623f8bc5f3f7c8eceb3f7c3362de..e9a76da247a45cc248f8256cd092b52ae10a519a 100644 --- a/app/views/admin/communication/blocks/components/image/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/image/_preview.html.erb @@ -1,6 +1,5 @@ <% -image = template.public_send "#{property}_component" +blob = component.blob +return unless blob %> -<%= kamifusen_tag image.blob, - width: 400, - class: 'img-fluid' if image.blob %> +<%= kamifusen_tag blob, width: 600, class: 'img-fluid' %> diff --git a/app/views/admin/communication/blocks/components/layout/_static.html.erb b/app/views/admin/communication/blocks/components/layout/_static.html.erb index 2d29f732a5b8526052f7e06b2bc086403bf047af..ee75aafce21c0413fab0b18749ec0b6b3e00330f 100644 --- a/app/views/admin/communication/blocks/components/layout/_static.html.erb +++ b/app/views/admin/communication/blocks/components/layout/_static.html.erb @@ -1 +1 @@ - layout: <%= template.layout %> +<%= indentation %>layout: <%= template.layout %> diff --git a/app/views/admin/communication/blocks/components/rich_text/_preview.html.erb b/app/views/admin/communication/blocks/components/rich_text/_preview.html.erb index 0a579ffcd24b081a7fd901193d04ef34b83ed5e1..c3042cff636692d6a07ac30c4e82ea8b28cba5a0 100644 --- a/app/views/admin/communication/blocks/components/rich_text/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/rich_text/_preview.html.erb @@ -1,2 +1 @@ -<% value = template.public_send(property).to_s %> <%= value.html_safe %> diff --git a/app/views/admin/communication/blocks/components/string/_preview.html.erb b/app/views/admin/communication/blocks/components/string/_preview.html.erb index 5411e2b13714e9fe5f47d5e04c5e2de29d6d5912..39fbb33ec823c262796bee0ab0836f7aae6567e3 100644 --- a/app/views/admin/communication/blocks/components/string/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/string/_preview.html.erb @@ -1 +1 @@ -<%= template.public_send(property).to_s %> +<%= value %> diff --git a/app/views/admin/communication/blocks/components/text/_preview.html.erb b/app/views/admin/communication/blocks/components/text/_preview.html.erb index 5591ba8da384d3faa56053d9246324f3dc155d01..b8c9c330c537f5928d296e26c0093e1da1d3eca6 100644 --- a/app/views/admin/communication/blocks/components/text/_preview.html.erb +++ b/app/views/admin/communication/blocks/components/text/_preview.html.erb @@ -1 +1 @@ -<%= simple_format template.public_send(property).to_s %> +<%= simple_format value %>