Update to API v0.1
diff --git a/lib/Korap.pm b/lib/Korap.pm
index 04f0014..f0115ae 100644
--- a/lib/Korap.pm
+++ b/lib/Korap.pm
@@ -1,12 +1,17 @@
package Korap;
use Mojo::Base 'Mojolicious';
-our $VERSION = '0.03';
+our $VERSION = '0.04';
+
+# Start dev with
+# morbo -w lib -w templates -w public/sass -w public/js script/korap
# Start the application and register all routes and plugins
sub startup {
my $self = shift;
+ $self->defaults(layout => 'default');
+
# Set secret for signed cookies
$self->secrets(['fmhsfjgfchgsdbfgshfxztsbt32477eb45veu4vubrghfgghbtv']);
@@ -21,20 +26,41 @@
Number::Commify
KorapSearch
KorapInfo
- KorapTagHelpers/) {
- # AssetPack
+ KorapTagHelpers
+ /) {
$self->plugin($_);
};
-# $self->asset(
-# 'korap.css' => (
-# 'style.css',
-# 'sass/hint.scss',
-# 'table.css',
-# 'sass/kwic-4.0.scss',
-# 'fontawesome/font-awesome.min.css'
-# )
-# );
+ $self->plugin(AssetPack => {
+ minify => 1
+ });
+
+ $self->plugin('AssetPack::LibSass');
+
+ $self->asset(
+ 'korap.css' => (
+ '/sass/style.scss',
+ '/sass/sidebar.scss',
+ '/sass/tutorial.scss',
+ '/sass/hint.scss',
+ '/sass/query.scss',
+ '/sass/table.scss',
+ '/sass/pagination.scss',
+ '/sass/kwic-4.0.scss',
+ '/css/media.css',
+ '/css/font-awesome.min.css',
+ '/css/highlight.css'
+ )
+ );
+
+ $self->asset(
+ 'korap.js' => (
+ '/js/jquery-2.0.0.min.js',
+ '/js/translateTable.js',
+ '/js/hint.js',
+ '/js/highlight.pack.js'
+ )
+ );
$self->helper(
date_format => sub {
@@ -54,20 +80,30 @@
->to('tutorial#page')->name('tutorial');
# Collection data
- my $collection = $r->route('/collection');
- $collection->to('search#info');
- $collection->search;
+ my $collection = $r->bridge('/collection');
+ $collection->to('info#about_collection');
+ my $collection_id = $collection->bridge('/:collection_id');
+ # stats
+ # $collection_id->;
+ $collection_id->search;
# Corpus data
- my $corpus = $r->route('/corpus');
- $corpus->search;
- $corpus->route('/:corpus_id')->search;
- $corpus->route('/:corpus_id/#doc_id')->search;
- $corpus->route('/:corpus_id/#doc_id/:match_id')
- ->to('info#about_match')->name('match');
+ my $corpus_res = $r->route('/corpus');
+ my $corpus = $corpus_res->route('/:corpus_id');
+ # Todo: Stats
+ $corpus->search->name('search_corpus');
+ my $doc = $corpus->route('/#doc_id');
+ $doc->search->name('search_document');
+
+ # Match data
+ my $match = $doc->route('/:match_id');
+ $match->route->to('info#about_match')->name('match');
+ my $match_layer = $match->route('/:layer');
+ $match_layer->route->to('info#about_match');
+ $match_layer->route('/:foundry')->to('info#about_match');
# Utilities
- $r->get('/util/query')->to('search#query');
+ # $r->get('/util/query')->to('search#query');
};