projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b27cd2e
)
Towards a Categories widget that actually does something.
author
Mike Taylor
<mike@indexdata.com>
Thu, 17 Apr 2014 22:17:59 +0000
(23:17 +0100)
committer
Mike Taylor
<mike@indexdata.com>
Thu, 17 Apr 2014 22:17:59 +0000
(23:17 +0100)
src/mkws-widget-categories.js
patch
|
blob
|
history
diff --git
a/src/mkws-widget-categories.js
b/src/mkws-widget-categories.js
index
0b1f114
..
afb3875
100644
(file)
--- a/
src/mkws-widget-categories.js
+++ b/
src/mkws-widget-categories.js
@@
-7,7
+7,6
@@
mkws.registerWidgetType('Categories', function() {
}
this.team.queue("authenticated").subscribe(function(authName, realm) {
}
this.team.queue("authenticated").subscribe(function(authName, realm) {
- $(that.node).append("<p><b>Categories for " + realm + "</b></p>");
var req = new pzHttpRequest(that.config.pazpar2_url + "?command=categories", function(err) {
alert("HTTP call for categories failed: " + err)
});
var req = new pzHttpRequest(that.config.pazpar2_url + "?command=categories", function(err) {
alert("HTTP call for categories failed: " + err)
});
@@
-18,7
+17,19
@@
mkws.registerWidgetType('Categories', function() {
return;
}
that.log("got categories: " + data);
return;
}
that.log("got categories: " + data);
- // Parse once we've figured out the format
+
+ var text = [];
+ text.push("<p><b>Categories for " + realm + "</b></p>");
+ text.push("<ul>");
+ $(data).find('category').each(function() {
+ var name = $(this).find('categoryName').text();
+ var id = $(this).find('categoryId').text();
+ text.push("<li>");
+ text.push('<a href="#" onclick="mkws.setCategory(' + "'" + id + "'" + ')">' + name + '</a>');
+ text.push("</li>");
+ });
+ text.push("</ul>");
+ $(that.node).html(text.join(''));
});
});
});
});
});
});