<% ref $section ? $section->name : 'Новости' %>
% foreach my $doc (@news) { % my $href = $profile->media ? $state->{media}->site_prefix.$doc->get_path : 'news.html?id='.$doc->id; % my $target = $href =~ /^http:/ ? ' target="_blank"' : ''; % my $date = Contenido::DateTime::new ( postgres => $doc->dtime );
<% $date->dmy('.') %>
><% $doc->name %>
% } <%args> $n => undef <%init> my $prj = $request->{project}; my $profile = $request->{project_profile}; my $root = $request->{project_section}; $n = $n || $profile->newsblock_count || 5; my @news; my $section; if ( $profile->media ) { my @aliases = split ( /\ +/, $profile->media ); my @sect_ids; foreach my $alias ( @aliases ) { my $sect = $keeper->{media}->get_rubric($alias); push @sect_ids, $sect->id if ref $sect; @news = $keeper->{media}->get_documents ( s => \@sect_ids, class => 'media::News', status => [5,8], limit => $n, order => [qw|date direct|], light => 1, ); } }else{ ($section) = $keeper->get_sections ( s => $root->id, class => 'promosuite::NewsSection', status => 1, limit => 1, ); return unless ref $section; @news = $keeper->get_documents ( s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => 2, limit => $n, order => [qw|date direct|], light => 1, ); } # return unless @news;