migrated to api2

This commit is contained in:
Konrad Mohrfeldt 2011-10-12 21:13:21 +02:00
parent a3223e197c
commit 9729e675ff
1 changed files with 12 additions and 12 deletions

View File

@ -5,20 +5,20 @@ jQuery(document).ready(function($) {
var lock = false; var lock = false;
var items = [false]; var items = [false];
$.getJSON('/api/store/', function(data) { $.getJSON("/api2/buyable/item", function(data) {
if(data.error === undefined) { if(data.error === undefined) {
source = []; source = [];
$.each(data, function(key, val) { $.each(data, function(key, item) {
items[val.pk] = val; items[item.id] = item;
source.push({ source.push({
value: val.pk, value: item.id,
label: "<span class='preview pk" + val.pk + "'><img src='" + label: "<span class='preview pk" + item.id + "'><img src='" +
MEDIA_URL + val.fields.image + "' alt='" + MEDIA_URL + item.image + "' alt='" +
val.fields.name + "' /></span>" + item.name + "' /></span>" +
"<span class='meta'>" + val.fields.name + "<span class='meta'>" + item.name +
"<br />Preis: " + val.fields.price.toFixed(2) + "<br />Preis: " + parseFloat(item.price).toFixed(2) +
" €</span><span class='buy'></span>" " €</span><span class='buy'></span>"
}); });
}); });
@ -58,8 +58,8 @@ jQuery(document).ready(function($) {
if(lock && event.keyCode === 39) { if(lock && event.keyCode === 39) {
selected_item.addClass("load"); selected_item.addClass("load");
$.get("/api/store/buy/" + selection.value + "/", { $.post("/api2/buyable/item/" + selection.value, {
"deposit": "1"
}, function(data, status) { }, function(data, status) {
selected_item.removeClass("load"); selected_item.removeClass("load");