blob: 35885600e08b8c4131249427b2a7653a512dadcc [file] [log] [blame]
Nils Diewaldab4d3ca2015-04-17 01:48:43 +00001package Kalamar::Controller::Documentation;
2use Mojo::Base 'Mojolicious::Controller';
3
4# Show documentation page
5sub page {
6 my $c = shift;
7 if ($c->param('embedded')) {
8 $c->stash(embedded => 1);
9 };
10
Nils Diewalda31a5152015-04-17 21:05:23 +000011 $c->stash(doc_base => 'http://localhost:3000/');
12
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000013 my @path = ('doc');
14
15 # There is a scope defined
16 my $scope = $c->stash('scope');
17 push(@path, $scope) if $scope;
18
19 # Use the defined page
20 my $page = $c->stash('page');
21 push(@path, $page);
22
Nils Diewald7148c6f2015-05-04 15:07:53 +000023 # Set navigation to sidebar
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000024 $c->content_for(
25 sidebar => '<nav>' . $c->doc_navi($c->config('navi')) . '</nav>'
26 );
27
28 # Render template
29 return $c->render(
30 sidebar_active => 1,
31 main_class => 'tutorial',
32 template => join('/', @path)
33 );
34};
35
36
371;
38
39
40__END__
Nils Diewald7148c6f2015-05-04 15:07:53 +000041
42=pod
43
44=encoding utf8
45
46=head1 NAME
47
48Kalamar::Controller::Documentation
49
50
51=head1 DESCRIPTION
52
53L<Kalamar::Controller::Documentation> is the controller class for
54documentation related endpoints in Kalamar.
55
56
57=head1 METHODS
58
59L<Kalamar::Controller::Documentation> inherits all methods from
60L<Mojolicious::Controller> and implements the following new ones.
61
62=head2 page
63
64Action for all documentation pages. The following stash parameters are supported:
65
66=head3 doc_base
67
68=head3 scope
69
70=head3 page
71
72=head3 embedded
73
74=head1 COPYRIGHT AND LICENSE
75
76Copyright (C) 2015, L<IDS Mannheim|http://www.ids-mannheim.de/>
77Author: L<Nils Diewald|http://nils-diewald.de/>
78
79Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
80Corpus Analysis Platform at the Institute for German Language
81(L<IDS|http://ids-mannheim.de/>),
82funded by the
83L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>
84and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project,
85funded by the Federal Ministry of Education and Research
86(L<BMBF|http://www.bmbf.de/en/>).
87
88Kalamar is free software published under the
89L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE).
90
91=cut