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   2494 use strict;
  4         9  
  4         118  
4 4     4   20 use warnings;
  4         9  
  4         115  
5              
6 4     4   19 use Moose;
  4         9  
  4         27  
7 4     4   23073 BEGIN { extends 'Catalyst::Controller'; }
8 4     4   21752 use namespace::autoclean;
  4         9  
  4         37  
9              
10 4     4   344 use RapidApp::Util qw(:all);
  4         8  
  4         2097  
11              
12 4     4 0 28 sub base :Chained :PathPrefix :CaptureArgs(0) {}
  4     0   10  
  4         33  
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   4511 }
  4         8  
  4         17  
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   3511 }
  4         9  
  4         16  
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   3376 }
  4         8  
  4         18  
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   3501 }
  4         8  
  4         18  
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   3555 no Moose;
  4         9  
  4         22  
56             __PACKAGE__->meta->make_immutable;
57             1;