FB11X/Preferences/Controller/Preferences.pm

filter: Statementstmt 66.6% 4 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.0% 6 / 8 CC 1 SCAR 1.4
CC
1
Cov
67%
BEGIN
1.3
BEGIN
1.0
CRAP 1.1
« FB11X/Model/PreferencesDB.pm ↑ Summary FB11X/Preferences/Role/ParameterValueEditing.pm »
1 package OpusVL::FB11X::Preferences::Controller::Preferences;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶use OpusVL::FB11::Hive;
Subroutine BEGIN: called CC=1 SCAR=2.6
5 use namespace::autoclean;
6 use v5.24;
7  
8 BEGIN { extends 'Catalyst::Controller::HTML::FormFu'; };
9 with 'OpusVL::FB11::RolesFor::Controller::UI',
10 'OpusVL::FB11::FormFu::RoleFor::Controller',
11 'OpusVL::FB11X::Preferences::Role::PreferencesController';
12  
13 has resultset => (is => 'ro', isa => 'Str', default => 'User');
14  
15 __PACKAGE__->config
16 (
17 fb11_name => 'Admin',
18 # As far as I can tell this is only needed by deprecated stuff
19 # coughformfucough so we don't have to be accurate about it
20 fb11_myclass => 'OpusVL::FB11X::Preferences',
21 fb11_method_group => 'System',
22 fb11_method_group_order => 2,
23 fb11_shared_module => 'Admin',
24 );
25  
26 sub auto
27 : Action
28 {
29 my ($self, $c) =@_;
30 my $index_url = $c->uri_for($self->action_for('index'));
31 $c->stash->{index_url} = $index_url;
32 $self->add_breadcrumb($c, { name => 'Preferences', url => $index_url });
33 }
34  
35 sub index
36 : Path
37 : Args(0)
38 : NavigationName('Object Parameters')
39 : FB11Feature('Preferences')
40 {
41 my ($self, $c) = @_;
42  
43 $c->stash->{classes}->@* = OpusVL::FB11::Hive
44 ->fancy_hat('preferences')
45 ->classes_with_preferences
46 ;
47  
48 $c->stash->{template} = 'preferences/pick_object.tt';
49 }
50  
51 sub _result_class
52 : Chained('/')
53 : PathPart('preferences')
54 : CaptureArgs(1)
55 : FB11Feature('Preferences')
56 {
57 my ($self, $c, $class) = @_;
58 my $hat = OpusVL::FB11::Hive->fancy_hat('preferences');
59  
60 if (! $hat->class_has_preferences($class)) {
61 $c->detach('/not_found');
62 }
63  
64 my $index_url = $c->uri_for($self->action_for('list'), [ $class ]);
65 $c->stash->{index_url} = $index_url;
66  
67 $c->stash->{preferences_resultset} = $class;
68 }
69  
70 sub list
71 : Chained('_result_class')
72 : PathPart
73 : Args(0)
74 : FB11Feature('Preferences')
75 {
76 my ($self, $c) = @_;
77 $self->index_preferences($c);
78 $c->stash->{template} = 'preferences/index.tt';
79 }
80  
81 sub add
82 : Chained('_result_class')
83 : PathPart('add')
84 : Args(0)
85 : FB11Feature('Preferences')
86 : FB11Form
87 {
88 my ($self, $c) = @_;
89  
90 $self->add_prefences($c);
91 }
92  
93 sub preference_chain
94 : Chained('_result_class')
95 : CaptureArgs(1)
96 : FB11Feature('Preferences')
97 : PathPart('preferences')
98 {
99 my ($self, $c, $id) = @_;
100 $self->do_preference_chain($c, $id);
101 }
102  
103 sub edit
104 : Chained('preference_chain')
105 : Args(0)
106 : FB11Feature('Preferences')
107 : FB11Form('preferences/add.yml')
108 : PathPart('edit')
109 {
110 my ($self, $c) = @_;
111 $self->edit_prefences($c);
112 }
113  
114 sub values
115 : Chained('preference_chain')
116 : Args(0)
117 : FB11Feature('Preferences')
118 : FB11Form
119 : PathPart('values')
120 {
121 my ($self, $c) = @_;
122 $self->prefence_values($c);
123 }
124  
125 1;
126  
127  
128 =head1 NAME
129  
130 OpusVL::FB11X::TokenProcessor::Admin::Controller::Users::Preferences
131  
132 =head1 DESCRIPTION
133  
134 =head1 METHODS
135  
136 =head2 auto
137  
138 =head2 index
139  
140 =head2 add
141  
142 =head2 preference_chain
143  
144 =head2 edit
145  
146 =head2 values
147  
148 =head1 ATTRIBUTES
149  
150 =head2 resultset
151  
152  
153 =head1 LICENSE AND COPYRIGHT
154  
155 Copyright 2012 OpusVL.
156  
157 This software is licensed according to the "IP Assignment Schedule" provided with the development project.
158  
159 =cut
« FB11X/Model/PreferencesDB.pm ↑ Summary FB11X/Preferences/Role/ParameterValueEditing.pm »