Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 1 | package Kalamar::Controller::Documentation; |
| 2 | use Mojo::Base 'Mojolicious::Controller'; |
| 3 | |
| 4 | # Show documentation page |
| 5 | sub page { |
| 6 | my $c = shift; |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 7 | |
Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 8 | if ($c->param('embedded')) { |
| 9 | $c->stash(embedded => 1); |
| 10 | }; |
| 11 | |
Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 12 | 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 Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 22 | # Set navigation to sidebar |
Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 23 | $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', |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 31 | template => $c->loc('Template_' . join('_', @path), join('/', @path)) |
Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 32 | ); |
| 33 | }; |
| 34 | |
| 35 | |
Nils Diewald | c46003b | 2015-05-07 15:55:35 +0000 | [diff] [blame] | 36 | # Contact us |
| 37 | sub contact { |
| 38 | my $c = shift; |
| 39 | $c->render( |
| 40 | template => $c->loc('contact', 'doc/contact') |
| 41 | ); |
| 42 | }; |
| 43 | |
| 44 | |
Nils Diewald | ab4d3ca | 2015-04-17 01:48:43 +0000 | [diff] [blame] | 45 | 1; |
| 46 | |
| 47 | |
| 48 | __END__ |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 49 | |
| 50 | =pod |
| 51 | |
| 52 | =encoding utf8 |
| 53 | |
| 54 | =head1 NAME |
| 55 | |
| 56 | Kalamar::Controller::Documentation |
| 57 | |
| 58 | |
| 59 | =head1 DESCRIPTION |
| 60 | |
| 61 | L<Kalamar::Controller::Documentation> is the controller class for |
| 62 | documentation related endpoints in Kalamar. |
| 63 | |
| 64 | |
| 65 | =head1 METHODS |
| 66 | |
| 67 | L<Kalamar::Controller::Documentation> inherits all methods from |
| 68 | L<Mojolicious::Controller> and implements the following new ones. |
| 69 | |
| 70 | =head2 page |
| 71 | |
Nils Diewald | 9dfe010 | 2015-05-19 16:14:06 +0000 | [diff] [blame] | 72 | /doc/*scope/:page |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 73 | |
Nils Diewald | 9dfe010 | 2015-05-19 16:14:06 +0000 | [diff] [blame] | 74 | Action for all documentation pages. |
| 75 | The following query parameters are supported: |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 76 | |
Nils Diewald | 9dfe010 | 2015-05-19 16:14:06 +0000 | [diff] [blame] | 77 | =over 2 |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 78 | |
Akron | 456abd9 | 2015-06-02 15:07:21 +0200 | [diff] [blame] | 79 | =item B<embedded> |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 80 | |
Nils Diewald | 9dfe010 | 2015-05-19 16:14:06 +0000 | [diff] [blame] | 81 | A boolean value, indicating if the documentation is embedded in the |
| 82 | user interface or on a separated website. |
| 83 | |
| 84 | =back |
| 85 | |
| 86 | The following path parameters are supported: |
| 87 | |
| 88 | =over 2 |
| 89 | |
| 90 | =item B<scope> |
| 91 | |
| 92 | A top level directory entry for documentation data (like C<KorAP> or C<Query Languages>). |
| 93 | |
| 94 | =item B<page> |
| 95 | |
| 96 | The requested page in the scope. |
| 97 | |
| 98 | =back |
| 99 | |
| 100 | |
| 101 | =head2 contact |
| 102 | |
| 103 | Action for a contact page. Doesn't do anything more meaningful at the moment but |
| 104 | will probably contain a form field for feedback in the future. |
| 105 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 106 | |
| 107 | =head1 COPYRIGHT AND LICENSE |
| 108 | |
Akron | 0d2a843 | 2018-01-12 12:24:41 +0100 | [diff] [blame^] | 109 | Copyright (C) 2015-2018, L<IDS Mannheim|http://www.ids-mannheim.de/> |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 110 | Author: L<Nils Diewald|http://nils-diewald.de/> |
| 111 | |
| 112 | Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/> |
| 113 | Corpus Analysis Platform at the Institute for German Language |
| 114 | (L<IDS|http://ids-mannheim.de/>), |
| 115 | funded by the |
| 116 | L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/> |
| 117 | and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project, |
| 118 | funded by the Federal Ministry of Education and Research |
| 119 | (L<BMBF|http://www.bmbf.de/en/>). |
| 120 | |
| 121 | Kalamar is free software published under the |
Akron | 456abd9 | 2015-06-02 15:07:21 +0200 | [diff] [blame] | 122 | L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE>. |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 123 | |
| 124 | =cut |