lib/Strehler/FormFu/Element/PublishDate.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
__ANON__
1.0
CRAP 1.0
« lib/Strehler/FormFu/Element/DisplayOrder.pm ↑ Summary lib/Strehler/FormFu/Element/Slug.pm »
1 package Strehler::FormFu::Element::PublishDate;
2 4 $Strehler::FormFu::Element::PublishDate::VERSION = '1.6.8';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 extends 'HTML::FormFu::Element::Text';
7  
8 14 ▶after BUILD => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
9 14 my $self = shift;
10 14 $self->name("publish_date");
11 14 $self->label("Date");
12 14 $self->id("date_of_pub");
13 14 $self->inflator({ type => "DateTime", parser => { strptime => "%d/%m/%Y"}});
14 14 $self->deflator({ type => "Strftime", strftime => "%d/%m/%Y"});
15 14 return;
16 4 };
17  
18 =encoding utf8
19  
20 =head1 NAME
21  
22 Strehler::FormFu::Element::PublishDate - FormFu Element for Strehler publish date field.
23  
24 =head1 DESCRIPTION
25  
26 A FormFu element to encapsulate all the frontend logic for publish date field. It's just a text element with html attributes, inflator and deflator hard-coded in it.
27 Publish date field needs to be identified in a clear way and needs a fixed structure because it has to interact with bootstrap datepicker.
28  
29 This element hasn't the standard HTML::FormFu elements namespace because it makes sense only in a Strehler system.
30  
31 =head1 SYNOPSIS
32  
33 In article form:
34  
35 - type: "+Strehler::FormFu::Element::PublishDate"
36  
37 No parameters, no labels.
38  
39 =head1 GENERATED HTML
40  
41 <div>
42 <label for="date_of_pub">Date</label>
43 <input type="text" id="date_of_pub" name="publish_date">
44 </div>
45  
46 =head1 YAML CONFIGURATION
47  
48 - id: date_of_pub
49 name: publish_date
50 label: Date
51 inflators:
52 - type: DateTime
53 parser:
54 strptime: "%d/%m/%Y"
55 deflator:
56 - type: Strftime
57 strftime: "%d/%m/%Y"
58  
59 =cut
60  
61  
62  
63 4 1;
« lib/Strehler/FormFu/Element/DisplayOrder.pm ↑ Summary lib/Strehler/FormFu/Element/Slug.pm »