Add check for empty chan category in featured chan

This commit is contained in:
syeopite 2021-05-03 22:47:55 -07:00
parent 55762f0c2c
commit 48a518b252
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82

View file

@ -73,43 +73,43 @@
</div> </div>
</details> </details>
</div> </div>
</div>
<% end %> <% end %>
<% else %> <% else %>
<h3 class="pure-u-1"> <h3 class="pure-u-1">
<%= translate(locale, "This channel doesn't feature any other channels.")%> <%= translate(locale, "This channel doesn't feature any other channels.")%>
</h3> </h3>
<% end %> <% end %>
<!-- #<div class="channel-section pure-u-1 pure-u-md-1-4 pure-u-lg-1-6"> -->
</div> </div>
<div class="pure-g h-box"> <% if !featured_channel_categories.empty? %>
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-g h-box">
<% if previous_continuation %> <div class="pure-u-1 pure-u-lg-1-5">
<a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>?continuation=<%=HTML.escape(previous_continuation)%>&offset=<%=offset.not_nil!-1%>&title=<%=HTML.escape(title.not_nil!)%>"> <% if previous_continuation %>
<%= translate(locale, "Previous page") %> <a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>?continuation=<%=HTML.escape(previous_continuation)%>&offset=<%=offset.not_nil!-1%>&title=<%=HTML.escape(title.not_nil!)%>">
</a> <%= translate(locale, "Previous page") %>
<% elsif (offset - 1) == 0 %> </a>
<a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>"> <% elsif (offset - 1) == 0 %>
<%= translate(locale, "Previous page") %> <a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>">
</a> <%= translate(locale, "Previous page") %>
<% end %> </a>
</div> <% end %>
<div class="pure-u-1 pure-u-lg-3-5"></div> </div>
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right"> <div class="pure-u-1 pure-u-lg-3-5"></div>
<% if (next_cont_token = featured_channel_categories[0].continuation_token) %> <div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
<% additional_url_param = ""%> <% if (next_cont_token = featured_channel_categories[0].continuation_token) %>
<% if continuation %> <% additional_url_param = ""%>
<% additional_url_param = "&previous=#{HTML.escape(continuation)}"%> <% if continuation %>
<%end %> <% additional_url_param = "&previous=#{HTML.escape(continuation)}"%>
<% if !title %> <% end %>
<% title = featured_channel_categories[0].title %> <% if !title %>
<%end %> <% title = featured_channel_categories[0].title %>
<% end %>
<a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>?continuation=<%=HTML.escape(next_cont_token)%>&offset=<%=offset.not_nil!+1%>&title=<%=HTML.escape(title)%><%=additional_url_param%>">
<a href="/channel/<%=channel.ucid%>/channels/<%=category_param%>?continuation=<%=HTML.escape(next_cont_token)%>&offset=<%=offset.not_nil!+1%>&title=<%=HTML.escape(title)%><%=additional_url_param%>"> <%= translate(locale, "Next page") %>
<%= translate(locale, "Next page") %> </a>
</a> <% end %>
<% end %> </div>
</div> </div>
</div> <% end %>