Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title><%= title %></title> |
| 5 | %= stylesheet '/style.css' |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 6 | %= stylesheet '/table.css' |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 7 | %= stylesheet '/kwic-4.0.css' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 8 | %= stylesheet '/fontawesome/font-awesome.min.css' |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 9 | %= javascript '/jquery-2.0.0.min.js' |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 10 | %= javascript '/translateTable.js' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 11 | <meta charset="utf-8" /> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 12 | </head> |
| 13 | <body> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 14 | |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 15 | % unless (current_route 'tutorial') { |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 16 | <div id="tutorial" style="display: none"> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 17 | % 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 Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 21 | </div> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 22 | % }; |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 23 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 24 | <div id="top"> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 25 | <a href="<%= url_for 'index' %>"><h1><span>KorAP- Korpusanalyseplattform der nächsten Generation</span></h1></a> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 26 | %= form_for url_for() => begin |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 27 | %= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 28 | <br /> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 29 | %= search_field 'q', id => 'q-field' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 30 | <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 Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 32 | % end |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 33 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 34 | <div id="button-right"> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 35 | % if (param('q')) { |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 36 | <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 Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 37 | % } |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 38 | % unless (current_route 'tutorial') { |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 39 | <button type="button" onclick="openTutorial()"><i class="fa fa-graduation-cap"></i></button> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame^] | 40 | % }; |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 41 | </div> |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 42 | |
| 43 | </div> |
| 44 | |
| 45 | <div id="sidebar" style="padding-top: 90px"> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 46 | %= include 'collections' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 47 | </div> |
| 48 | |
| 49 | <div id="search"> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 50 | %= content |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 51 | </div> |
| 52 | |
| 53 | %= javascript begin |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 54 | |
| 55 | $("ol > li:not(.active)").on("click", function () { |
| 56 | $(this).addClass('active'); |
| 57 | }); |
| 58 | |
| 59 | function closeSnippet (o) { |
| 60 | $(o.parentNode.parentNode).removeClass('active'); |
| 61 | }; |
| 62 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 63 | function showTable (o) { |
| 64 | var match = o.parentNode.parentNode; |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 65 | 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 Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 76 | var corpusID = match.getAttribute('data-corpus-id'); |
| 77 | var docID = match.getAttribute('data-doc-id'); |
| 78 | var matchID = match.getAttribute('data-match-id'); |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 79 | 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 Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 87 | }; |
| 88 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 89 | function 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 | |
| 97 | function closeTutorial (o) { |
| 98 | $("#tutorial").slideUp(); |
| 99 | }; |
| 100 | |
| 101 | function 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 Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 109 | $("code.query.serial,#sidebar").on("click", function () { |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 110 | $(this).toggleClass('active'); |
| 111 | }); |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 112 | |
| 113 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 114 | % end |
| 115 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 116 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 117 | %= notifications 'Alertify' |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 118 | </body> |
| 119 | </html> |