| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Ado::Control::Test; |
|
2
|
10
|
|
|
10
|
|
139716
|
use Mojo::Base 'Ado::Control'; |
|
|
10
|
|
|
|
|
25
|
|
|
|
10
|
|
|
|
|
73
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub authenticateduser { |
|
5
|
|
|
|
|
|
|
return $_[0]->render(text => 'hello authenticated ' |
|
6
|
|
|
|
|
|
|
. $_[0]->user->name |
|
7
|
2
|
50
|
|
2
|
1
|
27
|
. (ref($_[0]->session->{adobar_links}) eq 'ARRAY' ? ' with adobar_links' : '')); |
|
8
|
|
|
|
|
|
|
} |
|
9
|
1
|
|
|
1
|
1
|
13
|
sub mark_down { return $_[0]->render(text => $_[0]->markdown('* some text')) } |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub l10n { |
|
12
|
18
|
|
|
18
|
1
|
183
|
$_[0]->debug('already set language:' . $_[0]->language); |
|
13
|
18
|
|
|
|
|
336
|
return $_[0]->render(text => $_[0]->l('hello', $_[0]->user->name)); |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub bgl10n { |
|
17
|
3
|
|
|
3
|
1
|
34
|
$_[0]->language('bg'); |
|
18
|
3
|
|
|
|
|
17
|
$_[0]->debug('set language inside action:' . $_[0]->language); |
|
19
|
3
|
|
|
|
|
54
|
return $_[0]->render(text => $_[0]->l('hello', $_[0]->user->name)); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
*index = \&l10n; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#action to test language_menu |
|
24
|
|
|
|
|
|
|
sub language_menu { |
|
25
|
4
|
|
|
4
|
1
|
50
|
my ($c) = @_; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#small hack to use embedded template |
|
28
|
4
|
|
|
|
|
9
|
state $renderer = scalar push @{$c->app->renderer->classes}, __PACKAGE__; |
|
|
1
|
|
|
|
|
7
|
|
|
29
|
4
|
|
|
|
|
42
|
my $stash = $c->stash; |
|
30
|
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
82
|
$c->debug('$$stash{language_from}:' . $$stash{language_from}); |
|
32
|
4
|
|
33
|
|
|
155
|
$$stash{language_from} ||= $c->param('from'); |
|
33
|
4
|
|
|
|
|
948
|
$c->debug('$$stash{language_from}:' . $$stash{language_from}); |
|
34
|
4
|
|
|
|
|
118
|
return $c->render(); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Test Ado::Model::Users->by_group_name |
|
38
|
|
|
|
|
|
|
sub ingroup { |
|
39
|
2
|
|
|
2
|
1
|
18
|
my $c = shift; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#get users from group with the same name as the user login_name |
|
42
|
2
|
|
|
|
|
11
|
my @users = Ado::Model::Users->by_group_name($c->user->login_name, $c->param('offset'), |
|
43
|
|
|
|
|
|
|
$c->param('limit')); |
|
44
|
2
|
|
|
|
|
37
|
return $c->render(json => [@users]); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub guest { |
|
49
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#get users from group with the same name as the user login_name |
|
52
|
0
|
|
|
|
|
|
state $guest = Ado::Model::Users->by_login_name('guest')->data; |
|
53
|
0
|
|
|
|
|
|
return $c->render(json => $guest); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=encoding utf8 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Ado::Control::Test - a controller used for testing Ado. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
In this package we put actions which are used only for testing Ado functionality. |
|
69
|
|
|
|
|
|
|
Below is the list of defined actions. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 authenticateduser |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Used to test the L condition. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 bgl10n |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Used to test the C helper L. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 guest |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Renders the user C as JSON. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 index |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Alias for C action. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 ingroup |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Used to test the C condition and L. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 l10n |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Used to test the C controller helper L. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 language_menu |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Used to test the produced HTML by C. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 mark_down |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Used to test theC helper defined in L. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Красимир Беров (Krasimir Berov) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright 2014 Красимир Беров (Krasimir Berov). |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or |
|
113
|
|
|
|
|
|
|
modify it under the terms of the |
|
114
|
|
|
|
|
|
|
GNU Lesser General Public License v3 (LGPL-3.0). |
|
115
|
|
|
|
|
|
|
You may copy, distribute and modify the software provided that |
|
116
|
|
|
|
|
|
|
modifications are open source. However, software that includes |
|
117
|
|
|
|
|
|
|
the license may release under a different license. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
See http://opensource.org/licenses/lgpl-3.0.html for more information. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__DATA__ |