blob: f7abfb70a4d523ae27c9229f575f96b861d49841 [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
15<div id="tutorial" style="display: none">
16 <i onclick="closeTutorial()" class="fa fa-toggle-up"></i>
Nils Diewald33e15552014-06-13 19:38:37 +000017 <iframe src="about:blank" data-src="<%= url_for(session('tutorial') || 'tutorial') %>"></iframe>
Nils Diewald2329e1d2014-06-12 16:07:57 +000018</div>
Nils Diewald02df9912014-06-03 16:08:07 +000019
Nils Diewald33e15552014-06-13 19:38:37 +000020
Nils Diewald02df9912014-06-03 16:08:07 +000021<div id="top">
Nils Diewald33e15552014-06-13 19:38:37 +000022 <h1><span>KorAP- Korpusanalyseplattform der nächsten Generation</span></h1>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000023%= form_for url_for() => begin
Nils Diewald2329e1d2014-06-12 16:07:57 +000024%= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field'
Nils Diewald02df9912014-06-03 16:08:07 +000025<br />
Nils Diewald2329e1d2014-06-12 16:07:57 +000026%= search_field 'q', id => 'q-field'
Nils Diewald02df9912014-06-03 16:08:07 +000027<button type="submit" name="action" value="ok"><i class="fa fa-search"></i></button>
28<button type="submit" name="action" value="inspect"><i class="fa fa-code"></i></button>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000029% end
Nils Diewald02df9912014-06-03 16:08:07 +000030
Nils Diewald02df9912014-06-03 16:08:07 +000031<div id="button-right">
Nils Diewald2329e1d2014-06-12 16:07:57 +000032% if (param('q')) {
Nils Diewald02df9912014-06-03 16:08:07 +000033<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 +000034% }
Nils Diewald2329e1d2014-06-12 16:07:57 +000035<button type="button" onclick="openTutorial()"><i class="fa fa-graduation-cap"></i></button>
36</div>
Nils Diewald02df9912014-06-03 16:08:07 +000037
38</div>
39
40<div id="sidebar" style="padding-top: 90px">
Nils Diewald2329e1d2014-06-12 16:07:57 +000041%= include 'collections'
Nils Diewald02df9912014-06-03 16:08:07 +000042</div>
43
44<div id="search">
Nils Diewald5d1ffb42014-05-21 17:45:34 +000045%= content
Nils Diewald02df9912014-06-03 16:08:07 +000046</div>
47
48%= javascript begin
Nils Diewald2329e1d2014-06-12 16:07:57 +000049
50$("ol > li:not(.active)").on("click", function () {
51 $(this).addClass('active');
52});
53
54function closeSnippet (o) {
55 $(o.parentNode.parentNode).removeClass('active');
56};
57
Nils Diewald33e15552014-06-13 19:38:37 +000058function showTable (o) {
59 var match = o.parentNode.parentNode;
Nils Diewald1eba6572014-06-17 19:49:53 +000060 var table = $(match).children("div").children("div.tokenInfo").first();
61
62 if (table.hasClass("active")) {
63 table.removeClass("active");
64 return;
65 }
66 else if (table.children("table").length > 0) {
67 table.addClass("active");
68 return;
69 };
70
Nils Diewald33e15552014-06-13 19:38:37 +000071 var corpusID = match.getAttribute('data-corpus-id');
72 var docID = match.getAttribute('data-doc-id');
73 var matchID = match.getAttribute('data-match-id');
Nils Diewald1eba6572014-06-17 19:49:53 +000074 var url = '/corpus/' + corpusID + '/' + docID + '/' + matchID;
75 var snippet;
76
77 jQuery.getJSON(url, function (res) {
78 var snippet = new SnippetTable(res['snippet']);
79 table.addClass("active");
80 table.append(snippet.toTable());
81 });
Nils Diewald33e15552014-06-13 19:38:37 +000082};
83
Nils Diewald2329e1d2014-06-12 16:07:57 +000084function openTutorial (o) {
85 var tut = $("#tutorial");
86 tut.slideDown();
87 var iframe = tut.children("iframe");
88 var src = iframe.attr("data-src");
89 iframe.attr("src", src);
90};
91
92function closeTutorial (o) {
93 $("#tutorial").slideUp();
94};
95
96function useQuery (o) {
97 var q = o.getAttribute("data-query");
98 var ql = o.getAttribute("data-query-language");
99 $("#ql-field").val(ql);
100 $("#q-field").val(q);
101 closeTutorial();
102};
103
Nils Diewald2329e1d2014-06-12 16:07:57 +0000104$("code.query.serial,#sidebar").on("click", function () {
Nils Diewald02df9912014-06-03 16:08:07 +0000105 $(this).toggleClass('active');
106});
Nils Diewald2329e1d2014-06-12 16:07:57 +0000107
108
Nils Diewald02df9912014-06-03 16:08:07 +0000109% end
110
Nils Diewald33e15552014-06-13 19:38:37 +0000111
Nils Diewald2329e1d2014-06-12 16:07:57 +0000112%= notifications 'Alertify'
Nils Diewald5d1ffb42014-05-21 17:45:34 +0000113 </body>
114</html>