source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Json/List.pm @ 2333

Last change on this file since 2333 was 2333, checked in by nanardon, 4 years ago

Encode name to unicode in dns zone

File size: 897 bytes
Line 
1package LATMOS::Accounts::Web::Controller::Json::List;
2use Moose;
3use namespace::autoclean;
4
5BEGIN { extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Json::List - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19
20=head2 index
21
22=cut
23
24sub index :Path :Args(0) {
25    my ( $self, $c ) = @_;
26
27    my $base = $c->model('Accounts')->db;
28    my $otype = $c->req->param('otype') or return;
29
30    my @objects = $base->list_objects($otype);
31    if (my $term = $c->req->param('term')) {
32        @objects = grep { /\Q$term\E/i } @objects;
33    }
34
35    $c->stash->{data} = \@objects;
36    #[ map { { label => $_ } } @objects ];
37
38}
39
40
41
42=encoding utf8
43
44=head1 AUTHOR
45
46olivier
47
48=head1 LICENSE
49
50This library is free software. You can redistribute it and/or modify
51it under the same terms as Perl itself.
52
53=cut
54
55__PACKAGE__->meta->make_immutable;
56
571;
Note: See TracBrowser for help on using the repository browser.