Commit 14f77f0a authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1006: Search for candidate persons to existing person groups

Task-Url: https://pm.winseda.de/issues/1006
parent ce0cb3b7
......@@ -62,7 +62,7 @@ Basesearch.prototype.showSearchResultTags = function(taglist) {
}
}
Basesearch.prototype.showSearchResponseItem = function(result) {
Basesearch.prototype.showSearchResponseItem = function(result, resultsContainer) {
......@@ -161,7 +161,11 @@ Basesearch.prototype.showSearchResponseItem = function(result) {
"</div>" +
"</div>";
$("#search-results").append(element);
if (resultsContainer===undefined) {
$("#search-results").append(element);
} else {
resultsContainer.append(element);
}
}
......@@ -6,41 +6,34 @@ $(document).ready(function() {
function GroupView() {
this.auth = $("#uauth").val()=='true';
this.groupId = $("#groupid").val();
this.query();
this.options = {
wordcloud : {
selector: "#significant-terms-cloud",
tagcount: 100,
animate: true,
animateDirection: "topDown",
height: 500,
width: 700,
tagsize: {
factor: 80,
offset: 7
}
},
};
this.setupCloud();
var _this = this;
this.query("queryMembers", "#group-members-container", function(data) {
_this.loadSignificantTerms();
_this.query("queryCandidates", "#group-candidates-container");
});
};
GroupView.prototype = new Basesearch();
GroupView.prototype.query = function() {
GroupView.prototype.query = function(path, responseContainerSelector, callback) {
var _this = this;
$("#search-loading-indicator").removeClass("fade");
$.ajax({
url: window.location.pathname + "/query",
url: __util.composeUrl("groups/" + _this.groupId + "/" + path),
type: "GET",
encoding:"UTF-8",
dataType:"json",
contentType: "application/json; charset=UTF-8",
success: function(data) {
_this.processSearchResponse(data);
_this.loadSignificantTerms();
if (callback!==undefined && callback!==null) {
callback(data);
}
_this.processSearchResponse(responseContainerSelector, data);
$("#search-loading-indicator").addClass("fade");
},
error: function() {
......@@ -49,24 +42,40 @@ GroupView.prototype.query = function() {
});
};
GroupView.prototype.processSearchResponse = function(data) {
$("#search-results").html("");
GroupView.prototype.processSearchResponse = function(responseContainerSelector, data) {
var statsContainer = $(responseContainerSelector + " .search-result-stats");
var resultsContainer = $(responseContainerSelector + " .search-results");
resultsContainer.html("");
if (data!=null && data.results!=null && data.results.length>0) {
$("#search-result-stats").html("Angezeigt werden <strong>" + data.results.length + "</strong> von <strong>" + data.totalHits + "</strong> Treffern");
statsContainer.html("Angezeigt werden <strong>" + data.results.length + "</strong> von <strong>" + data.totalHits + "</strong> Treffern");
for (var i=0; i<data.results.length; i++) {
this.showSearchResponseItem(data.results[i]);
this.showSearchResponseItem(data.results[i], resultsContainer);
}
$(".wordcloud").hide();
} else {
$("#search-result-stats").html("");
$("#search-results").html("Keine Personen für <strong>" + $("#queryExpression").val() + "</strong> im angegebenen Zeitraum gefunden.");
$(".wordcloud").show();
statsContainer.html("");
resultsContainer.html("Keine Personen für <strong>" + $("#queryExpression").val() + "</strong> im angegebenen Zeitraum gefunden.");
}
};
GroupView.prototype.setupCloud = function() {
this.options = {
wordcloud : {
selector: "#significant-terms-cloud",
tagcount: 100,
animate: true,
animateDirection: "topDown",
height: 500,
width: 700,
tagsize: {
factor: 80,
offset: 7
}
},
};
};
GroupView.prototype.loadSignificantTerms = function() {
var _this = this;
$.ajax({
......
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