mirror of https://github.com/perkeep/perkeep.git
137 lines
4.0 KiB
HTML
137 lines
4.0 KiB
HTML
<!--
|
|
Copyright 2013 The Perkeep Authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="closure/goog/base.js"></script>
|
|
<script src="./deps.js"></script>
|
|
<script>
|
|
goog.require('goog.events');
|
|
goog.require('goog.testing.net.XhrIo');
|
|
|
|
goog.require('cam.ServerConnection');
|
|
goog.require('cam.BlobItemContainer');
|
|
</script>
|
|
<link rel="stylesheet" href="blob_item.css" type="text/css">
|
|
<link rel="stylesheet" href="blob_item_container.css" type="text/css">
|
|
</head>
|
|
<body>
|
|
<script>
|
|
// Mock response from: http://127.0.0.1:3179/my-search/camli/search/recent?thumbnails=100
|
|
var recentBlobResponse = {
|
|
"recent": [
|
|
{
|
|
"blobref": "sha1-5660088af0aa0d4f2294088f41284002a1baaa29",
|
|
"modtime": "2012-12-23T19:53:32Z",
|
|
"owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4"
|
|
},
|
|
{
|
|
"blobref": "sha1-3ced53f0a11115e98d6e40ca4558680f2768f23e",
|
|
"modtime": "2012-12-23T19:19:37Z",
|
|
"owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4"
|
|
},
|
|
{
|
|
"blobref": "sha1-19236d4922116d03738f1c8c6d9f14debbab798b",
|
|
"modtime": "2012-12-23T19:19:37Z",
|
|
"owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4"
|
|
}
|
|
],
|
|
"sha1-19236d4922116d03738f1c8c6d9f14debbab798b": {
|
|
"blobRef": "sha1-19236d4922116d03738f1c8c6d9f14debbab798b",
|
|
"camliType": "permanode",
|
|
"mimeType": "application/json; camliType=permanode",
|
|
"permanode": {
|
|
"attr": {
|
|
"camliRoot": [
|
|
"dev-pics-root"
|
|
],
|
|
"title": [
|
|
"Publish root node for dev-pics-root"
|
|
]
|
|
}
|
|
},
|
|
"size": 562,
|
|
"thumbnailHeight": 100,
|
|
"thumbnailSrc": "node.png",
|
|
"thumbnailWidth": 100
|
|
},
|
|
"sha1-3ced53f0a11115e98d6e40ca4558680f2768f23e": {
|
|
"blobRef": "sha1-3ced53f0a11115e98d6e40ca4558680f2768f23e",
|
|
"camliType": "permanode",
|
|
"mimeType": "application/json; camliType=permanode",
|
|
"permanode": {
|
|
"attr": {
|
|
"camliRoot": [
|
|
"dev-blog-root"
|
|
],
|
|
"title": [
|
|
"Publish root node for dev-blog-root"
|
|
]
|
|
}
|
|
},
|
|
"size": 562,
|
|
"thumbnailHeight": 100,
|
|
"thumbnailSrc": "node.png",
|
|
"thumbnailWidth": 100
|
|
},
|
|
"sha1-5660088af0aa0d4f2294088f41284002a1baaa29": {
|
|
"blobRef": "sha1-5660088af0aa0d4f2294088f41284002a1baaa29",
|
|
"camliType": "permanode",
|
|
"mimeType": "application/json; camliType=permanode",
|
|
"permanode": {
|
|
"attr": {
|
|
"camliContent": [
|
|
"sha1-c2379bcf77848c90d2c83709aaf7f628a21ff725"
|
|
]
|
|
}
|
|
},
|
|
"size": 556,
|
|
"thumbnailHeight": 100,
|
|
"thumbnailSrc": "thumbnail/sha1-c2379bcf77848c90d2c83709aaf7f628a21ff725/leisure-suit-tony.gif?mw=100&mh=100",
|
|
"thumbnailWidth": 100
|
|
},
|
|
"sha1-c2379bcf77848c90d2c83709aaf7f628a21ff725": {
|
|
"blobRef": "sha1-c2379bcf77848c90d2c83709aaf7f628a21ff725",
|
|
"camliType": "file",
|
|
"file": {
|
|
"size": 37741,
|
|
"fileName": "leisure-suit-tony.gif",
|
|
"mimeType": "image/gif"
|
|
},
|
|
"mimeType": "application/json; camliType=file",
|
|
"size": 198
|
|
}
|
|
};
|
|
|
|
var connection = new cam.ServerConnection(
|
|
{
|
|
'searchRoot': '/my/test/search'
|
|
},
|
|
goog.testing.net.XhrIo.send
|
|
);
|
|
|
|
var container = new cam.BlobItemContainer(connection);
|
|
container.render(document.body);
|
|
|
|
container.showRecent();
|
|
|
|
var request = goog.testing.net.XhrIo.getSendInstances().pop();
|
|
request.simulateResponse(200, JSON.stringify(recentBlobResponse));
|
|
</script>
|
|
</body>
|
|
</html>
|