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