Commit 57831f9c authored by luxcem's avatar luxcem

filter by url

parent 27da3807
...@@ -5,7 +5,7 @@ angular.module('soussurveillance', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSani ...@@ -5,7 +5,7 @@ angular.module('soussurveillance', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSani
.config(function ($stateProvider, $urlRouterProvider) { .config(function ($stateProvider, $urlRouterProvider) {
$stateProvider $stateProvider
.state('home', { .state('home', {
url: '/', url: '/{param}',
templateUrl: 'app/main/main.html', templateUrl: 'app/main/main.html',
controller: 'MainCtrl' controller: 'MainCtrl'
}); });
......
'use strict'; 'use strict';
angular.module('soussurveillance') angular.module('soussurveillance')
.controller('DeputesCtrl', function ($scope, $http, _, Circonscriptions, Groupes) { .controller('DeputesCtrl', function ($scope, $http, _, Circonscriptions, Groupes, $stateParams, $anchorScroll, $location) {
var deputes = []; var deputes = [];
$scope.search = { $scope.search = {
'name': '', 'name': '',
...@@ -25,7 +25,7 @@ angular.module('soussurveillance') ...@@ -25,7 +25,7 @@ angular.module('soussurveillance')
$scope.Circonscriptions = Circonscriptions; $scope.Circonscriptions = Circonscriptions;
$scope.Groupes = Groupes; $scope.Groupes = Groupes;
$http.get('assets/data/deputes_infos.json').success(function(deputesInfos){ $http.get('assets/data/deputes_infos.json').success(function(deputesInfos){
$http.get('assets/data/deputes_en_mandat.json').success(function(data){ $http.get('assets/data/deputes_en_mandat.json').success(function(data){
deputes = data.deputes; deputes = data.deputes;
...@@ -37,8 +37,18 @@ angular.module('soussurveillance') ...@@ -37,8 +37,18 @@ angular.module('soussurveillance')
} }
$scope.totalItems = data.deputes.length; $scope.totalItems = data.deputes.length;
$scope.applyPaginate(); $scope.applyPaginate();
if ($stateParams.param) {
if ($stateParams.param === 'pour') {
$scope.search.status = '2';
} else if ($stateParams.param === 'contre') {
$scope.search.status = '1';
}
$location.hash('deputes');
$anchorScroll();
$scope.applySearch();
}
}); });
}); });
$scope.selectDepute = function selectDepute(depute) { $scope.selectDepute = function selectDepute(depute) {
...@@ -103,4 +113,5 @@ angular.module('soussurveillance') ...@@ -103,4 +113,5 @@ angular.module('soussurveillance')
return 'red-mask'; return 'red-mask';
} }
}; };
}); });
<div id="deputes-block" ng-controller="DeputesCtrl"> <div id="deputes" ng-controller="DeputesCtrl">
<h1>Refusez cette loi de surveillance : Appelez vos députés</h1> <h1>Refusez cette loi de surveillance : Appelez vos députés</h1>
<form class="container-fluid"> <form class="container-fluid">
<div class="row"> <div class="row">
......
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