Commit 57831f9c authored by luxcem's avatar luxcem

filter by url

parent 27da3807
......@@ -5,7 +5,7 @@ angular.module('soussurveillance', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSani
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/',
url: '/{param}',
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
});
......
'use strict';
angular.module('soussurveillance')
.controller('DeputesCtrl', function ($scope, $http, _, Circonscriptions, Groupes) {
.controller('DeputesCtrl', function ($scope, $http, _, Circonscriptions, Groupes, $stateParams, $anchorScroll, $location) {
var deputes = [];
$scope.search = {
'name': '',
......@@ -25,7 +25,7 @@ angular.module('soussurveillance')
$scope.Circonscriptions = Circonscriptions;
$scope.Groupes = Groupes;
$http.get('assets/data/deputes_infos.json').success(function(deputesInfos){
$http.get('assets/data/deputes_en_mandat.json').success(function(data){
deputes = data.deputes;
......@@ -37,8 +37,18 @@ angular.module('soussurveillance')
}
$scope.totalItems = data.deputes.length;
$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) {
......@@ -103,4 +113,5 @@ angular.module('soussurveillance')
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>
<form class="container-fluid">
<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