diff --git a/app/models/communication/block/template/base.rb b/app/models/communication/block/template/base.rb index f061e4b368ac0e437a787fde3d6feea27a063cf4..4d869b18414703e7e7ed78148947cfba38437744 100644 --- a/app/models/communication/block/template/base.rb +++ b/app/models/communication/block/template/base.rb @@ -107,7 +107,7 @@ class Communication::Block::Template::Base end def default_layout - self.class.layouts.first + self.class.layouts&.first end def layout diff --git a/app/views/admin/communication/blocks/components/string/_edit.html.erb b/app/views/admin/communication/blocks/components/string/_edit.html.erb index 9868c058b0b4e5754df0195916d7e233b1538756..bd975931e8e4be7bf4726676deab08e5f48162e6 100644 --- a/app/views/admin/communication/blocks/components/string/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/string/_edit.html.erb @@ -1,10 +1,16 @@ +<% +template_kind = @block.template_kind +namespace = "admin.communication.blocks.templates.#{template_kind}.edit.#{property}" +label ||= t "#{namespace}.label" +placeholder ||= t "#{namespace}.placeholder" +%> <label class="form-label" for="<%= property %>"> - <%= t "admin.communication.blocks.templates.#{@block.template_kind}.edit.#{property}.label" %> + <%= label%> </label> <div class="mb-3"> <input id="<%= property %>" class="form-control mb-3" v-model="data.<%= property %>" - placeholder="<%= t "admin.communication.blocks.templates.#{@block.template_kind}.edit.#{property}.placeholder" %>" + placeholder="<%= placeholder %>" type="text" /> </div>