Commit 23053b48 authored by Alexandra Rogova's avatar Alexandra Rogova

Changed paths to external and test files

parent 548f716d
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<html> <html>
<head> <head>
<title>Mynij</title> <title>Mynij</title>
<script src="../jio/external/rsvp-2.0.4.js"></script> <script src="./external/rsvp-2.0.4.js"></script>
<script src="../jio/dist/jio-latest.js"></script> <script src="./external/jio-latest.js"></script>
<script src="../renderjs/dist/renderjs-latest.js"></script> <script src="./external/renderjs-latest.js"></script>
<script src="search.js"></script> <script src="search.js"></script>
<link rel="stylesheet" type="text/css" href="mynij.css"> <link rel="stylesheet" type="text/css" href="mynij.css">
</head> </head>
......
(function (window, document, rJS, RSVP) { (function (window, document, rJS, RSVP) {
var gadget; var gadget;
rJS(window) rJS(window)
.setState({ .setState({
model_gadget : null, model_gadget : null,
parser_gadget : null, parser_gadget : null,
...@@ -22,15 +22,15 @@ ...@@ -22,15 +22,15 @@
"vivelessvt.rss" "vivelessvt.rss"
] ]
}) })
.allowPublicAcquisition("get_model", function(){ .allowPublicAcquisition("get_model", function(){
return this.getDeclaredGadget("model"); return this.getDeclaredGadget("model");
}) })
.ready(function(){ .ready(function(){
var model_gadget, var model_gadget,
result_gadget; result_gadget;
console.log("ready !"); console.log("ready !");
var gadget = this; var gadget = this;
return gadget.getDeclaredGadget("model") return gadget.getDeclaredGadget("model")
...@@ -54,25 +54,25 @@ ...@@ -54,25 +54,25 @@
}); });
}); });
}) })
.onStateChange(function (modification_dict){ .onStateChange(function (modification_dict){
var gadget = this, var gadget = this,
promise_list = [], promise_list = [],
i; i;
for (i = 0; i < gadget.state.to_load.length; i++){ for (i = 0; i < gadget.state.to_load.length; i++){
promise_list.push(gadget.state.parser_gadget.readFile("../rss-files/" + gadget.state.to_load[i])); promise_list.push(gadget.state.parser_gadget.readFile("./test-files/" + gadget.state.to_load[i]));
} }
RSVP.all(promise_list); RSVP.all(promise_list);
}) })
.declareMethod("search", function (key){ .declareMethod("search", function (key){
var gadget = this, var gadget = this,
options; options;
options = { options = {
query:'(title:"% '+key+' %") OR (title: key + "%") OR (body:"% '+key+' %")' query:'(title:"% '+key+' %") OR (title:'+ key + '%") OR (body:"% '+key+' %")'
}; };
return gadget.state.result_gadget.clear() return gadget.state.result_gadget.clear()
.push(function(){ .push(function(){
return gadget.state.model_gadget.search(options); return gadget.state.model_gadget.search(options);
...@@ -87,12 +87,12 @@ ...@@ -87,12 +87,12 @@
var i, var i,
id, id,
promise_list = []; promise_list = [];
for (i = 0; i < result.data.rows.length; i+=1){ for (i = 0; i < result.data.rows.length; i+=1){
id = result.data.rows[i].id; id = result.data.rows[i].id;
promise_list.push(gadget.state.model_gadget.get(id)); promise_list.push(gadget.state.model_gadget.get(id));
} }
return RSVP.all(promise_list); return RSVP.all(promise_list);
}) })
.push(function(result_list){ .push(function(result_list){
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
return RSVP.all(promise_list); return RSVP.all(promise_list);
}); });
}) })
.onEvent("submit", function(event){ .onEvent("submit", function(event){
this.search(event.target.elements[0].value); this.search(event.target.elements[0].value);
}); });
}(window, document, rJS, RSVP)); }(window, document, rJS, RSVP));
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment