adding app.js
This commit is contained in:
parent
8603ea938b
commit
68a09563cb
1 changed files with 42 additions and 0 deletions
42
demos/test/app.js
Normal file
42
demos/test/app.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
$(function() {
|
||||
var app = new Ox.App({
|
||||
requestURL: "http://blackbook.local:8000/api/"
|
||||
}),
|
||||
$dialog = new Ox.Dialog({
|
||||
title: "Login failed",
|
||||
buttons: [
|
||||
new Ox.Button({
|
||||
size: "medium",
|
||||
value: "Change Title"
|
||||
}).click(function() {
|
||||
console.log("click to change title")
|
||||
$dialog.options({
|
||||
title: "New Title"
|
||||
});
|
||||
$dialog.$buttons[0].toggleDisabled();
|
||||
}),
|
||||
new Ox.Button({
|
||||
size: "medium",
|
||||
value: "Close",
|
||||
}).click(function() {
|
||||
$dialog.close();
|
||||
})
|
||||
]
|
||||
});
|
||||
app.request("error");
|
||||
//app.request("hello");
|
||||
app.request("login", {"username": "test", "password": "test"}, function(result) {
|
||||
Ox.print(result);
|
||||
if (result.status.code == 200) {
|
||||
Ox.print(result);
|
||||
app.request("preferences", function(result) {
|
||||
Ox.print(result.data.preferences);
|
||||
});
|
||||
}
|
||||
else if (result.status.code == 403) {
|
||||
$dialog.open();
|
||||
} else {
|
||||
Ox.print("broken");
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue