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