Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
hi,

i was wondering if anyone has a solution for having a repeatable region with different content types.

i would like to create a gallery that has 3 different images sizes and also videos. my initial attempt was to use an editable file region that also has a dropdown for the selection of the data type. but doing this would mean that i would loose image cropping etc.

any ideas would be very welcomed.
well, i was hoping that someone in the community had an idea to this problem. i implemented it by just adding all editable fields that i needed in an editable region. it was not the most elegant method, but it allowed me to have the regions sortable.

see attached image.

if anyone has a more elegant solution i would appropriate the feedback.

Attachments

Hi @cmdillon,

Apologies your post went unanswered - I seem to have missed seeing it.

Anyway, the solution you have devised seems to be the best we can do with the current constraints of repeatable-regions.

I have a new kind of editable-region, one that allows each row to have a different set of editable regions, on the cards for quite some time. The awaited transition to the new admin-panel has held me back from getting it done. That would have been the perfect answer to your problem.
wow! that sounds awesome! hope it will be ready soon. it really is missing. it would be a great solution for the nested editable region problem. also it would allow for repositories of mixed item types.
KK wrote: Hi @cmdillon,

Apologies your post went unanswered - I seem to have missed seeing it.

Anyway, the solution you have devised seems to be the best we can do with the current constraints of repeatable-regions.

I have a new kind of editable-region, one that allows each row to have a different set of editable regions, on the cards for quite some time. The awaited transition to the new admin-panel has held me back from getting it done. That would have been the perfect answer to your problem.


hi kk,

i was wondering if there is any news about the status of the "new editable-region" region that you mentioned?
Hi cmdillon,

I'm sorry but no progress on that front.
I'm tied up at the moment in trying to push the new version of Couch out of the doors.
Once that happens, this type of editable-region (and one more feature that has been long on my mind) will be top priority.
Why "region that also has a dropdown for the selection of the data type." didn't work?

It should be something like:

Editable 1: Link (either img full link or video slug*)
Editable 2: Data type (Image small, Image medium, Image big, video)

On the front end use:

Code: Select all
<cms:show_repeatable blablabla>
   <cms:if data_type='Image small'>
      <img src="<cms:show link/>" width="200" height="200" style="object-fit: cover"/>
   <cms:else_if data_type='Image medium'/>
      <img src="<cms:show link/>" width="400" height="400" style="object-fit: cover"/>
   <cms:else_if data_type='Image big'/>
      <img src="<cms:show link/>" width="800" height="600" style="object-fit: cover"/>
   <cms:else_if data_type='Video'/>
      <a href="http://youtube.com/embed/<cms:show link/>?enablejsapi=1&wmode=opaque">
      <img style="float:right;" src="http://img.youtube.com/vi/<cms:show link/>/0.jpg" alt="Watch Video" width="320" height="240" title="Watch Video"/></a>
   </cms:if>
</cms:show_repeatable>


This should render the images in the appropiate size and crop the excess (the trick is in the "object-fit: cover".

*: I use only the youtube slug (the code that goes after "watch?v=") so i can link the video and also use the default thumbnail that youtube provides.
7 posts Page 1 of 1