blob: e70d8f3a930a196708e3113a4741aef6b4e03f6d [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;
Akronccd71a42017-06-30 18:09:19 +02007
Nils Diewaldab4d3ca2015-04-17 01:48:43 +00008 if ($c->param('embedded')) {
9 $c->stash(embedded => 1);
10 };
11
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000012 my @path = ('doc');
13
14 # There is a scope defined
15 my $scope = $c->stash('scope');
16 push(@path, $scope) if $scope;
17
18 # Use the defined page
19 my $page = $c->stash('page');
20 push(@path, $page);
21
Nils Diewald7148c6f2015-05-04 15:07:53 +000022 # Set navigation to sidebar
Akrona9c8b0e2018-11-16 20:20:28 +010023 $c->content_block(
24 sidebar => {
Akrond512ea62019-10-24 15:50:04 +020025 inline => '<nav>' . $c->navigation('doc', $c->config('doc_navi')) . '</nav>'
Akrona9c8b0e2018-11-16 20:20:28 +010026 }
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000027 );
28
29 # Render template
Akron1b1a2712018-12-21 14:59:05 +010030 $c->stash(sidebar_active => 1);
Akronf7ec4442019-10-27 20:01:05 +010031 $c->stash(main_class => 'page tutorial');
Akron1b1a2712018-12-21 14:59:05 +010032 $c->stash(documentation => 1);
Akron88c26b12020-09-07 12:44:18 +020033 $c->stash('robots' => 'index,follow');
Akron1b1a2712018-12-21 14:59:05 +010034
35 return $c->render_maybe(
36 template => $c->loc('Template_' . join('_', @path), join('/', @path))
37 ) || $c->render(
38 template => $c->loc('Template_' . join('_', 'custom', @path), join('/', 'custom', @path))
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000039 );
40};
41
42
Nils Diewaldc46003b2015-05-07 15:55:35 +000043# Contact us
44sub contact {
45 my $c = shift;
Akron88c26b12020-09-07 12:44:18 +020046
47 $c->res->headers->header('X-Robots', 'noindex');
48
Nils Diewaldc46003b2015-05-07 15:55:35 +000049 $c->render(
50 template => $c->loc('contact', 'doc/contact')
51 );
52};
53
54
Nils Diewaldab4d3ca2015-04-17 01:48:43 +0000551;
56
57
58__END__
Nils Diewald7148c6f2015-05-04 15:07:53 +000059
60=pod
61
62=encoding utf8
63
64=head1 NAME
65
66Kalamar::Controller::Documentation
67
68
69=head1 DESCRIPTION
70
71L<Kalamar::Controller::Documentation> is the controller class for
72documentation related endpoints in Kalamar.
73
74
75=head1 METHODS
76
77L<Kalamar::Controller::Documentation> inherits all methods from
78L<Mojolicious::Controller> and implements the following new ones.
79
80=head2 page
81
Nils Diewald9dfe0102015-05-19 16:14:06 +000082 /doc/*scope/:page
Nils Diewald7148c6f2015-05-04 15:07:53 +000083
Nils Diewald9dfe0102015-05-19 16:14:06 +000084Action for all documentation pages.
85The following query parameters are supported:
Nils Diewald7148c6f2015-05-04 15:07:53 +000086
Nils Diewald9dfe0102015-05-19 16:14:06 +000087=over 2
Nils Diewald7148c6f2015-05-04 15:07:53 +000088
Akron456abd92015-06-02 15:07:21 +020089=item B<embedded>
Nils Diewald7148c6f2015-05-04 15:07:53 +000090
Nils Diewald9dfe0102015-05-19 16:14:06 +000091A boolean value, indicating if the documentation is embedded in the
92user interface or on a separated website.
93
94=back
95
96The following path parameters are supported:
97
98=over 2
99
100=item B<scope>
101
102A top level directory entry for documentation data (like C<KorAP> or C<Query Languages>).
103
104=item B<page>
105
106The requested page in the scope.
107
108=back
109
110
111=head2 contact
112
113Action for a contact page. Doesn't do anything more meaningful at the moment but
114will probably contain a form field for feedback in the future.
115
Nils Diewald7148c6f2015-05-04 15:07:53 +0000116
117=head1 COPYRIGHT AND LICENSE
118
Akron0d2a8432018-01-12 12:24:41 +0100119Copyright (C) 2015-2018, L<IDS Mannheim|http://www.ids-mannheim.de/>
Nils Diewald7148c6f2015-05-04 15:07:53 +0000120Author: L<Nils Diewald|http://nils-diewald.de/>
121
122Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
Akrona2d92de2019-02-27 15:51:07 +0100123Corpus Analysis Platform at the Leibniz Institute for the German Language
Nils Diewald7148c6f2015-05-04 15:07:53 +0000124(L<IDS|http://ids-mannheim.de/>),
125funded by the
hebasta21b7baf2019-12-16 10:32:43 +0100126L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de>
Nils Diewald7148c6f2015-05-04 15:07:53 +0000127and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project,
128funded by the Federal Ministry of Education and Research
129(L<BMBF|http://www.bmbf.de/en/>).
130
131Kalamar is free software published under the
Akron456abd92015-06-02 15:07:21 +0200132L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE>.
Nils Diewald7148c6f2015-05-04 15:07:53 +0000133
134=cut