diff --git a/app/models/communication/block/template/base.rb b/app/models/communication/block/template/base.rb index 6624b56e07360292df1790e1ac3a1da152b2b18a..8c8ee497e64cf450b45288651c85c6cf3f96503d 100644 --- a/app/models/communication/block/template/base.rb +++ b/app/models/communication/block/template/base.rb @@ -99,12 +99,21 @@ class Communication::Block::Template::Base data['elements'] end + def default_layout + self.class.layouts.first + end + + def layout + data['layout'] + end + def blob_with_id(id) university.active_storage_blobs.find id end def default_data { + 'layout' => default_layout, 'elements' => [] } end diff --git a/app/models/communication/block/template/gallery.rb b/app/models/communication/block/template/gallery.rb index 9b0e2d27deac24dc45f32004782df785d102088b..38f353f754e49c083a58dcf6767be84591f34c31 100644 --- a/app/models/communication/block/template/gallery.rb +++ b/app/models/communication/block/template/gallery.rb @@ -10,10 +10,6 @@ class Communication::Block::Template::Gallery < Communication::Block::Template:: add_dependency active_storage_blobs end - def layout - data['layout'] || LAYOUTS.first - end - def images_with_alt @images_with_alt ||= elements.map { |element| extract_image_alt_and_credit element, 'file'