Skip to content

Commit

Permalink
Have the predicates.get method support multiple fields and then use i…
Browse files Browse the repository at this point in the history
…t in the test page.
  • Loading branch information
pr1001 committed Nov 20, 2010
1 parent 915fcb4 commit 05a3284
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion anymeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ AnyMeta.predicates.get = function get(thing_id, fields, lang, wikify, callback,
fields = [fields];
}
for (var k in fields) {
parameters.push(['field', fields[k]]); // not sure this is how the method takes an array of fields...
parameters.push(['field[' + k + ']', fields[k]]); // not sure this is how the method takes an array of fields...
}
// just gave a callback
if (arguments.length == 3 && arguments[2] instanceof Function) {
Expand Down
15 changes: 15 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
h1.innerHTML = 'Welcome <a href="http://www.mediamatic.net/person/' + person.id + '/en">' + person.title + '</a>!';
document.body.appendChild(h1);
listObject(person, document.body);
/*
AnyMeta.user.create(
'The Foundry',
'[email protected]',
Expand All @@ -48,6 +49,20 @@
listObject(result, document.body);
}
);
*/
AnyMeta.predicates.get(
'MEDIAMATIC',
['text.title', 'text.body'],
function (thing) {
var h1 = document.createElement('h1');
h1.innerHTML = 'anymeta.predicates.get';
document.body.appendChild(h1);
listObject(thing, document.body);
},
function (err) {
console.log('error! ' + err.responseText.toString());
}
);
}
);
} else {
Expand Down

0 comments on commit 05a3284

Please sign in to comment.