doofinder
Advanced tools
Comparing version 2.0.2 to 3.0.0
{ | ||
"name": "doofinder", | ||
"description": "Javascript Library for Doofinder Search API", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"main": "dist/doofinder.js", | ||
@@ -6,0 +6,0 @@ "authors": [ |
(function() { | ||
module.exports = { | ||
version: "2.0.2", | ||
version: "3.0.0", | ||
Client: require("./client"), | ||
@@ -5,0 +5,0 @@ Mustache: require("mustache"), |
@@ -11,3 +11,3 @@ | ||
RangeFacet | ||
This class receives a facet ranges and paint | ||
This class receives a facet ranges and paint | ||
them. Manages the filtering. | ||
@@ -47,7 +47,7 @@ */ | ||
throw Error("Error in RangeFacet: " + this.name + " facet is not configured."); | ||
} else if (!res.facets[this.name].ranges) { | ||
} else if (!res.facets[this.name].range) { | ||
throw Error("Error in RangeFacet: " + this.name + " facet is not a range facet."); | ||
} | ||
_this = this; | ||
if (res.facets[this.name].ranges[0].count > 1) { | ||
if (res.total > 0) { | ||
context = $.extend(true, { | ||
@@ -60,6 +60,6 @@ name: this.name | ||
type: "double", | ||
min: parseInt(res.facets[this.name].ranges[0].min, 10), | ||
from: parseInt(res.facets[this.name].ranges[0].min, 10), | ||
max: parseInt(res.facets[this.name].ranges[0].max, 10), | ||
to: parseInt(res.facets[this.name].ranges[0].max, 10), | ||
min: parseInt(res.facets[this.name].range.buckets[0].stats.min, 10), | ||
from: parseInt(res.facets[this.name].range.buckets[0].stats.min, 10), | ||
max: parseInt(res.facets[this.name].range.buckets[0].stats.max, 10), | ||
to: parseInt(res.facets[this.name].range.buckets[0].stats.max, 10), | ||
force_edges: true, | ||
@@ -66,0 +66,0 @@ prettify_enabled: true, |
@@ -35,3 +35,3 @@ | ||
if (!options.template) { | ||
template = '{{#@index}}' + '<hr class="df-separator">' + '{{/@index}}' + '<div class="df-facets">' + '<a href="#" class="df-panel__title" data-toggle="panel">{{label}}</a>' + '<div class="df-facets__content">' + '<ul>' + '{{#terms}}' + '<li>' + '<a href="#" class="df-facet {{#selected}}df-facet--active{{/selected}}" data-facet="{{name}}"' + 'data-value="{{ term }}">{{ term }} <span' + 'class="df-facet__count">{{ count }}</span></a>' + '</li>' + '{{/terms}}'; | ||
template = '{{#@index}}' + '<hr class="df-separator">' + '{{/@index}}' + '<div class="df-facets">' + '<a href="#" class="df-panel__title" data-toggle="panel">{{label}}</a>' + '<div class="df-facets__content">' + '<ul>' + '{{#terms}}' + '<li>' + '<a href="#" class="df-facet {{#selected}}df-facet--active{{/selected}}" data-facet="{{name}}"' + 'data-value="{{ key }}">{{ term }} <span' + 'class="df-facet__count">{{ doc_count }}</span></a>' + '</li>' + '{{/terms}}'; | ||
} else { | ||
@@ -65,3 +65,3 @@ template = options.template; | ||
var ref, results, selected, term, terms; | ||
terms = res.facets[_this.name].terms; | ||
terms = res.facets[_this.name].terms.buckets; | ||
ref = _this.selected; | ||
@@ -72,3 +72,3 @@ results = []; | ||
if (selected && !_this._termInResults(term, terms)) { | ||
_this.selected[term] = 0; | ||
_this.selected[term.key] = 0; | ||
results.push(_this.controller.removeFilter(_this.name, term)); | ||
@@ -87,3 +87,3 @@ } else { | ||
elem = terms[i]; | ||
if (term === elem.term) { | ||
if (term === elem.key) { | ||
return true; | ||
@@ -96,6 +96,6 @@ } | ||
TermFacet.prototype.render = function(res) { | ||
var anySelected, context, html, i, key, len, ref, ref1, term, totalSelected; | ||
var anySelected, context, html, i, index, len, ref, ref1, term, totalSelected; | ||
if (!res.facets || !res.facets[this.name]) { | ||
throw Error("Error in TermFacet: " + this.name + " facet is not configured."); | ||
} else if (!res.facets[this.name].terms) { | ||
} else if (!res.facets[this.name].terms.buckets) { | ||
throw Error("Error in TermFacet: " + this.name + " facet is not a term facet."); | ||
@@ -116,8 +116,8 @@ } | ||
if (res.results) { | ||
ref1 = res.facets[this.name].terms; | ||
for (key in ref1) { | ||
term = ref1[key]; | ||
term.key = key; | ||
ref1 = res.facets[this.name].terms.buckets; | ||
for (index in ref1) { | ||
term = ref1[index]; | ||
term.index = index; | ||
term.name = this.name; | ||
if (this.selected[term.term]) { | ||
if (this.selected[term.key]) { | ||
term.selected = 1; | ||
@@ -132,3 +132,3 @@ } else { | ||
name: this.name, | ||
terms: res.facets[this.name].terms | ||
terms: res.facets[this.name].terms.buckets | ||
}, this.extraContext || {}); | ||
@@ -135,0 +135,0 @@ this.addHelpers(context); |
{ | ||
"name": "doofinder", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "Javascript Library for Doofinder Search API", | ||
@@ -5,0 +5,0 @@ "main": "lib/doofinder.js", |
@@ -95,3 +95,5 @@ # jsDoofinder | ||
**WARNING**: Note that Doofinder Search API is protected with CORS, so you must enable the host you are requesting from. You can do this from your Doofinder Administration Panel > Configuration > TODO(@ecoslado) This feature in Admin Panel. | ||
**WARNING**: Note that Doofinder Search API is protected with CORS, so | ||
you must enable the host you are requesting from. You can do this from | ||
your Doofinder Administration Panel > Configuration > Allowed Domains. | ||
@@ -98,0 +100,0 @@ With all this in place you'll have a search box where you can write a query and the results will be shown. Scrolling into the layer you'll see more results. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
601
85530
23