blob: 2af32a28a65c281c1a9beb369dec0eda814482b4 [file] [log] [blame]
Nils Diewald5d1ffb42014-05-21 17:45:34 +00001<!DOCTYPE html>
2<html>
3 <head>
4 <title><%= title %></title>
5%= stylesheet '/style.css'
Nils Diewald1eba6572014-06-17 19:49:53 +00006%= stylesheet '/table.css'
Nils Diewald33e15552014-06-13 19:38:37 +00007%= stylesheet '/kwic-4.0.css'
Nils Diewald02df9912014-06-03 16:08:07 +00008%= stylesheet '/fontawesome/font-awesome.min.css'
Nils Diewald5d1ffb42014-05-21 17:45:34 +00009%= javascript '/jquery-2.0.0.min.js'
Nils Diewald1eba6572014-06-17 19:49:53 +000010%= javascript '/translateTable.js'
Nils Diewald02df9912014-06-03 16:08:07 +000011<meta charset="utf-8" />
Nils Diewald5d1ffb42014-05-21 17:45:34 +000012 </head>
13 <body>
Nils Diewald2329e1d2014-06-12 16:07:57 +000014
Nils Diewaldb22abdf2014-06-18 22:57:50 +000015% unless (current_route 'tutorial') {
Nils Diewald2329e1d2014-06-12 16:07:57 +000016<div id="tutorial" style="display: none">
Nils Diewaldb22abdf2014-06-18 22:57:50 +000017 % my $tut_page = url_for(session('tutorial') || 'tutorial');
18 <a href="<%= $tut_page %>" target="_blank"><i title="Open in new tab" class="fa fa-external-link-square"></i></a>
19 <i onclick="closeTutorial()" title="close" class="fa fa-toggle-up"></i>
20 <iframe src="about:blank" data-src="<%= $tut_page->query([snippet => 1]) %>"></iframe>
Nils Diewald2329e1d2014-06-12 16:07:57 +000021</div>
Nils Diewaldb22abdf2014-06-18 22:57:50 +000022% };
Nils Diewald33e15552014-06-13 19:38:37 +000023
Nils Diewald02df9912014-06-03 16:08:07 +000024<div id="top">
Nils Diewaldb22abdf2014-06-18 22:57:50 +000025 <a href="<%= url_for 'index' %>"><h1><span>KorAP- Korpusanalyseplattform der nächsten Generation</span></h1></a>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000026%= form_for url_for() => begin
Nils Diewald2329e1d2014-06-12 16:07:57 +000027%= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field'
Nils Diewald02df9912014-06-03 16:08:07 +000028<br />
Nils Diewald2329e1d2014-06-12 16:07:57 +000029%= search_field 'q', id => 'q-field'
Nils Diewald02df9912014-06-03 16:08:07 +000030<button type="submit" name="action" value="ok"><i class="fa fa-search"></i></button>
31<button type="submit" name="action" value="inspect"><i class="fa fa-code"></i></button>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000032% end
Nils Diewald02df9912014-06-03 16:08:07 +000033
Nils Diewald02df9912014-06-03 16:08:07 +000034<div id="button-right">
Nils Diewald2329e1d2014-06-12 16:07:57 +000035% if (param('q')) {
Nils Diewald02df9912014-06-03 16:08:07 +000036<button type="button" onclick="$('#search > ol').toggleClass('left-aligned right-aligned'); $(this).children('i').toggleClass('fa-align-right fa-align-left')"><i class="fa fa-align-right"></i></button>
Nils Diewald02df9912014-06-03 16:08:07 +000037% }
Nils Diewaldb22abdf2014-06-18 22:57:50 +000038% unless (current_route 'tutorial') {
Nils Diewald2329e1d2014-06-12 16:07:57 +000039<button type="button" onclick="openTutorial()"><i class="fa fa-graduation-cap"></i></button>
Nils Diewaldb22abdf2014-06-18 22:57:50 +000040% };
Nils Diewald2329e1d2014-06-12 16:07:57 +000041</div>
Nils Diewald02df9912014-06-03 16:08:07 +000042
43</div>
44
45<div id="sidebar" style="padding-top: 90px">
Nils Diewald2329e1d2014-06-12 16:07:57 +000046%= include 'collections'
Nils Diewald02df9912014-06-03 16:08:07 +000047</div>
48
49<div id="search">
Nils Diewald5d1ffb42014-05-21 17:45:34 +000050%= content
Nils Diewald02df9912014-06-03 16:08:07 +000051</div>
52
53%= javascript begin
Nils Diewald2329e1d2014-06-12 16:07:57 +000054
55$("ol > li:not(.active)").on("click", function () {
56 $(this).addClass('active');
57});
58
59function closeSnippet (o) {
60 $(o.parentNode.parentNode).removeClass('active');
61};
62
Nils Diewald33e15552014-06-13 19:38:37 +000063function showTable (o) {
64 var match = o.parentNode.parentNode;
Nils Diewald1eba6572014-06-17 19:49:53 +000065 var table = $(match).children("div").children("div.tokenInfo").first();
66
67 if (table.hasClass("active")) {
68 table.removeClass("active");
69 return;
70 }
71 else if (table.children("table").length > 0) {
72 table.addClass("active");
73 return;
74 };
75
Nils Diewald33e15552014-06-13 19:38:37 +000076 var corpusID = match.getAttribute('data-corpus-id');
77 var docID = match.getAttribute('data-doc-id');
78 var matchID = match.getAttribute('data-match-id');
Nils Diewald1eba6572014-06-17 19:49:53 +000079 var url = '/corpus/' + corpusID + '/' + docID + '/' + matchID;
80 var snippet;
81
82 jQuery.getJSON(url, function (res) {
83 var snippet = new SnippetTable(res['snippet']);
84 table.addClass("active");
85 table.append(snippet.toTable());
86 });
Nils Diewald33e15552014-06-13 19:38:37 +000087};
88
Nils Diewald2329e1d2014-06-12 16:07:57 +000089function openTutorial (o) {
90 var tut = $("#tutorial");
91 tut.slideDown();
92 var iframe = tut.children("iframe");
93 var src = iframe.attr("data-src");
94 iframe.attr("src", src);
95};
96
97function closeTutorial (o) {
98 $("#tutorial").slideUp();
99};
100
101function useQuery (o) {
102 var q = o.getAttribute("data-query");
103 var ql = o.getAttribute("data-query-language");
104 $("#ql-field").val(ql);
105 $("#q-field").val(q);
106 closeTutorial();
107};
108
Nils Diewald2329e1d2014-06-12 16:07:57 +0000109$("code.query.serial,#sidebar").on("click", function () {
Nils Diewald02df9912014-06-03 16:08:07 +0000110 $(this).toggleClass('active');
111});
Nils Diewald2329e1d2014-06-12 16:07:57 +0000112
113
Nils Diewald02df9912014-06-03 16:08:07 +0000114% end
115
Nils Diewald33e15552014-06-13 19:38:37 +0000116
Nils Diewald2329e1d2014-06-12 16:07:57 +0000117%= notifications 'Alertify'
Nils Diewald5d1ffb42014-05-21 17:45:34 +0000118 </body>
119</html>