Commit 1fa8ecc4 authored by Hervé Ménager's avatar Hervé Ménager

display the "Pasteur" collection.

parent 9253e754
......@@ -69,6 +69,9 @@
<li>
<a ng-href="/packages">Tools and packages</a>
</li>
<li>
<a ng-href="/pasteur">Pasteur</a>
</li>
<li>
<a ng-href="/news">News</a>
</li>
......
......@@ -40,6 +40,9 @@ angular.module('biowebEvolApp', [
resolve: {
'webOnly': function() {
return false;
},
'collection': function() {
return null;
}
},
reloadOnSearch: false
......@@ -50,6 +53,22 @@ angular.module('biowebEvolApp', [
resolve: {
'webOnly': function() {
return true;
},
'collection': function() {
return null;
}
},
reloadOnSearch: false
})
.when('/pasteur', {
templateUrl: 'views/packages.html',
controller: 'PackagesListCtrl',
resolve: {
'webOnly': function() {
return false;
},
'collection': function() {
return 'pasteur';
}
},
reloadOnSearch: false
......
......@@ -6,36 +6,64 @@ angular.module('biowebEvolApp')
$rootScope.title = 'Welcome!';
$scope.routeParams = $routeParams;
$scope.searchSources = [];
var loadPackages = function(dataPromise){
$scope.packageMatches = null;
$scope.loading=true;
dataPromise.then(function(matchesNumber){
$scope.packageMatches = matchesNumber;
$scope.loading=false;
});
};
var loadWebPackages = function(dataPromise){
$scope.webPackageMatches = null;
$scope.loading=true;
dataPromise.then(function(matchesNumber){
$scope.webPackageMatches = matchesNumber;
$scope.loading=false;
});
};
var loadData = function(dataPromise){
$scope.dataMatches = null;
$scope.loading=true;
dataPromise.then(function(matchesNumber){
$scope.dataMatches = matchesNumber;
$scope.loading=false;
});
};
var loadTopics = function(dataPromise){
$scope.topicMatches = null;
$scope.loading=true;
dataPromise.then(function(matchesNumber){
$scope.topicMatches = matchesNumber;
$scope.loading=false;
// faire une liste nommée sections
// item keys are 'name' for the key
// 'label' for the human readable title
// 'subtitle' for the subtitle
// 'loader' for the loading function
// 'icon' for the icon class
$scope.sections = [
{'name': 'topics',
'label': 'Topics',
'subtitle': 'Alignment, Structure, etc.',
'loader': function(){
return Catalog.packageTopics($routeParams.search, true);
},
'icon':'fa-question-circle'
},
{'name': 'data',
'label': 'Databanks',
'subtitle': 'Banks and Genomes',
'loader': function(){
return Catalog.banks($routeParams.search, true);
},
'icon':'fa-database'
},
{'name': 'packages',
'label': 'Tools and packages',
'subtitle': 'Available software packages',
'loader': function(){
return Catalog.searchPackages($routeParams.search, $routeParams.topicId, false, true);
},
'icon':'fa-database'
},
{'name': 'web',
'label': 'Web interfaces',
'subtitle': 'Mobyle, Galaxy',
'loader': function(){
return Catalog.searchPackages($routeParams.search, $routeParams.topicId, true, true);
},
'icon':'fa-desktop'
},
{'name': 'pasteur',
'label': 'Pasteur software',
'subtitle': 'Software from the Institut Pasteur',
'loader': function(){
return Catalog.searchPackages($routeParams.search, $routeParams.topicId, true, true);
},
'icon':'fa-compass'
},
];
$scope.matches = {};
$scope.loading = {};
var load = function(){
_.map($scope.sections, function(section){
$scope.matches[section.name] = null;
$scope.loading[section.name] = true;
section.loader().promise.then(function(matchesNumber){
$scope.matches[section.name] = matchesNumber;
$scope.loading[section.name] = false;
});
});
};
$scope.$watch('routeParams', function(newVal, oldVal) {
......@@ -53,13 +81,7 @@ angular.module('biowebEvolApp')
$location.search(k, v);
}
});
loadPackages(Catalog.searchPackages($routeParams.search, $routeParams.topicId, '', true).promise);
loadWebPackages(Catalog.searchPackages($routeParams.search, $routeParams.topicId, true, true).promise);
loadData(Catalog.banks($routeParams.search, true).promise);
loadTopics(Catalog.packageTopics($routeParams.search, true).promise);
load();
}, true);
loadPackages(Catalog.searchPackages($routeParams.search, $routeParams.topicId, '', true).promise);
loadWebPackages(Catalog.searchPackages($routeParams.search, $routeParams.topicId, true, true).promise);
loadData(Catalog.banks($routeParams.search, true).promise);
loadTopics(Catalog.packageTopics($routeParams.search, true).promise);
load();
}]);
......@@ -8,15 +8,10 @@
<strong>online catalog</strong> of bioinformatics programs and databanks available at the Institut Pasteur.
</p>
</div>
<div ng-show="loading" class="ng-hide text-center container">
<div ng-show="_.any(_.values(loading))" class="ng-hide text-center container">
<i class="fa fa-spinner fa-5x fa-spin"></i>
</div>
<div class="container" ng-if="!loading && packages.length===0">
<div class="alert alert-danger text-center" >Nothing found</div>
</div>
<div class="row col-md-12" ng-if="!loading">
<div ng-show="!_.any(_.values(loading))" class="row col-md-12">
<section class="col-md-4 col-xs-12 panel panel-info" style="height: 300px; overflow-y: scroll;">
<header>
<h2><i class="fa fa-large fa-newspaper-o"></i>&nbsp;Latest news</h2>
......@@ -24,33 +19,12 @@
<news-list limit="20"></news-list>
</section>
<section class="col-md-8 col-xs-12">
<div class="col-md-6">
<a href="/topics?search={{routeParams.search}}" class="thumbnail" ng-class="routeParams.search ? (packageMatches==0 ? 'text-muted' : 'text-match') : ''">
<h2>
<i class="fa fa-large fa-question-circle"></i>&nbsp;{{topicMatches}}&nbsp;Topics</h2>
<div>Alignment, Structure, etc.</div>
</a>
</div>
<div class="col-md-6">
<a href="/data?search={{routeParams.search}}" class="thumbnail" ng-class="routeParams.search ? (packageMatches==0 ? 'text-muted' : 'text-match') : ''">
<h2>
<i class="fa fa-large fa-database"></i>&nbsp;{{dataMatches}}&nbsp;Databanks</h2>
<div>Banks and Genomes</div>
</a>
</div>
<div class="col-md-6">
<a href="/web?search={{routeParams.search}}" class="thumbnail" ng-class="routeParams.search ? (packageMatches==0 ? 'text-muted' : 'text-match') : ''">
<h2>
<i class="fa fa-large fa-desktop"></i>&nbsp;{{webPackageMatches}}&nbsp;Web interfaces</h2>
<div>Mobyle, Galaxy</div>
</a>
</div>
<div class="col-md-6">
<a href="/packages?search={{routeParams.search}}" class="thumbnail" ng-class="routeParams.search ? (packageMatches==0 ? 'text-muted' : 'text-match') : ''">
<h2>
<i class="fa fa-large fa-wrench"></i>&nbsp;{{packageMatches}}&nbsp;Tools &amp; packages</h2>
<div>List of available software packages</div>
</a>
</div>
<div class="col-md-6" ng-repeat="section in sections">
<a href="/{{section.name}}{{routeParams.search ? '?search='+routeParams.search : ''}}" class="thumbnail" ng-class="routeParams.search ? (matches[section.name]==0 ? 'text-muted' : 'text-match') : ''">
<h2>
<i class="fa fa-large {{section.icon}}"></i>&nbsp;{{matches[section.name]}}&nbsp;{{section.label}}</h2>
<div>{{section.subtitle}}</div>
</a>
</div>
</section>
</div>
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