Makes album display a bit nicer
This commit is contained in:
@@ -1,11 +1,32 @@
|
||||
var services = angular.module('satbd.satellite.bar.services',[])
|
||||
|
||||
services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
|
||||
var determinantRegexp = /^(.*) \(([Ll][eas']+)\)$/;
|
||||
|
||||
var removeSerie = /^\(.*\) .*$/;
|
||||
|
||||
function cleanupName(name) {
|
||||
matches = name.match(determinantRegexp);
|
||||
if (matches == null) {
|
||||
return name;
|
||||
}
|
||||
return matches[2] + ' ' + matches[1];
|
||||
}
|
||||
|
||||
function cleanupFields(album) {
|
||||
album.serie = album.série;
|
||||
album.série = undefined;
|
||||
album.editeur = album.éditeur;
|
||||
album.éditeur = undefined;
|
||||
if (removeSerie.test(album.serie) == true) {
|
||||
album.serieDisplay = '';
|
||||
} else {
|
||||
album.serieDisplay = cleanupName(album.serie);
|
||||
if ( album.Num > -1 ) {
|
||||
album.serieDisplay += ' ' + album.Num;
|
||||
}
|
||||
}
|
||||
album.titleDisplay = cleanupName(album.titre);
|
||||
return album;
|
||||
}
|
||||
function get(id) {
|
||||
|
||||
Reference in New Issue
Block a user