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

Changed paths to external and test files

parent 548f716d
......@@ -2,9 +2,9 @@
<html>
<head>
<title>Mynij</title>
<script src="../jio/external/rsvp-2.0.4.js"></script>
<script src="../jio/dist/jio-latest.js"></script>
<script src="../renderjs/dist/renderjs-latest.js"></script>
<script src="./external/rsvp-2.0.4.js"></script>
<script src="./external/jio-latest.js"></script>
<script src="./external/renderjs-latest.js"></script>
<script src="search.js"></script>
<link rel="stylesheet" type="text/css" href="mynij.css">
</head>
......
(function (window, document, rJS, RSVP) {
var gadget;
rJS(window)
.setState({
model_gadget : null,
parser_gadget : null,
......@@ -22,15 +22,15 @@
"vivelessvt.rss"
]
})
.allowPublicAcquisition("get_model", function(){
return this.getDeclaredGadget("model");
})
.ready(function(){
var model_gadget,
result_gadget;
console.log("ready !");
var gadget = this;
return gadget.getDeclaredGadget("model")
......@@ -54,25 +54,25 @@
});
});
})
.onStateChange(function (modification_dict){
var gadget = this,
promise_list = [],
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);
})
.declareMethod("search", function (key){
var gadget = this,
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()
.push(function(){
return gadget.state.model_gadget.search(options);
......@@ -87,12 +87,12 @@
var i,
id,
promise_list = [];
for (i = 0; i < result.data.rows.length; i+=1){
id = result.data.rows[i].id;
promise_list.push(gadget.state.model_gadget.get(id));
}
return RSVP.all(promise_list);
})
.push(function(result_list){
......@@ -104,8 +104,8 @@
return RSVP.all(promise_list);
});
})
.onEvent("submit", function(event){
this.search(event.target.elements[0].value);
});
}(window, document, rJS, RSVP));
\ No newline at end of file
}(window, document, rJS, RSVP));
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