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