blob: 6698f557ba71d13208be7084f8eb81f0877954a9 [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);
33
34 return $c->render_maybe(
35 template => $c->loc('Template_' . join('_', @path), join('/', @path))
36 ) || $c->render(
37 template => $c->loc('Template_' . join('_', 'custom', @path), join('/', 'custom', @path))
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000038 );
39};
40
41
Nils Diewaldc46003b2015-05-07 15:55:35 +000042# Contact us
43sub contact {
44 my $c = shift;
45 $c->render(
46 template => $c->loc('contact', 'doc/contact')
47 );
48};
49
50
Nils Diewaldab4d3ca2015-04-17 01:48:43 +0000511;
52
53
54__END__
Nils Diewald7148c6f2015-05-04 15:07:53 +000055
56=pod
57
58=encoding utf8
59
60=head1 NAME
61
62Kalamar::Controller::Documentation
63
64
65=head1 DESCRIPTION
66
67L<Kalamar::Controller::Documentation> is the controller class for
68documentation related endpoints in Kalamar.
69
70
71=head1 METHODS
72
73L<Kalamar::Controller::Documentation> inherits all methods from
74L<Mojolicious::Controller> and implements the following new ones.
75
76=head2 page
77
Nils Diewald9dfe0102015-05-19 16:14:06 +000078 /doc/*scope/:page
Nils Diewald7148c6f2015-05-04 15:07:53 +000079
Nils Diewald9dfe0102015-05-19 16:14:06 +000080Action for all documentation pages.
81The following query parameters are supported:
Nils Diewald7148c6f2015-05-04 15:07:53 +000082
Nils Diewald9dfe0102015-05-19 16:14:06 +000083=over 2
Nils Diewald7148c6f2015-05-04 15:07:53 +000084
Akron456abd92015-06-02 15:07:21 +020085=item B<embedded>
Nils Diewald7148c6f2015-05-04 15:07:53 +000086
Nils Diewald9dfe0102015-05-19 16:14:06 +000087A boolean value, indicating if the documentation is embedded in the
88user interface or on a separated website.
89
90=back
91
92The following path parameters are supported:
93
94=over 2
95
96=item B<scope>
97
98A top level directory entry for documentation data (like C<KorAP> or C<Query Languages>).
99
100=item B<page>
101
102The requested page in the scope.
103
104=back
105
106
107=head2 contact
108
109Action for a contact page. Doesn't do anything more meaningful at the moment but
110will probably contain a form field for feedback in the future.
111
Nils Diewald7148c6f2015-05-04 15:07:53 +0000112
113=head1 COPYRIGHT AND LICENSE
114
Akron0d2a8432018-01-12 12:24:41 +0100115Copyright (C) 2015-2018, L<IDS Mannheim|http://www.ids-mannheim.de/>
Nils Diewald7148c6f2015-05-04 15:07:53 +0000116Author: L<Nils Diewald|http://nils-diewald.de/>
117
118Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
Akrona2d92de2019-02-27 15:51:07 +0100119Corpus Analysis Platform at the Leibniz Institute for the German Language
Nils Diewald7148c6f2015-05-04 15:07:53 +0000120(L<IDS|http://ids-mannheim.de/>),
121funded by the
122L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>
123and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project,
124funded by the Federal Ministry of Education and Research
125(L<BMBF|http://www.bmbf.de/en/>).
126
127Kalamar is free software published under the
Akron456abd92015-06-02 15:07:21 +0200128L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE>.
Nils Diewald7148c6f2015-05-04 15:07:53 +0000129
130=cut