blib/lib/Yukki/Web/View/Attachment.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 46 SCAR 6.9
CC
1
Cov
0%
_build_rename_template
2.0
_build_remove_template
2.0
rename
2.0
CRAP 2.0
1 package Yukki::Web::View::Attachment;
2 $Yukki::Web::View::Attachment::VERSION = '0.991_002'; # TRIAL
3  
4 $Yukki::Web::View::Attachment::VERSION = '0.991002';use v5.24;
5 use utf8;
6 use Moo;
7  
8 use Type::Utils;
9  
10 use namespace::clean;
11  
12 extends 'Yukki::Web::View';
13  
14 # ABSTRACT: View for attachment forms
15  
16  
17 has rename_template => (
18 is => 'ro',
19 isa => class_type('Template::Pure'),
20 lazy => 1,
21 builder => '_build_rename_template',
22 );
23  
24 sub _build_rename_template {
25 shift->prepare_template(
26 template => 'attachment/rename.html',
27 directives => [
28 '#yukkiname' => 'page',
29 '#yukkiname_new@value' => 'page',
30 ],
31 );
32 }
33  
34 has remove_template => (
35 is => 'ro',
36 isa => class_type('Template::Pure'),
37 lazy => 1,
38 builder => '_build_remove_template',
39 );
40  
41 sub _build_remove_template {
42 shift->prepare_template(
43 template => 'attachment/remove.html',
44 directives => [
45 '.yukkiname' => 'page',
46 '#cancel_remove@href' => 'return_link',
47 ],
48 );
49 }
50  
51  
52 sub rename {
53 my ($self, $ctx, $vars) = @_;
54 my $file = $vars->{file};
55  
56 $ctx->response->page_title($vars->{title});
57  
58 return $self->render_page(
59 template => $self->rename_template,
60 context => $ctx,
61 vars => $vars,
62 );
63 }
64  
65  
66 sub remove {
67 my ($self, $ctx, $vars) = @_;
68 my $file = $vars->{file};
69  
70 $ctx->response->page_title($vars->{title});
71  
72 return $self->render_page(
73 template => $self->remove_template,
74 context => $ctx,
75 vars => $vars,
76 );
77 }
78  
79 1;
80  
81 __END__
82  
83 =pod
84  
85 =encoding UTF-8
86  
87 =head1 NAME
88  
89 Yukki::Web::View::Attachment - View for attachment forms
90  
91 =head1 VERSION
92  
93 version 0.991_002
94  
95 =head1 DESCRIPTION
96  
97 Handles the display of attachment forms.
98  
99 =head1 METHODS
100  
101 =head2 rename
102  
103 Show the rename form for attachments.
104  
105 =head2 remove
106  
107 Show the remove form for attachmensts.
108  
109 =head1 AUTHOR
110  
111 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
112  
113 =head1 COPYRIGHT AND LICENSE
114  
115 This software is copyright (c) 2017 by Qubling Software LLC.
116  
117 This is free software; you can redistribute it and/or modify it under
118 the same terms as the Perl 5 programming language system itself.
119  
120 =cut