/**
 * @author Jose A. Dianes <jdianes@ebi.ac.uk>
 *
 * The prc-cluster-list-filters directive allows us to reuse a spectra visualisations using SpeckTackle.
 *
 */

var clusterListFiltersDirective = angular.module('prideClusterApp.clusterListFiltersDirective', [])

clusterListFiltersDirective.directive('prcClusterListFilters', function() {
    return {
        restrict: 'E',
        scope: {

        },
        controller: "ClusterListFiltersCtrl",
        templateUrl: 'components/directives/clusterListFilters-directive/clusterListFilters-directive.html'
    };
});

clusterListFiltersDirective.controller('ClusterListFiltersCtrl', ['$scope', '$routeParams', '$location',
    function($scope, $routeParams, $location) {

        function updateState(view) {
            // Set location (URL)
            $location.path(view);
            $location.search({
                q:$routeParams.q,
                page:$routeParams.page,
                size:$routeParams.size
            });
        }

        // attach filter-submit function
        $scope.listSubmit = function() {
            updateState("/list");
        }

        $scope.chartSubmit = function() {
            updateState("/chart");
        }

    }
]);



/**
 * @author Jose A. Dianes <jdianes@ebi.ac.uk>
 *
 * The prc-cluster-list-filters directive allows us to reuse a spectra visualisations using SpeckTackle.
 *
 */

var clusterListFiltersDirective = angular.module('prideClusterApp.clusterListFiltersDirective', [])

clusterListFiltersDirective.directive('prcClusterListFilters', function() {
    return {
        restrict: 'E',
        scope: {

        },
        controller: "ClusterListFiltersCtrl",
        templateUrl: 'components/directives/clusterListFilters-directive/clusterListFilters-directive.html'
    };
});

clusterListFiltersDirective.controller('ClusterListFiltersCtrl', ['$scope', '$routeParams', '$location',
    function($scope, $routeParams, $location) {

        function updateState(view) {
            // Set location (URL)
            $location.path(view);
            $location.search({
                q:$routeParams.q,
                page:$routeParams.page,
                size:$routeParams.size
            });
        }

        // attach filter-submit function
        $scope.listSubmit = function() {
            updateState("list");
        }

        $scope.chartSubmit = function() {
            updateState("chart");
        }

    }
]);



Solve navigation problem when you are in list view and pres the button to come back to view (before it was to home)
Solve navigation problem when you are in list view and pres the button to come back to view (before it was to home)
