blob: e92b324dd8884f5456068c8b9d2dc64c861deefb [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
8var json = {
9 "@type":"koral:docGroup",
10 "operation":"operation:or",
11 "operands":[
12 {
13 "@type":"koral:docGroup",
14 "operation":"operation:and",
15 "operands":[
16 {
17 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000018 "key":"title",
Nils Diewald0e6992a2015-04-14 20:13:52 +000019 "value":"Der Birnbaum",
20 "match":"match:eq"
21 },
22 {
23 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000024 "key":"pubPlace",
Nils Diewald0e6992a2015-04-14 20:13:52 +000025 "value":"Mannheim",
26 "match":"match:eq"
27 },
28 {
29 "@type":"koral:docGroup",
30 "operation":"operation:or",
31 "operands":[
32 {
33 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000034 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000035 "value":"Aufzucht und Pflege",
36 "match":"match:eq"
37 },
38 {
39 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000040 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000041 "value":"Gedichte",
42 "match":"match:eq",
43 "rewrites" : [
44 {
45 "@type": "koral:rewrite",
46 "src" : "policy",
47 "operation" : "operation:injection",
48 }
49 ]
50 }
51 ]
52 }
53 ]
54 },
55 {
56 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000057 "key":"pubDate",
Nils Diewald0e6992a2015-04-14 20:13:52 +000058 "type":"type:date",
59 "value":"2015-03-05",
60 "match":"match:geq"
61 }
62 ]
63};
64
Nils Diewald0e6992a2015-04-14 20:13:52 +000065require(['vc','lib/domReady'], function (vcClass, domReady) {
Nils Diewald4c221252015-04-21 20:19:25 +000066
67 var loc = KorAP.Locale;
68
69 loc.AND = 'und';
70 loc.OR = 'oder';
71 loc.VC_subTitle = 'Untertitel';
72 loc.VC_title = 'Titel';
73 loc.VC_pubDate = 'Veröffentlichungsdatum';
74 loc.VC_pubPlace = 'Veröffentlichungsort';
Nils Diewald0e6992a2015-04-14 20:13:52 +000075
76 domReady(function() {
Nils Diewald4c221252015-04-21 20:19:25 +000077
78 // Create a new virtual collection by passing a based json object and
79 // field menu information
Nils Diewald6283d692015-04-23 20:32:53 +000080 var vc = vcClass.create([
Nils Diewald4c221252015-04-21 20:19:25 +000081 ['title', 'string'],
82 ['subTitle', 'string'],
83 ['pubDate', 'date'],
84 ['author', 'string']
Nils Diewald6283d692015-04-23 20:32:53 +000085 ]).fromJson(json);
Nils Diewald0e6992a2015-04-14 20:13:52 +000086 document.getElementById('vc').appendChild(vc.element());
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000087
Nils Diewald4c221252015-04-21 20:19:25 +000088 // show the current JSON serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000089 KorAP.showJSON = function () {
90 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
91 };
92
Nils Diewald4c221252015-04-21 20:19:25 +000093 // show the current query serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000094 KorAP.showQuery = function () {
95 document.getElementById("query").innerHTML = vc.root().toQuery();
96 };
97
Nils Diewald0e6992a2015-04-14 20:13:52 +000098 });
99});