Commit 4fb648dd authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

987: Collection wordclouds only work for oai_dc based collections

Task-Url: https://pm.winseda.de/issues/987
parent 6460eeca
......@@ -370,6 +370,7 @@ a:active i {
.wordcloud {
text-align: center;
margin-top: 10px;
}
.wordcloud text:hover {
......
......@@ -25,7 +25,7 @@ var Home = function(options) {
};
Home.prototype.handleTagTextClicked = function(tag) {
$("#expression").val(tag.count);
$("#expression").val(tag.text);
$("#search-form").submit();
};
......
......@@ -26,6 +26,7 @@ $(document).ready(function() {
var clouds = [];
queryHandler.loadPlaceholderTagcloud();
/*queryHandler.assignEventHandlers();
queryHandler.updateDisplayedCollections();
......@@ -89,6 +90,57 @@ var QueryHandler = function(options) {
}
};
QueryHandler.prototype.loadPlaceholderTagcloud = function() {
var _this = this;
$.ajax({
url: __util.getBaseUrl() + (_this.options.customSearch!=null ? ("/custom/" + _this.options.customSearch) : "") + "/tags?analyzer=Wordcloud&size=100",
type: "GET",
dataType: "json",
success: function(data) {
var tags = [];
for (var i=0; i<data.length; i++) {
tags.push({
text: data[i].term,
size: (data[i].weight * 80) + 7,
title: data[i].count + " occurences"
});
}
tagCloud = new TagCloud({
tags: tags,
containerSelector: "#wordcloud-placeholder",
animateFontSize: true,
w: 600,
h: 400,
textClickEvent: function(tag) {
_this.expandSearch(tag.text);
}
});
}
});
};
QueryHandler.prototype.expandSearch = function(expression) {
if (expression==null || expression==="") {
return;
}
var _this = this;
if ($("#expression").length>0) {
if ($("#expression").val().length>0) {
$("#expression").val($("#expression").val() + " " + expression);
} else {
$("#expression").val(expression);
}
this.doSearch();
} else if ("#facet-selection-container".length > 0) {
this.addSearchFacet(function(facetElement) {
$(facetElement).find(".search-facet-expression").val(expression);
//_this.doSearch();
});
}
};
QueryHandler.prototype.selectFacetingSchema = function() {
this.schemaId = $("#schemaId").val();
var container = $("#facet-schema-info");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment