Skip to content

Commit

Permalink
[FEATURE] Col number considers amount of video items and can't be more
Browse files Browse the repository at this point in the history
  • Loading branch information
t3brightside committed Dec 15, 2021
1 parent 084dbc5 commit bc6d5f2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
15 changes: 10 additions & 5 deletions Resources/Private/Templates/Youtubevideo.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
</f:section>
<f:layout name="Default" />
<f:section name="Main">
<f:variable name="spaceWidthTotal">{data.tx_youtubevideo_colcount - 1 * settings.colspacewidth}</f:variable>
<f:variable name="itemWidth">{100 - spaceWidthTotal / data.tx_youtubevideo_colcount}</f:variable>
<f:variable name="spaceInPx">{data.tx_youtubevideo_colcount - 1 * settings.colspacewidth / 100 * settings.coverimagewidth}</f:variable>
<f:variable name="coverImageWidth">{settings.coverimagewidth - spaceInPx / data.tx_youtubevideo_colcount}</f:variable>
<f:if condition="{youtubevideos -> f:count()} < {data.tx_youtubevideo_colcount}">
<f:then><f:variable name="colCount">{youtubevideos -> f:count()}</f:variable></f:then>
<f:else><f:variable name="colCount">{data.tx_youtubevideo_colcount}</f:variable></f:else>
</f:if>

<f:variable name="spaceWidthTotal">{colCount - 1 * settings.colspacewidth}</f:variable>
<f:variable name="itemWidth">{100 - spaceWidthTotal / colCount}</f:variable>
<f:variable name="spaceInPx">{colCount - 1 * settings.colspacewidth / 100 * settings.coverimagewidth}</f:variable>
<f:variable name="coverImageWidth">{settings.coverimagewidth - spaceInPx / colCount}</f:variable>
<f:variable name="coverImageWidth_x2">{coverImageWidth * 2}</f:variable>

<f:if condition="{youtubevideos -> f:count()} > 1">
<div id="youtubevideogallery-{data.uid}" class="youtubevideogallery colcount-{data.tx_youtubevideo_colcount}">
<div id="youtubevideogallery-{data.uid}" class="youtubevideogallery colcount-{colCount}">
</f:if>
<f:for each="{youtubevideos}" as="item" iteration="iterator">
<f:render partial="Item" arguments="{_all}" />
Expand Down
20 changes: 12 additions & 8 deletions Resources/Private/Templates/YoutubevideoIframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
</f:section>
<f:layout name="Default" />
<f:section name="Main">
<f:variable name="spaceWidthTotal">{data.tx_youtubevideo_colcount - 1 * settings.colspacewidth}</f:variable>
<f:variable name="itemWidth">{100 - spaceWidthTotal / data.tx_youtubevideo_colcount}</f:variable>
<f:variable name="spaceInPx">{data.tx_youtubevideo_colcount - 1 * settings.colspacewidth / 100 * settings.coverimagewidth}</f:variable>
<f:variable name="coverImageWidth">{settings.coverimagewidth - spaceInPx / data.tx_youtubevideo_colcount}</f:variable>
<f:variable name="coverImageWidth_x2">{coverImageWidth * 2}</f:variable>
<f:if condition="{youtubevideos -> f:count()} < {data.tx_youtubevideo_colcount}">
<f:then><f:variable name="colCount">{youtubevideos -> f:count()}</f:variable></f:then>
<f:else><f:variable name="colCount">{data.tx_youtubevideo_colcount}</f:variable></f:else>
</f:if>
<f:variable name="spaceWidthTotal">{colCount - 1 * settings.colspacewidth}</f:variable>
<f:variable name="itemWidth">{100 - spaceWidthTotal / colCount}</f:variable>
<f:variable name="spaceInPx">{colCount - 1 * settings.colspacewidth / 100 * settings.coverimagewidth}</f:variable>
<f:variable name="coverImageWidth">{settings.coverimagewidth - spaceInPx / colCount}</f:variable>
<f:variable name="coverImageWidth_x2">{coverImageWidth * 2}</f:variable>

<f:if condition="{youtubevideos -> f:count()} > 1">
<div id="youtubevideogallery-{data.uid}" class="youtubevideogallery colcount-{data.tx_youtubevideo_colcount}">
</f:if>
<f:if condition="{youtubevideos -> f:count()} > 1">
<div id="youtubevideogallery-{data.uid}" class="youtubevideogallery colcount-{colCount}">
</f:if>
<f:for each="{youtubevideos}" as="item" iteration="iterator">
<f:render partial="Iframe" arguments="{_all}" />
<f:if condition="{iterator.isLast} != 1"><div class="space" style="width: {settings.colspacewidth}%; padding-bottom: {settings.colspacewidth}%;"></div></f:if>
Expand Down

0 comments on commit bc6d5f2

Please sign in to comment.