File Coverage

blib/lib/RapidApp/Controller/DirectCmp.pm
Criterion Covered Total %
statement 34 51 66.6
branch n/a
condition n/a
subroutine 12 18 66.6
pod 0 5 0.0
total 46 74 62.1


line stmt bran cond sub pod time code
1             package RapidApp::Controller::DirectCmp;
2              
3 4     4   3215 use strict;
  4         11  
  4         138  
4 4     4   22 use warnings;
  4         10  
  4         133  
5              
6 4     4   21 use Moose;
  4         10  
  4         32  
7 4     4   28125 BEGIN { extends 'Catalyst::Controller'; }
8 4     4   25830 use namespace::autoclean;
  4         11  
  4         46  
9              
10 4     4   361 use RapidApp::Util qw(:all);
  4         11  
  4         2507  
11              
12 4     4 0 34 sub base :Chained :PathPrefix :CaptureArgs(0) {}
  4     0   9  
  4         39  
13              
14             # This is a special controller designed to render a single RapidApp
15             # Module in its own Viewport (i.e. in an iFrame)
16              
17             sub default :Chained('base') :PathPart('') :Args {
18 0     0 0 0 my ($self, $c, @args) = @_;
19             # Fallback to 'direct'
20 0         0 return $self->direct($c,@args);
21 4     4   5302 }
  4         11  
  4         20  
22              
23             sub direct :Chained('base') :Args {
24 0     0 0 0 my ($self, $c, @args) = @_;
25 0         0 $c->stash->{render_viewport} = 1;
26 0         0 $self->_redispatch_viewport($c,@args)
27 4     4   4033 }
  4         13  
  4         18  
28              
29             sub printview :Chained('base') :Args {
30 0     0 0 0 my ($self, $c, @args) = @_;
31 0         0 $c->stash->{render_viewport} = 'printview';
32 0         0 $self->_redispatch_viewport($c,@args)
33 4     4   4024 }
  4         10  
  4         28  
34              
35             sub navable :Chained('base') :Args {
36 0     0 0 0 my ($self, $c, @args) = @_;
37 0         0 $c->stash->{render_viewport} = 'navable';
38 0         0 $self->_redispatch_viewport($c,@args)
39 4     4   4405 }
  4         12  
  4         19  
40              
41             sub _redispatch_viewport {
42 0     0     my ($self, $c, @args) = @_;
43              
44 0           $c->stash->{config_url} = join('/','',@args);
45 0           $c->stash->{config_params} = { %{$c->req->params} };
  0            
46              
47 0           $c->req->params->{__no_hashnav_redirect} = 1;
48            
49 0           return $c->redispatch_public_path(@args);
50             }
51              
52              
53              
54              
55 4     4   4516 no Moose;
  4         12  
  4         25  
56             __PACKAGE__->meta->make_immutable;
57             1;