| 1 | package Strehler::Dancer2::Plugin::EX; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | $Strehler::Dancer2::Plugin::EX::VERSION = '1.6.8'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Dancer2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Dancer2::Plugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Strehler::Helpers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | register 'slug' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my ( $dsl, $pattern, $template, $item_data, $extra_data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | my $slug_route = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my $slug = $dsl->params->{slug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my $item_type = $dsl->config->{'Strehler'}->{'default_entity'} || 'article'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
MC/DC0%0/1
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
$dsl->config->{'Strehler'}{'default_entity'}
Truth table0%0/2
A
A= $dsl->config->{'Strehler'}{'default_entity'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $language = $dsl->params->{'language'} ||$dsl->config->{'Strehler'}->{'default_language'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
MC/DC0%0/2
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
$dsl->params->{'language'}
$dsl->config->{'Strehler'}{'default_language'}
Truth table0%0/3
A || B
A= $dsl->params->{'language'}B= $dsl->config->{'Strehler'}{'default_language'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my $category = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | if($item_data && ref($item_data)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$item_data and ref $item_data
MC/DC0%0/2
$item_data and ref $item_data
$item_data
ref $item_data
Truth table0%0/3
A and B
A= $item_dataB= ref $item_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | $item_type = $item_data->{'item-type'} || $item_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'item-type'} || $item_type
MC/DC0%0/2
$item_data->{'item-type'} || $item_type
$item_data->{'item-type'}
$item_type
Truth table0%0/3
A || B
A= $item_data->{'item-type'}B= $item_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | $language = $item_data->{'language'} || $language; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'language'} || $language
MC/DC0%0/2
$item_data->{'language'} || $language
$item_data->{'language'}
$language
Truth table0%0/3
A || B
A= $item_data->{'language'}B= $language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $category = $item_data->{'category'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item_data->{'category'} || undef
MC/DC0%0/1
$item_data->{'category'} || undef
$item_data->{'category'}
Truth table0%0/2
A
A= $item_data->{'category'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $category = $item_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $template = $template || 'slug'; ## no critic qw(Variables::ProhibitReusedNames) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$template || 'slug'
MC/DC0%0/1
$template || 'slug'
$template
Truth table0%0/2
A
A= $template
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $class = Strehler::Helpers::class_from_entity($item_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $extra_data ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$extra_data ||= {}
MC/DC0%0/1
$extra_data ||= {}
$extra_data
Truth table0%0/2
A
A= $extra_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $article = $class->get_by_slug($slug, $language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if( ! $article || ! $article->exists() || ($category && $article->get_category_name() ne $category)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not $article && $article->exists or $category and $article->get_category_name ne $category
$article && $article->exists
$category and $article->get_category_name ne $category
MC/DC0%0/4
not $article && $article->exists or $category and $article->get_category_name ne $category
$article
$article->exists
$category
$article->get_category_name ne $category
Truth table0%0/5
not(A && B) or C and D
A= $articleB= $article->existsC= $categoryD= $article->get_category_name ne $category
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $dsl->send_error("Not found", 404); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my %article_data = $article->get_ext_data($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $next = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $prev = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $next_data = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $prev_data = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if($class->ordered()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $next = $article->next_in_category_by_order($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $prev = $article->prev_in_category_by_order($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | elsif($class->dated()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $next = $article->next_in_category_by_date($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $prev = $article->prev_in_category_by_date($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $next = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $prev = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | if($prev && $prev->exists()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$prev and $prev->exists
MC/DC0%0/2
$prev and $prev->exists
$prev
$prev->exists
Truth table0%0/3
A and B
A= $prevB= $prev->exists
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my %prev_data_hash = $prev->get_ext_data($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $prev_data = \%prev_data_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if($next && $next->exists()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next and $next->exists
MC/DC0%0/2
$next and $next->exists
$next
$next->exists
Truth table0%0/3
A and B
A= $nextB= $next->exists
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my %next_data_hash = $next->get_ext_data($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $next_data = \%next_data_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $dsl->template($template, { language => $language, element => \%article_data, prev => $prev_data, next => $next_data, %{$extra_data} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $dsl->any( ['get'] => $pattern, $slug_route); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | register 'list' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ( $dsl, $pattern, $template, $item_data, $extra_data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | my $list_route = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=17 SCAR=57.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my $page = $dsl->params->{'page'} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->params->{'page'} || 1
MC/DC0%0/1
$dsl->params->{'page'} || 1
$dsl->params->{'page'}
Truth table0%0/2
A
A= $dsl->params->{'page'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $template = $template || 'list'; ## no critic qw(Variables::ProhibitReusedNames) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$template || 'list'
MC/DC0%0/1
$template || 'list'
$template
Truth table0%0/2
A
A= $template
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $extra_data ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$extra_data ||= {}
MC/DC0%0/1
$extra_data ||= {}
$extra_data
Truth table0%0/2
A
A= $extra_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | my $item_type = $dsl->config->{'Strehler'}->{'default_entity'} || 'article'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
MC/DC0%0/1
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
$dsl->config->{'Strehler'}{'default_entity'}
Truth table0%0/2
A
A= $dsl->config->{'Strehler'}{'default_entity'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $language = $dsl->params->{language} || $dsl->config->{'Strehler'}->{'default_language'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
MC/DC0%0/2
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
$dsl->params->{'language'}
$dsl->config->{'Strehler'}{'default_language'}
Truth table0%0/3
A || B
A= $dsl->params->{'language'}B= $dsl->config->{'Strehler'}{'default_language'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | my $entries_per_page = $dsl->params->{'entries-per-page'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->params->{'entries-per-page'} || undef
MC/DC0%0/1
$dsl->params->{'entries-per-page'} || undef
$dsl->params->{'entries-per-page'}
Truth table0%0/2
A
A= $dsl->params->{'entries-per-page'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $category = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my $order_by = $dsl->params->{'order-by'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->params->{'order-by'} || undef
MC/DC0%0/1
$dsl->params->{'order-by'} || undef
$dsl->params->{'order-by'}
Truth table0%0/2
A
A= $dsl->params->{'order-by'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | my $order = $dsl->params->{'order'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->params->{'order'} || undef
MC/DC0%0/1
$dsl->params->{'order'} || undef
$dsl->params->{'order'}
Truth table0%0/2
A
A= $dsl->params->{'order'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if($item_data && ref($item_data)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$item_data and ref $item_data
MC/DC0%0/2
$item_data and ref $item_data
$item_data
ref $item_data
Truth table0%0/3
A and B
A= $item_dataB= ref $item_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $item_type = $item_data->{'item-type'} || $item_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'item-type'} || $item_type
MC/DC0%0/2
$item_data->{'item-type'} || $item_type
$item_data->{'item-type'}
$item_type
Truth table0%0/3
A || B
A= $item_data->{'item-type'}B= $item_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $language = $item_data->{'language'} || $language; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'language'} || $language
MC/DC0%0/2
$item_data->{'language'} || $language
$item_data->{'language'}
$language
Truth table0%0/3
A || B
A= $item_data->{'language'}B= $language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $entries_per_page = $item_data->{'entries-per-page'} || $entries_per_page; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'entries-per-page'} || $entries_per_page
MC/DC0%0/2
$item_data->{'entries-per-page'} || $entries_per_page
$item_data->{'entries-per-page'}
$entries_per_page
Truth table0%0/3
A || B
A= $item_data->{'entries-per-page'}B= $entries_per_page
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $category = $item_data->{'category'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item_data->{'category'} || undef
MC/DC0%0/1
$item_data->{'category'} || undef
$item_data->{'category'}
Truth table0%0/2
A
A= $item_data->{'category'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | $order_by = $item_data->{'order-by'} || $order_by; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item_data->{'order-by'} || $order_by
MC/DC0%0/2
$item_data->{'order-by'} || $order_by
$item_data->{'order-by'}
$order_by
Truth table0%0/3
A || B
A= $item_data->{'order-by'}B= $order_by
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $order = $item_data->{'order'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item_data->{'order'} || undef
MC/DC0%0/1
$item_data->{'order'} || undef
$item_data->{'order'}
Truth table0%0/2
A
A= $item_data->{'order'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $category = $item_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $class = Strehler::Helpers::class_from_entity($item_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my %parameters = ( page => $page, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | entries_per_page => $entries_per_page, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | category => $category, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | language => $language, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | order => $order, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | order_by => $order_by ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my %get_list_parameters = ( %parameters, ( ext => 1, published => 1 )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $elements = $class->get_list(\%get_list_parameters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my %template_parameters = ( %parameters, ( item_type => $item_type, elements => $elements->{'to_view'}, last_page => $elements->{'last_page'}), %{$extra_data}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $dsl->template( $template, \%template_parameters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $dsl->any( ['get'] => $pattern, $list_route); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub latest_elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
latest_elements: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $dsl = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $request = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $language = $dsl->params->{language} || $dsl->config->{'Strehler'}->{'default_language'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
MC/DC0%0/2
$dsl->params->{'language'} || $dsl->config->{'Strehler'}{'default_language'}
$dsl->params->{'language'}
$dsl->config->{'Strehler'}{'default_language'}
Truth table0%0/3
A || B
A= $dsl->params->{'language'}B= $dsl->config->{'Strehler'}{'default_language'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my %out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | foreach my $k (keys %{$request}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $local_language = $language; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $category = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | my $item_type = $dsl->config->{'Strehler'}->{'default_entity'} || 'article'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
MC/DC0%0/1
$dsl->config->{'Strehler'}{'default_entity'} || 'article'
$dsl->config->{'Strehler'}{'default_entity'}
Truth table0%0/2
A
A= $dsl->config->{'Strehler'}{'default_entity'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $by = 'date'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if(ref($request->{$k})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | $local_language = $request->{$k}->{'language'} || $language; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$request->{$k}{'language'} || $language
MC/DC0%0/2
$request->{$k}{'language'} || $language
$request->{$k}{'language'}
$language
Truth table0%0/3
A || B
A= $request->{$k}{'language'}B= $language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $category = $request->{$k}->{'category'} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$request->{$k}{'category'} || undef
MC/DC0%0/1
$request->{$k}{'category'} || undef
$request->{$k}{'category'}
Truth table0%0/2
A
A= $request->{$k}{'category'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $item_type = $request->{$k}->{'item-type'} || $item_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$request->{$k}{'item-type'} || $item_type
MC/DC0%0/2
$request->{$k}{'item-type'} || $item_type
$request->{$k}{'item-type'}
$item_type
Truth table0%0/3
A || B
A= $request->{$k}{'item-type'}B= $item_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $by = $request->{$k}->{'by'} || $by; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$request->{$k}{'by'} || $by
MC/DC0%0/2
$request->{$k}{'by'} || $by
$request->{$k}{'by'}
$by
Truth table0%0/3
A || B
A= $request->{$k}{'by'}B= $by
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $category = $request->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $class = Strehler::Helpers::class_from_entity($item_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $element = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if($by eq 'date') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $element = $class->get_last_by_date($category, $language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | elsif($by eq 'order') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $element = $class->get_last_by_order($category, $language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if($element) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my %element_data = $element->get_ext_data($language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $out{$k} = \%element_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $out{$k} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | return %out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | register 'latest' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $dsl = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $request = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return latest_elements($dsl, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | register 'latest_page' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my ($dsl, $pattern, $template, $request, $extra_data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $extra_data ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$extra_data ||= {}
MC/DC0%0/1
$extra_data ||= {}
$extra_data
Truth table0%0/2
A
A= $extra_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | my $latest_route = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $dsl->template( $template, {latest_elements($dsl, $request), %{$extra_data}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $dsl->any( ['get'] => $pattern, $latest_route); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | register_plugin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | Strehler::Dancer2::Plugin::EX - Plugin for easy and fast site building! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Using Strehler object to build a frontend may be a little messy because someone could need many instructions also to do simple things. EX plugin gives to the developer easy shortcuts, useful for standard scenarios, to write just elegant frontend code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Here is the route definition for Strehler Demo site, using EX plugin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | get '/' => sub {template 'home';}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | slug '/ex/slug/:slug', 'element'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | list '/ex/list/dummy', 'dummy_list', 'dummy'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | latest_page '/ex/mypage', 'mypage', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | { upper => 'upper', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | lower => 'lower' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | All the functions available to generate routes are in the form: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | keyword 'pattern/to/match', 'template', { options }, { extra_data } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | When you have to configure just the category where contenst are, you can pass it just as its name instead of options hash. All the others values will be the default ones. If you want to use as default an item_type different from article default_entity Strehler parameter will come useful to you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | extra_data is just an hash reference to any variable you want in the template. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | =head2 SLUG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | Slug keyword allows you to retrieve data from a slugged entity and pass it to a template as I<element>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | Slug must be passed as a param named slug, in any way Dancer2 accept it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | Slug keyword passes to the template also the data about the previous and the next element in category (by order or publish date) as prev and next. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | =head3 PARAMETERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | =item item-type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | The entity. It must be configured in Strehler configuration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | =item language | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | The language to use. If no language is configured plugin will try for a language entry in params. If also this solution will fail it will use the default language. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | =item category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | To restrict slugged entity retrieving just to a certain category. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | =head2 LIST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | List keyword gives you a list of entities' data in the template variable named elements. A route designed using list keyword accepts as params page and order to navigate the list. All the configuration parameter are passed to the template in template variables with the same name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | =head3 PARAMETERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | =item item-type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | The entity. It must be configured in Strehler configuration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =item language | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | The language to use. If no language is configured plugin will try for a language entry in params. If also this solution will fail it will use the default language. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | =item category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | To restrict list retrieving just to a certain category. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | =item entries-per-page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | To change the length of a page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | =item order-by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | To decide what database field to use to order elements. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | Pay attention: an ordered entity will use display_order by default, a dated (but not ordered) entity publish_date. Otherwise, id will be used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | =item order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 'asc' or 'desc' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =item extra_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | Hash reference. Any other variable you want for the template. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | =head2 LATEST_PAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | Consider a scenario where you need to update a content once in a while and you don't really need to keep an archive for it. You could always updating the same content, but why don't exploit Strehler power to have a little of version control? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Latest_page retrieve data from latest content (by publish_date or by orded) in a category and can be used to manage multiple contents. This way you can build a customized page with all the area freely editable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | =head3 PARAMETERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | Latest_page parameters are organized as a hash of hashes where every key of the primary hash is the name of the template variable where content data will be stored. Each key points to an hash of parameters for retrieving the content. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | For each elements parameters are quite the same of the previous keywords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | =item item-type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | The entity. It must be configured in Strehler configuration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | =item language | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | The language to use. If no language is configured plugin will try for a language entry in params. If also this solution will fail it will use the default language. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | =item category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | To restrict list retrieving just to a certain category. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | =item by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | It can assume values "date" or "order", it's the criteria to calculate latest article. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =head2 LATEST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | As latest_page, but returns an hash and not a route, so you can use it when calling the template in a more complex situation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | template 'the_page', { parameter => 'yadda', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | parameter2 => 'badda', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | latest { a_page => { category => 'cat1' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | another => { category => 'cat2' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||