blob: 5c8124a11771082033af12fbfd8a132ab74c96ee [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
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000023 $c->content_for(
24 sidebar => '<nav>' . $c->doc_navi($c->config('navi')) . '</nav>'
25 );
26
27 # Render template
28 return $c->render(
29 sidebar_active => 1,
30 main_class => 'tutorial',
Akronccd71a42017-06-30 18:09:19 +020031 template => $c->loc('Template_' . join('_', @path), join('/', @path))
Nils Diewaldab4d3ca2015-04-17 01:48:43 +000032 );
33};
34
35
Nils Diewaldc46003b2015-05-07 15:55:35 +000036# Contact us
37sub contact {
38 my $c = shift;
39 $c->render(
40 template => $c->loc('contact', 'doc/contact')
41 );
42};
43
44
Nils Diewaldab4d3ca2015-04-17 01:48:43 +0000451;
46
47
48__END__
Nils Diewald7148c6f2015-05-04 15:07:53 +000049
50=pod
51
52=encoding utf8
53
54=head1 NAME
55
56Kalamar::Controller::Documentation
57
58
59=head1 DESCRIPTION
60
61L<Kalamar::Controller::Documentation> is the controller class for
62documentation related endpoints in Kalamar.
63
64
65=head1 METHODS
66
67L<Kalamar::Controller::Documentation> inherits all methods from
68L<Mojolicious::Controller> and implements the following new ones.
69
70=head2 page
71
Nils Diewald9dfe0102015-05-19 16:14:06 +000072 /doc/*scope/:page
Nils Diewald7148c6f2015-05-04 15:07:53 +000073
Nils Diewald9dfe0102015-05-19 16:14:06 +000074Action for all documentation pages.
75The following query parameters are supported:
Nils Diewald7148c6f2015-05-04 15:07:53 +000076
Nils Diewald9dfe0102015-05-19 16:14:06 +000077=over 2
Nils Diewald7148c6f2015-05-04 15:07:53 +000078
Akron456abd92015-06-02 15:07:21 +020079=item B<embedded>
Nils Diewald7148c6f2015-05-04 15:07:53 +000080
Nils Diewald9dfe0102015-05-19 16:14:06 +000081A boolean value, indicating if the documentation is embedded in the
82user interface or on a separated website.
83
84=back
85
86The following path parameters are supported:
87
88=over 2
89
90=item B<scope>
91
92A top level directory entry for documentation data (like C<KorAP> or C<Query Languages>).
93
94=item B<page>
95
96The requested page in the scope.
97
98=back
99
100
101=head2 contact
102
103Action for a contact page. Doesn't do anything more meaningful at the moment but
104will probably contain a form field for feedback in the future.
105
Nils Diewald7148c6f2015-05-04 15:07:53 +0000106
107=head1 COPYRIGHT AND LICENSE
108
Akron0d2a8432018-01-12 12:24:41 +0100109Copyright (C) 2015-2018, L<IDS Mannheim|http://www.ids-mannheim.de/>
Nils Diewald7148c6f2015-05-04 15:07:53 +0000110Author: L<Nils Diewald|http://nils-diewald.de/>
111
112Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
113Corpus Analysis Platform at the Institute for German Language
114(L<IDS|http://ids-mannheim.de/>),
115funded by the
116L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>
117and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project,
118funded by the Federal Ministry of Education and Research
119(L<BMBF|http://www.bmbf.de/en/>).
120
121Kalamar is free software published under the
Akron456abd92015-06-02 15:07:21 +0200122L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE>.
Nils Diewald7148c6f2015-05-04 15:07:53 +0000123
124=cut