--- a/client/app/search/search.html Mon Oct 06 12:59:13 2014 +0200
+++ b/client/app/search/search.html Mon Oct 06 17:36:47 2014 +0200
@@ -3,18 +3,18 @@
<div ng-if="results.nhits>0">
<div class="row search-item" ng-repeat="h in results.hits" ng-init="h.imgbig=false">
<div ng-class="{'col-md-5': h.imgbig, 'col-md-3': !h.imgbig}">
- <img src="{{ h.url }}" ng-class="{'search-img-max': !h.imgbig}"/>
+ <img src="{{ h.metas_dict.images }}" ng-class="{'search-img-max': !h.imgbig}"/>
</div>
<div ng-class="{'col-md-5': h.imgbig, 'col-md-7': !h.imgbig}">
- <p><strong>Nom :</strong> {{ h.metas|meta:"name" }}</p>
- <p><strong>Description :</strong> {{ h.metas|meta:"description" }}</p>
+ <p><strong>Nom :</strong> {{ h.metas_dict.name }}</p>
+ <p><strong>Description :</strong> {{ h.metas_dict.description }}</p>
<div ng-show="h.imgbig">
- <p><small><strong>Classification :</strong> {{ h.metas|meta:"classification" }}</small></p>
- <p><small><strong>Current Custody :</strong> {{ h.metas|meta:"currentcustody" }}</small></p>
- <p><small><strong>Former Custody :</strong> {{ h.metas|meta:"formercustody" }}</small></p>
- <p><small><strong>Mesures :</strong> {{ h.metas|meta:"measures" }}</small></p>
- <p><small><strong>Acteurs :</strong> {{ h.metas|meta:"actors" }}</small></p>
- <p><small><strong>Lieux :</strong> {{ h.metas|meta:"places" }}</small></p>
+ <p><small><strong>Classification :</strong> {{ h.metas_dict.classification }}</small></p>
+ <p><small><strong>Propriétaire actuel :</strong> {{ h.metas_dict.currentcustody }}</small></p>
+ <p><small><strong>Ancien propriétaire :</strong> {{ h.metas_dict.formercustody }}</small></p>
+ <p><small><strong>Mesures :</strong> {{ h.metas_dict.measures }}</small></p>
+ <p><small><strong>Acteurs :</strong> {{ h.metas_dict.actors }}</small></p>
+ <p><small><strong>Lieux :</strong> {{ h.metas_dict.places }}</small></p>
</div>
</div>
<div class="col-md-1">
--- a/client/app/search/search_controller.js Mon Oct 06 12:59:13 2014 +0200
+++ b/client/app/search/search_controller.js Mon Oct 06 17:36:47 2014 +0200
@@ -15,9 +15,19 @@
searchApi.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).$promise.then(
//success
function( data ){
- // TEMP : add random pict
- for(var i=data.hits.length-1; i>=0; i--){
- data.hits[i].url = 'http://placekitten.com/g/' + (100+Math.floor((Math.random()*600)+1)) + '/' + (100+Math.floor((Math.random()*600)+1));
+ // Transform meta list into meta dict
+ var nb = data.hits.length;
+ for(var i=0;i<nb;i++){
+ var nb_metas = data.hits[i].metas.length;
+ data.hits[i].metas_dict = {};
+ for(var j=0;j<nb_metas;j++){
+ if(typeof data.hits[i].metas[j].images==='undefined'){
+ data.hits[i].metas_dict[data.hits[i].metas[j].name] = data.hits[i].metas[j].value;
+ }
+ else{
+ data.hits[i].metas_dict.images = data.hits[i].metas[j].images[0].value;
+ }
+ }
}
$scope.results = data;
},
@@ -26,13 +36,6 @@
alert('Erreur avec la requête', error);
}
);
-
- $scope.addItem = function(i){
- console.log('addItem',i);
- if($scope.results.hits.length>0 && 0<=i && i<$scope.results.hits.length){
-
- }
- };
})
.filter('meta', function() {
return function(input, metaName) {