cms/app-client/app/mirage/config.js
changeset 134 c06d08c8a1b8
parent 127 5cd8c3065c38
child 158 366509ae2f37
equal deleted inserted replaced
133:821253d361d1 134:c06d08c8a1b8
    45         return res;
    45         return res;
    46     }, {});
    46     }, {});
    47 
    47 
    48     return {
    48     return {
    49       'lexvoids': resMap
    49       'lexvoids': resMap
       
    50     };
       
    51 
       
    52   });
       
    53 
       
    54   this.get('/bnf/:ids', function(db, request) {
       
    55 
       
    56     var bnfIds = decodeURIComponent(request.params.ids);
       
    57     var resMap = _.reduce(bnfIds.split(','), function(res, id) {
       
    58         var fullId = id;
       
    59         if(_.startsWith(fullId, constants.BNF_BASE_URL)) {
       
    60           fullId = fullId.slice(constants.BNF_BASE_URL.length);
       
    61         } else if (_.startsWith(fullId, constants.BNF_ARK_BASE_URL)) {
       
    62           fullId = fullId.slice(constants.BNF_ARK_BASE_URL.length);
       
    63         } else if (!_.startsWith(fullId, constants.BNF_ARK_BASE_ID)) {
       
    64           fullId = constants.BNF_ARK_BASE_ID + fullId;
       
    65         }
       
    66         var bnfRes = db.lexvo.find(fullId);
       
    67         res[fullId] = bnfRes?bnfRes.label:null;
       
    68         return res;
       
    69     }, {});
       
    70 
       
    71     return {
       
    72       'bnfids': resMap
    50     };
    73     };
    51 
    74 
    52   });
    75   });
    53 
    76 
    54   /*
    77   /*