# HG changeset patch # User cavaliet # Date 1412325530 -7200 # Node ID 36ccc573af9a7494dd6a6f45a05c968b0fb11426 # Parent 74bbdd739878474c33339bc0187ada6e5a17833c clean search resource diff -r 74bbdd739878 -r 36ccc573af9a client/.jshintrc --- a/client/.jshintrc Thu Oct 02 13:24:57 2014 +0200 +++ b/client/.jshintrc Fri Oct 03 10:38:50 2014 +0200 @@ -3,14 +3,14 @@ "node": true, "esnext": true, "bitwise": true, - "camelcase": true, + "camelcase": false, "eqeqeq": true, "immed": true, "indent": 4, "latedef": true, "newcap": true, "noarg": true, - "quotmark": "single", + "quotmark": true, "regexp": true, "undef": true, "unused": true, diff -r 74bbdd739878 -r 36ccc573af9a client/app/app.js --- a/client/app/app.js Thu Oct 02 13:24:57 2014 +0200 +++ b/client/app/app.js Fri Oct 03 10:38:50 2014 +0200 @@ -15,8 +15,12 @@ when('/slideshow/', { controller: 'slideshowCtrl', templateUrl: 'slideshow/slideshow.html' - }). - when('/slideshow/:iSlide', { + }). + /*when('/slideshow/:iSlide', { + controller: 'slideshowCtrl', + templateUrl: 'slideshow/slideshow.html' + }).*/ + when('/slideshow/add/:searched', { controller: 'slideshowCtrl', templateUrl: 'slideshow/slideshow.html' }). @@ -40,6 +44,22 @@ // }); .config(function($logProvider){ $logProvider.debugEnabled(true); + }) + .service('searchApi', function($resource, context) { + console.log('search 4',$resource, context); + this.searchResource = function(params){ + return $resource(context.urls.searchUrl, + { + callback: 'JSON_CALLBACK' + }, + { + getJsonp: { + method: 'JSONP', + params: params, + isArray: false + } + }).getJsonp(); + }; }); })(); diff -r 74bbdd739878 -r 36ccc573af9a client/app/search/search.css --- a/client/app/search/search.css Thu Oct 02 13:24:57 2014 +0200 +++ b/client/app/search/search.css Fri Oct 03 10:38:50 2014 +0200 @@ -1,12 +1,14 @@ .item { min-height: 250px; border-bottom: 1px solid #000; +} +.item:not(:first-child){ padding-top: 10px; } .item img { max-height: 230px; } -.item p { +.item p, .item a.btn { margin: 0 0 5px; } diff -r 74bbdd739878 -r 36ccc573af9a client/app/search/search.html --- a/client/app/search/search.html Thu Oct 02 13:24:57 2014 +0200 +++ b/client/app/search/search.html Fri Oct 03 10:38:50 2014 +0200 @@ -3,7 +3,7 @@
-
+

Nom : {{ h.metas|meta:"name" }}

Description : {{ h.metas|meta:"description" }}

Classification : {{ h.metas|meta:"classification" }}

@@ -13,5 +13,9 @@

Acteurs : {{ h.metas|meta:"actors" }}

Lieux : {{ h.metas|meta:"places" }}

+
+ + +
diff -r 74bbdd739878 -r 36ccc573af9a client/app/search/search_controller.js --- a/client/app/search/search_controller.js Thu Oct 02 13:24:57 2014 +0200 +++ b/client/app/search/search_controller.js Fri Oct 03 10:38:50 2014 +0200 @@ -9,50 +9,26 @@ controller: 'searchCtrl' }); }) - .service('searchApi', function($resource, context) { - console.log('search 4',$resource, context); - this.searchResource = function(params){ - return $resource(context.urls.searchUrl, - { - callback: 'JSON_CALLBACK' - }, - { - getJsonp: { - method: 'JSONP', - params: params, - isArray: false - } - }); - }; - - }) - .service('searchModel', function(searchApi) { - console.log('search 5'); - this.searchResults = function(params){ - return searchApi.searchResource(params).getJsonp(); - }; - }) - .controller('searchCtrl', function($scope, $location, $routeParams, searchModel){ + .controller('searchCtrl', function($scope, $location, $routeParams, searchApi){ console.log('search 6',$scope, $location, $routeParams); $scope.q = $routeParams.q || ''; - searchModel.searchResults({q:$scope.q, of: 'json', synthesis: 'false', callback: 'JSON_CALLBACK'}).$promise.then( + searchApi.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).$promise.then( //success function( data ){ - console.log('SUCCESS !', data); $scope.results = data; }, //error function( error ){ - console.log('ERROR !', error); + alert('Erreur avec la requête', error); } ); - //window.myres = res; - //$scope.results = res; - //console.log('search 6-blabla', res); - console.log('search 7', $scope.q); - //$scope.search = searchModel.search; - // query = ?q=violon&of=json&synthesis=false + $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) { @@ -64,6 +40,7 @@ } i++; } + return ''; }; }); diff -r 74bbdd739878 -r 36ccc573af9a client/app/slideshow/slideshow.html --- a/client/app/slideshow/slideshow.html Thu Oct 02 13:24:57 2014 +0200 +++ b/client/app/slideshow/slideshow.html Fri Oct 03 10:38:50 2014 +0200 @@ -2,7 +2,7 @@

{{ slideshow.description }}