mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Add base ui for facets
This commit is contained in:
@@ -69,6 +69,15 @@ module.exports = function(grunt) {
|
|||||||
"dest": "<%= path.asset %>/backbone-amd/",
|
"dest": "<%= path.asset %>/backbone-amd/",
|
||||||
"flatten": true
|
"flatten": true
|
||||||
},
|
},
|
||||||
|
"fancytree": {
|
||||||
|
"expand": true,
|
||||||
|
"src": [
|
||||||
|
"dist/*",
|
||||||
|
"dist/**/*"
|
||||||
|
],
|
||||||
|
"cwd": "<%= path.bower %>/fancytree",
|
||||||
|
"dest": "<%= path.asset %>/fancytree/"
|
||||||
|
},
|
||||||
"blueimp": {
|
"blueimp": {
|
||||||
"expand": true,
|
"expand": true,
|
||||||
"src": "js/load-image.js",
|
"src": "js/load-image.js",
|
||||||
|
@@ -28,7 +28,8 @@
|
|||||||
"autobahnjs": "~0.8.0",
|
"autobahnjs": "~0.8.0",
|
||||||
"when": "~2.7.0",
|
"when": "~2.7.0",
|
||||||
"web-socket-js": "~1.0.1",
|
"web-socket-js": "~1.0.1",
|
||||||
"jquery.treeview": "1.4.1"
|
"jquery.treeview": "1.4.1",
|
||||||
|
"fancytree": "~2.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "latest",
|
"mocha": "latest",
|
||||||
|
@@ -104,9 +104,12 @@
|
|||||||
background-color: #{{app['settings'].getUserSetting(app['authentication'].getUser(), 'background-selection', '404040')}};
|
background-color: #{{app['settings'].getUserSetting(app['authentication'].getUser(), 'background-selection', '404040')}};
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<!-- Include Fancytree skin and library -->
|
||||||
|
<link href="{{ path('minifier', { 'f' : 'assets/fancytree/dist/skin-win8/ui.fancytree.min.css'}) }}" rel="stylesheet" type="text/css">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
|
<script src="{{ path('minifier', { 'f' : 'assets/fancytree/dist/jquery.fancytree-all.js'}) }}" type="text/javascript"></script>
|
||||||
{% include "common/templates.html.twig" %}
|
{% include "common/templates.html.twig" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@@ -340,7 +340,6 @@ function search_doubles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newSearch() {
|
function newSearch() {
|
||||||
$('#proposals').empty();
|
|
||||||
p4.Results.Selection.empty();
|
p4.Results.Selection.empty();
|
||||||
|
|
||||||
clearAnswers();
|
clearAnswers();
|
||||||
@@ -486,16 +485,57 @@ function initAnswerForm() {
|
|||||||
console.debug('Aggregations:');
|
console.debug('Aggregations:');
|
||||||
var toDisplay = [];
|
var toDisplay = [];
|
||||||
_.each(aggs, function(value, key) {
|
_.each(aggs, function(value, key) {
|
||||||
_.each(value.buckets, function(bucket, keyBis) {
|
_.each(value.buckets, function(bucket, keyBis) {
|
||||||
if (!toDisplay[keyBis]) { toDisplay[keyBis] = {}; }
|
if (!toDisplay[keyBis]) { toDisplay[keyBis] = {}; }
|
||||||
toDisplay[keyBis][key] = bucket.key + ' ('+ bucket.doc_count + ')';
|
toDisplay[keyBis][key] = bucket.key + ' ('+ bucket.doc_count + ')';
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.table(toDisplay);
|
console.table(toDisplay);
|
||||||
|
|
||||||
|
var treeData = [];
|
||||||
|
_.each(aggs, function(value, key) {
|
||||||
|
var entry = {
|
||||||
|
"title" : key,
|
||||||
|
"key": key,
|
||||||
|
"folder": true,
|
||||||
|
"children" : []
|
||||||
|
};
|
||||||
|
_.each(value.buckets, function(bucket) {
|
||||||
|
entry.children.push({
|
||||||
|
"title": bucket.key + ' ('+ bucket.doc_count + ')',
|
||||||
|
"key": bucket.key,
|
||||||
|
"query": bucket.key + " IN " + key
|
||||||
|
});
|
||||||
|
});
|
||||||
|
treeData.push(entry);
|
||||||
|
});
|
||||||
|
|
||||||
$('#answers').empty().append(datas.results).removeClass('loading');
|
$('#answers').empty().append(datas.results).removeClass('loading');
|
||||||
|
|
||||||
|
var $tree = $("#proposals");
|
||||||
|
|
||||||
|
if ($tree.data("ui-fancytree")) {
|
||||||
|
$tree.fancytree("destroy");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (treeData.length > 0) {
|
||||||
|
$tree.fancytree({
|
||||||
|
source: treeData,
|
||||||
|
activate: function(event, data){
|
||||||
|
var node = data.node;
|
||||||
|
if (typeof node.data.query === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('form[name="phrasea_query"] input[name="qry"]').val(node.data.query);
|
||||||
|
checkFilters();
|
||||||
|
newSearch();
|
||||||
|
$('searchForm').trigger('submit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$("#answers img.lazyload").lazyload({
|
$("#answers img.lazyload").lazyload({
|
||||||
container: $('#answers')
|
container: $('#answers')
|
||||||
});
|
});
|
||||||
@@ -506,10 +546,6 @@ function initAnswerForm() {
|
|||||||
$('#IMGT_' + el).addClass('selected');
|
$('#IMGT_' + el).addClass('selected');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (datas.phrasea_props && $.trim(datas.phrasea_props) !== '') {
|
|
||||||
$('#proposals').empty().append(datas.phrasea_props);
|
|
||||||
$('#idFrameC li.proposals_WZ').addClass('active');
|
|
||||||
}
|
|
||||||
p4.tot = datas.total_answers;
|
p4.tot = datas.total_answers;
|
||||||
p4.tot_options = datas.form;
|
p4.tot_options = datas.form;
|
||||||
p4.tot_query = datas.query;
|
p4.tot_query = datas.query;
|
||||||
|
Reference in New Issue
Block a user