<!-- _title -->
% my $collection = ($controller eq 'stranici' && $celina->{permissions} =~ /^d/);
<section class="title<%= $collection ? ' group' : '' %>">
%= t 'h' . $level => $celina->{title} =~ s/<[^>]+>?//gr;
<%
# The content element can be displayed in two contexts.
# 1. Страница a.k.a. List context:
# if ($controller eq 'stranici' && $title->{permissions} =~ /^d/)
# This is when it is displayed as part (title) of the page.
# This context is when the url to the page only is accessed
# (e.g. http://local.слово.бг:3000/вести.html). In this context the
# content element looks if it is a directory and lists its context, if yes.
# 2. Цѣлина a.k.a Scalar context:
# This is when it is displayed as the main content of the page. In this case it
# simply shows it's body or does something intended for this context.
%>
% if ($collection) { #List
%== format_body($celina)
%# TODO: Add limit and pagination
<%
my $celini = celini->all_for_display_in_stranica(
$page, $user, language, $preview,
{
where => {
# avoid recursion
'celini.pid' => {'=' => $celina->{id}, '!=' => {-ident => 'celini.id'}},
'celini.data_type' => {'!=' => 'title'},
'celini.box' => {-in => [qw(главна main)]}}});
%>
<%==
$celini->map(sub {
my $row = shift;
return include("partials/_pisanie_otkysy", celina => $row, p => $page);
})->join($/);
%>
% } else {
%== format_body($celina)
% }
</section>
<%
%>