Socket
Socket
Sign inDemoInstall

ng-daia

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-daia - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

bower.json

12

demo/app.js

@@ -1,4 +0,3 @@

var app = angular.module('myApp', ['ngDAIA', 'pascalprecht.translate']);
app.config(['$translateProvider', function ($translateProvider) {
angular.module('myApp', ['ngDAIA', 'pascalprecht.translate'])
.config(['$translateProvider', function ($translateProvider) {
$translateProvider.useStaticFilesLoader({

@@ -13,6 +12,7 @@ prefix: '../src/translations/lang-',

$translateProvider.determinePreferredLanguage();
}]);
}])
.controller('myController', ['$translate', '$scope', '$http', 'ngDAIA.version',
function ($translate, $scope, $http, version) {
$scope.version = version;
app.controller('myController', ['$translate', '$scope', '$http',
function ($translate, $scope, $http) {
$scope.myAPI = "//daia.gbv.de/";

@@ -19,0 +19,0 @@ $scope.myID = "opac-de-ma9:ppn:685460711";

@@ -10,29 +10,10 @@ 'use strict';

grunt.loadNpmTasks('grunt-ngdocs');
grunt.loadNpmTasks('grunt-ngmin');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-git-is-clean');
grunt.initConfig({
pkg: require('./package.json'),
version: {
moduleVersion: {
options: {
prefix: "\\('version',\\s*'"
},
src: ['src/ng-daia.js']
},
},
template: {
index: {
options: {
data: function() {
return grunt.config.get('pkg');
}
},
files: {
'src/index.ngdoc': ['src/index.ngdoc.tpl']
}
}
},
ngdocs: {

@@ -42,5 +23,4 @@ options: {

titleLink: '#/api',
startPage: '/api',
navTemplate: 'src/docs-nav.html',
scripts: [
scripts: [
'angular.js',

@@ -51,13 +31,19 @@ 'ng-daia.min.js',

api: {
title: 'API documentation',
title: 'Documentation',
src: [
'src/*.js',
'src/**/*.js',
'src/*.ngdoc',
'*.ngdoc',
],
},
},
connect: {
options: {
keepalive: true
},
server: {}
},
clean: ['docs'],
karma: {
unit: {
unit: {
configFile: 'karma.conf.js',

@@ -75,8 +61,2 @@ keepalive: true,

},
concat: {
dist: {
src: ['src/*.js','src/**/*.js','ng-daia-templates.js'],
dest: 'ng-daia.js',
},
},
ngtemplates: {

@@ -86,3 +66,3 @@ app: {

src: '**.html',
dest: 'ng-daia-templates.js',
dest: 'templates.js',
},

@@ -99,6 +79,16 @@ options: {

},
ngmin: {
concat: {
dist: {
src: [
'src/*.js','src/**/*.js',
'templates.js'
],
dest: 'ng-daia.js',
},
},
ngAnnotate: {
angular: {
src: ['ng-daia.js'],
dest: 'ng-daia.js',
files: {
'ng-daia.js': ['ng-daia.js']
}
}

@@ -117,5 +107,28 @@ },

},
// update/bump version number in package and source files
version: {
bump: {
src: ['package.json', 'bower.json'],
},
module: {
options: {
prefix: "\\('ngDAIA.version',\\s*'"
},
src: ['src/ng-daia.js'],
},
},
// release to npmjs and GitHub
release: {
options: {
bump: false,
commit: false
}
},
shell: {
maps: {
command: "cp lib/1.2.7/*.map docs/js; cp ng-daia.js docs/grunt-scripts"
prepare_ngdocs: {
command: [
'cp src/index.ngdoc.tpl index.ngdoc',
'cat README.md >> index.ngdoc',
'cp CONTRIBUTING.md contributing.ngdoc'
].join('&&')
},

@@ -125,23 +138,18 @@ demo: {

"rm -rf docs/demo",
"cp -Lr demo docs",
"cp ng-daia.js docs/grunt-scripts",
"mkdir docs/src && cp -r src/translations/ docs/src",
"cp lib/angular-translate* docs/grunt-scripts",
"perl -pi -e 's|<script src=\"\\.\\./src.+|<script src=\"../grunt-scripts/ng-daia.js\"></script>|' docs/demo/*.html",
"perl -pi -e 's|<script src=\"\\.\\./lib|<script src=\"../grunt-scripts|' docs/demo/*.html"
"cp -r demo docs",
"find docs/demo -type l -exec rm '{}' ';'",
"mkdir -p docs/grunt-scripts",
"cp ng-daia.js docs/grunt-scripts/",
"cp node_modules/angular-translate/dist/angular-translate.min.js docs/grunt-scripts",
"cp node_modules/angular-translate/dist/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js docs/grunt-scripts",
"cp ng-daia.css docs",
"perl -pi -e 's|<script src=\"\\.\\./src.+|<script src=\"../grunt-scripts/ng-daia.js\"></script>|' docs/demo/*.html",
"perl -pi -e 's|<script src=\"\\.\\./node_modules/angular-translate/dist/([a-z-]+/)?|<script src=\"../grunt-scripts/|' docs/demo/*.html",
"mkdir -p docs/src",
"cp -r src/translations docs/src"
].join('&&')
},
site: {
command: "rm -rf site && mkdir site && cp -r docs/* site"
},
working_copy_must_be_clean: {
command: "if git status --porcelain 2>/dev/null | grep -q .; then exit 1; fi",
options: { failOnError: true }
},
push_site: {
command: "git push origin gh-pages",
options: { failOnError: true }
},
gh_pages: {
command: [
'rm -rf site && mkdir site && cp -r docs/* site',
'git checkout gh-pages',

@@ -160,2 +168,6 @@ 'git pull origin gh-pages',

}
},
push_gh_pages: {
command: "git push origin gh-pages",
options: { failOnError: true }
}

@@ -166,9 +178,13 @@ }

grunt.registerTask('default',['docs']);
grunt.registerTask('ng-daia',['version','ngtemplates','concat','ngmin','uglify']);
grunt.registerTask('docs',['clean','ng-daia','template','ngdocs','shell:maps','shell:demo']);
grunt.registerTask('gh-pages', ['test','shell:working_copy_must_be_clean','site','shell:gh_pages']);
grunt.registerTask('push-site', ['gh-pages','shell:push_site']);
grunt.registerTask('build',['version','ngtemplates','concat','ngAnnotate','uglify']);
grunt.registerTask('test',['karma:unit']);
grunt.registerTask('publish',['build','git-is-clean','test','release','homepage']);
grunt.registerTask('docs',['clean','build','shell:prepare_ngdocs','ngdocs','shell:demo']);
grunt.registerTask('gh-pages', ['test','git-is-clean','shell:gh_pages']);
grunt.registerTask('homepage', ['gh-pages','git-is-clean','shell:push_gh_pages']);
grunt.registerTask('site', ['docs','shell:site']);
grunt.registerTask('test',['karma:unit']);
grunt.registerTask('watch',['karma:watch']);
};
module.exports = function(config) {
config.set({
files: [
'lib/angular.min.js',
'lib/angular-mocks.js',
'src/*.js',
'src/**/*.js',
'node_modules/angular/angular.min.js',
'node_modules/angular-mocks/angular-mocks.js',
'ng-daia.js',
'test/**/*.js',

@@ -9,0 +8,0 @@ ],

@@ -7,3 +7,3 @@ /**

*
* The <b>ngDAIA</b> module for AngularJS facilitates access to
* The **ngDAIA** module for AngularJS facilitates access to
* {@link http://purl.org/NET/DAIA Document Availability Information API}

@@ -27,6 +27,6 @@ * (DAIA) services and to display the responses given by a DAIA server.

* response, document, or item into simple availability status.
*
*/
var ngDAIA = angular.module('ngDAIA', []);
ngDAIA.value('version', '0.1.2');
angular.module('ngDAIA',[])
.value('ngDAIA.version', '0.1.3');
'use strict';

@@ -69,51 +69,44 @@ /**

*/
ngDAIA.directive('daiaApi', [
'$http',
'$filter',
function ($http, $filter) {
angular.module('ngDAIA')
.directive('daiaApi',["$http", "$filter", function($http,$filter){
return {
restrict: 'A',
scope: {
api: '@daiaApi',
id: '@daiaId',
filter: '@daiaFilter'
},
templateUrl: function (elem, attrs) {
if (attrs.templateUrl) {
return attrs.templateUrl;
} else {
return attrs.daiaFilter == 'daiaSimple' ? 'template/daia-simple.html' : 'template/daia-response.html';
}
},
link: function link(scope, element, attr) {
scope.daiaRequest = function () {
$http.jsonp(scope.api, {
params: {
id: scope.id,
format: 'json',
callback: 'JSON_CALLBACK'
}
}).success(function (response) {
if (scope.filter) {
var filtered = $filter(scope.filter)(response);
// FIXME: purge existing variables from scope
angular.forEach(filtered, function (value, key) {
scope[key] = value;
});
restrict: 'A',
scope: {
api: '@daiaApi',
id: '@daiaId',
filter: '@daiaFilter',
},
templateUrl: function(elem, attrs) {
if (attrs.templateUrl) {
return attrs.templateUrl;
} else {
scope.daia = response;
return attrs.daiaFilter == 'daiaSimple'
? 'template/daia-simple.html'
: 'template/daia-response.html';
}
});
};
// TODO: don't call twice
scope.$watch('api', function () {
scope.daiaRequest();
});
scope.$watch('id', function () {
scope.daiaRequest();
});
}
},
link: function link(scope, element, attr) {
scope.daiaRequest = function() {
$http.jsonp( scope.api, {
params: { id: scope.id, format:'json', callback:'JSON_CALLBACK' } }
).success(function(response) {
if (scope.filter) {
var filtered = $filter(scope.filter)(response);
// FIXME: purge existing variables from scope
angular.forEach(filtered,
function(value, key) { scope[key] = value }
);
} else {
scope.daia = response;
}
});
};
// TODO: don't call twice
scope.$watch('api',function(){ scope.daiaRequest() });
scope.$watch('id',function(){ scope.daiaRequest() });
}
};
}
]);
}]);
'use strict';

@@ -148,19 +141,24 @@ /**

*/
ngDAIA.directive('daiaAvailability', function () {
return {
restrict: 'A',
scope: { item: '=daiaAvailability' },
templateUrl: function (elem, attrs) {
return attrs.templateUrl ? attrs.templateUrl : 'template/daia-availability.html';
},
link: function (scope, elem, attrs) {
if (scope.item.available && scope.item.available.length) {
scope.available = scope.item.available;
}
if (scope.item.unavailable && scope.item.unavailable.length) {
scope.unavailable = scope.item.unavailable;
}
angular.module('ngDAIA')
.directive('daiaAvailability',function(){
return {
restrict: 'A',
scope: {
item: '=daiaAvailability',
},
templateUrl: function(elem, attrs) {
return attrs.templateUrl ?
attrs.templateUrl : 'template/daia-availability.html';
},
link: function(scope, elem, attrs) {
if (scope.item.available && scope.item.available.length) {
scope.available = scope.item.available;
}
if (scope.item.unavailable && scope.item.unavailable.length) {
scope.unavailable = scope.item.unavailable;
}
}
}
};
});
'use strict';

@@ -193,11 +191,16 @@ /**

*/
ngDAIA.directive('daiaItem', function () {
return {
restrict: 'A',
scope: { item: '=daiaItem' },
templateUrl: function (elem, attrs) {
return attrs.templateUrl ? attrs.templateUrl : 'template/daia-item.html';
angular.module('ngDAIA')
.directive('daiaItem',function(){
return {
restrict: 'A',
scope: {
item: '=daiaItem',
},
templateUrl: function(elem, attrs) {
return attrs.templateUrl ?
attrs.templateUrl : 'template/daia-item.html';
},
}
};
});
'use strict';

@@ -230,30 +233,25 @@ /**

*/
ngDAIA.directive('daiaSimple', [
'$filter',
function ($filter) {
angular.module('ngDAIA')
.directive('daiaSimple',["$filter", function($filter){
return {
restrict: 'A',
scope: { daia: '=daiaSimple' },
templateUrl: function (elem, attrs) {
return attrs.templateUrl ? attrs.templateUrl : 'template/daia-simple.html';
},
link: function (scope, elem, attrs) {
scope.$watch('daia', function () {
var simple = $filter('daiaSimple')(scope.daia);
angular.forEach([
'service',
'available',
'expected',
'delay',
'href',
'limitation',
'queue'
], function (key) {
scope[key] = simple[key];
});
});
}
};
}
]);
restrict: 'A',
scope: {
daia: '=daiaSimple',
},
templateUrl: function(elem, attrs) {
return attrs.templateUrl ?
attrs.templateUrl : 'template/daia-simple.html';
},
link: function(scope, elem, attrs) {
scope.$watch('daia',function(){
var simple = $filter('daiaSimple')(scope.daia);
angular.forEach(
['service','available','expected','delay','href','limitation','queue'],
function(key) { scope[key] = simple[key]; }
);
});
}
}
}]);
'use strict';

@@ -292,108 +290,112 @@ /**

*/
ngDAIA.filter('daiaSimple', function () {
return function (input, option) {
var services = [
'openaccess',
'loan',
'presentation'
];
angular.module('ngDAIA')
.filter('daiaSimple', function() {
return function(input, option) {
var services = ['openaccess','loan','presentation'];
// collect list of items
var items = [];
if (angular.isObject(input)) {
if (angular.isArray(input.document)) {
angular.forEach(input.document, function (document) {
angular.forEach(document.item, function (item) {
items.push(item);
});
});
} else if (angular.isArray(input.item)) {
angular.forEach(input.item, function (item) {
items.push(item);
});
} else {
items.push(input);
}
if (angular.isArray(input.document)) {
angular.forEach(input.document,function(document) {
angular.forEach(document.item,function(item) {
items.push(item);
});
});
} else if (angular.isArray(input.item)) {
angular.forEach(input.item,function(item) {
items.push(item);
});
} else {
items.push(input);
}
}
// default DAIA simple response
var response = {
service: 'none',
service: "none",
available: false
};
};
// find any item with available openaccess
// otherwise find any item with available loan
// otherwise find any item with available presentation
if (services.some(function (service) {
return items.some(function (item) {
var a = angular.isArray(item.available) ? item.available : [];
return a.some(function (available) {
if (available.service != service) {
return;
}
response.available = true;
[
'service',
'href',
'limitation',
'delay'
].forEach(function (key) {
var value = available[key];
if (value || value == 0) {
response[key] = value;
}
if ( services.some(function (service) {
return items.some( function (item) {
var a = angular.isArray(item.available) ? item.available : [];
return a.some( function (available) {
if (available.service != service) {
return;
}
response.available = true;
['service','href','limitation','delay'].forEach(function (key) {
var value = available[key];
if ( value || value == 0 ) { response[key] = value; }
});
if (response.limitation) {
response.limitation = response.limitation[0].content;
}
return true;
});
if (response.limitation) {
response.limitation = response.limitation[0].content;
}
return true;
});
});
})) {
return response;
})) {
return response;
}
// otherwise find item that is next expected
var expect;
items.forEach(function (item) {
var a = angular.isArray(item.unavailable) ? item.unavailable : [];
a.forEach(function (unavail) {
// any expected openaccess, loan, or presentation
var uexp = unavail.expected;
if (services.indexOf(unavail.service) != -1 && uexp) {
if (!expect || expect == 'unknown' || uexp != 'unknown' && uexp < expect) {
[
'service',
'href',
'limitation',
'expected',
'queue'
].forEach(function (key) {
var value = unavail[key];
if (value || value == 0) {
response[key] = value;
}
});
if (response.limitation) {
response.limitation = response.limitation[0].content;
items.forEach( function (item) {
var a = angular.isArray(item.unavailable) ? item.unavailable : [];
a.forEach( function (unavail) {
// any expected openaccess, loan, or presentation
var uexp = unavail.expected;
if (services.indexOf(unavail.service) != -1 && uexp) {
if (!expect || expect == "unknown" ||
(uexp != "unknown" && uexp < expect)) {
['service','href','limitation','expected','queue'].forEach(function (key) {
var value = unavail[key];
if ( value || value == 0 ) { response[key] = value; }
});
if (response.limitation) {
response.limitation = response.limitation[0].content;
}
}
}
}
}
});
});
});
if (expect) {
return response;
return response;
}
// otherwise find any additional href or limitation
services.some(function (service) {
// TODO!!!
});
return response;
};
return response;
}
});
angular.module('ngDAIA').run([
'$templateCache',
function ($templateCache) {
'use strict';
$templateCache.put('template/daia-availability.html', '<ul class="availability" ng-if="available || unavailable"><li ng-if="available" ng-repeat="a in available"><span class="service-label" translate="{{a.service}}">{{a.service}}</span> <span class="availability availability-available" translate="available">available</span> <span class="availability availability-limitation" ng-if="a.limitation">({{a.limitation[0].content}})</span></li><li ng-if="unavailable" ng-repeat="u in unavailable"><span class="service-label" ng-if="u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="u.expected" class="availability availability-expected" translate="expected">expected</span> <span class="service-label" ng-if="!u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="!u.expected" class="availability availability-unavailable" translate="unavailable">unavailable</span></li><div class="returning"><li ng-if="unavailable[0].href && unavailable[0].expected"><div ng-if="unavailable[0].expected" class="returning returning-expected"><span translate="EXPECTED_BACK">expected back:</span> {{unavailable[0].expected}}</div><a href="{{unavailable[0].href}}" translate="RESERVATION">place reservation</a></li></div></ul><div class="access" ng-if="((available[1].service || available[0].service) == \'openaccess\' || unavailable[0].service == \'openaccess\')"><span translate="ACCESS">access via:</span> <a ng-if="available[1].service == \'openaccess\'" href="{{available[1].href}}">{{available[1].href}}</a> <a ng-if="unavailable[0].service == \'openaccess\'" href="{{unavailable[0].href}}">{{available[0].href}}</a></div>');
$templateCache.put('template/daia-item.html', '<div ng-if="item.department"><span class="daia-label" translate="DEPARTMENT">Department:</span> <a ng-if="item.department.href" href="{{item.department.href}}">{{item.department.content}}</a> <span ng-if="!item.department.href">{{item.department.content}}</span></div><div ng-if="item.label"><span class="daia-label" translate="SIGNATURE">Shelf mark:</span> {{item.label}}</div><span ng-if="!item.available && !item.unavailable" class="daia-label" translate="AVAILABILITY">Availability:</span> <span ng-if="!item.available && !item.unavailable" translate="unknown">unknown</span><div daia-availability="item"></div>');
$templateCache.put('template/daia-response.html', '<div class="daia-result"><div ng-if="daia.institution.content"><span class="daia-label" translate="INSTITUTION">institution:</span> <a ng-if="daia.institution.href" href="{{daia.institution.href}}">{{daia.institution.content}}</a></div><div ng-if="daia.document[0].href"><span class="daia-label" translate="DOCUMENT">document:</span> <a translate="CATALOG_ENTRY" href="{{daia.document[0].href}}">Catalog entry</a></div><div><span ng-if="!daia.document" translate="NO_RECORDS">no records found</span></div><div ng-if="daia.document" daia-documents="daia.document"><div class="daia-document" ng-repeat="i in daia.document[0].item"><div daia-item="i"></div></div></div></div>');
$templateCache.put('template/daia-simple.html', '<span ng-if="available"><span ng-switch="service"><span ng-switch-when="openaccess"><span class="availability-available">frei verf\xfcgbar</span> <a ng-if="href" href="{{href}}">aufrufen</a></span> <span ng-switch-when="loan"><span class="availability-available">ausleihbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-when="presentation"><span class="availability-available">vor Ort verf\xfcgbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-default=""><span class="availability-available">verf\xfcgbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span></span> <span ng-if="delay">(Wartezeit<span ng-if="delay != \'unknown\'">etwa {{delay}}</span>)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span> <span ng-if="!available"><span class="availability-unavailable"><span ng-if="expected">momentan</span> nicht verf\xfcgbar</span> <span ng-if="expected && expected != \'unknown\'">bis voraussichtlich {{expected}}</span> <span ng-if="href"><a href="{{href}}">vormerken</a></span> <span ng-if="queue">({{queue}} Vormerkungen)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span>');
}
]);
angular.module('ngDAIA').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('template/daia-availability.html',
"<ul class=\"availability\" ng-if=\"available || unavailable\"><li ng-if=\"available\" ng-repeat=\"a in available\"><span class=\"service-label\" translate=\"{{a.service}}\">{{a.service}}</span> <span class=\"availability availability-available\" translate=\"available\">available</span> <span class=\"availability availability-limitation\" ng-if=\"a.limitation\">({{a.limitation[0].content}})</span></li><li ng-if=\"unavailable\" ng-repeat=\"u in unavailable\"><span class=\"service-label\" ng-if=\"u.expected\" translate=\"{{u.service}}\">{{u.service}}</span> <span ng-if=\"u.expected\" class=\"availability availability-expected\" translate=\"expected\">expected</span> <span class=\"service-label\" ng-if=\"!u.expected\" translate=\"{{u.service}}\">{{u.service}}</span> <span ng-if=\"!u.expected\" class=\"availability availability-unavailable\" translate=\"unavailable\">unavailable</span></li><div class=\"returning\"><li ng-if=\"unavailable[0].href && unavailable[0].expected\"><div ng-if=\"unavailable[0].expected\" class=\"returning returning-expected\"><span translate=\"EXPECTED_BACK\">expected back:</span> {{unavailable[0].expected}}</div><a href=\"{{unavailable[0].href}}\" translate=\"RESERVATION\">place reservation</a></li></div></ul><div class=\"access\" ng-if=\"((available[1].service || available[0].service) == 'openaccess' || unavailable[0].service == 'openaccess')\"><span translate=\"ACCESS\">access via:</span> <a ng-if=\"available[1].service == 'openaccess'\" href=\"{{available[1].href}}\">{{available[1].href}}</a> <a ng-if=\"unavailable[0].service == 'openaccess'\" href=\"{{unavailable[0].href}}\">{{available[0].href}}</a></div>"
);
$templateCache.put('template/daia-item.html',
"<div ng-if=\"item.department\"><span class=\"daia-label\" translate=\"DEPARTMENT\">Department:</span> <a ng-if=\"item.department.href\" href=\"{{item.department.href}}\">{{item.department.content}}</a> <span ng-if=\"!item.department.href\">{{item.department.content}}</span></div><div ng-if=\"item.label\"><span class=\"daia-label\" translate=\"SIGNATURE\">Shelf mark:</span> {{item.label}}</div><span ng-if=\"!item.available && !item.unavailable\" class=\"daia-label\" translate=\"AVAILABILITY\">Availability:</span> <span ng-if=\"!item.available && !item.unavailable\" translate=\"unknown\">unknown</span><div daia-availability=\"item\"></div>"
);
$templateCache.put('template/daia-response.html',
"<div class=\"daia-result\"><div ng-if=\"daia.institution.content\"><span class=\"daia-label\" translate=\"INSTITUTION\">institution:</span> <a ng-if=\"daia.institution.href\" href=\"{{daia.institution.href}}\">{{daia.institution.content}}</a></div><div ng-if=\"daia.document[0].href\"><span class=\"daia-label\" translate=\"DOCUMENT\">document:</span> <a translate=\"CATALOG_ENTRY\" href=\"{{daia.document[0].href}}\">Catalog entry</a></div><div><span ng-if=\"!daia.document\" translate=\"NO_RECORDS\">no records found</span></div><div ng-if=\"daia.document\" daia-documents=\"daia.document\"><div class=\"daia-document\" ng-repeat=\"i in daia.document[0].item\"><div daia-item=\"i\"></div></div></div></div>"
);
$templateCache.put('template/daia-simple.html',
"<span ng-if=\"available\"><span ng-switch=\"service\"><span ng-switch-when=\"openaccess\"><span class=\"availability-available\">frei verfügbar</span> <a ng-if=\"href\" href=\"{{href}}\">aufrufen</a></span> <span ng-switch-when=\"loan\"><span class=\"availability-available\">ausleihbar</span> <a ng-if=\"href\" href=\"{{href}}\">bestellen</a></span> <span ng-switch-when=\"presentation\"><span class=\"availability-available\">vor Ort verfügbar</span> <a ng-if=\"href\" href=\"{{href}}\">bestellen</a></span> <span ng-switch-default><span class=\"availability-available\">verfügbar</span> <a ng-if=\"href\" href=\"{{href}}\">bestellen</a></span></span> <span ng-if=\"delay\">(Wartezeit<span ng-if=\"delay != 'unknown'\">etwa {{delay}}</span>)</span> <span ng-if=\"limitation\">| <span class=\"daia-limitation\">{{limitation}}</span></span></span> <span ng-if=\"!available\"><span class=\"availability-unavailable\"><span ng-if=\"expected\">momentan</span> nicht verfügbar</span> <span ng-if=\"expected && expected != 'unknown'\">bis voraussichtlich {{expected}}</span> <span ng-if=\"href\"><a href=\"{{href}}\">vormerken</a></span> <span ng-if=\"queue\">({{queue}} Vormerkungen)</span> <span ng-if=\"limitation\">| <span class=\"daia-limitation\">{{limitation}}</span></span></span>"
);
}]);

@@ -1,1 +0,1 @@

var ngDAIA=angular.module("ngDAIA",[]);ngDAIA.value("version","0.1.2"),ngDAIA.directive("daiaApi",["$http","$filter",function($http,$filter){return{restrict:"A",scope:{api:"@daiaApi",id:"@daiaId",filter:"@daiaFilter"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"daiaSimple"==attrs.daiaFilter?"template/daia-simple.html":"template/daia-response.html"},link:function(scope){scope.daiaRequest=function(){$http.jsonp(scope.api,{params:{id:scope.id,format:"json",callback:"JSON_CALLBACK"}}).success(function(response){if(scope.filter){var filtered=$filter(scope.filter)(response);angular.forEach(filtered,function(value,key){scope[key]=value})}else scope.daia=response})},scope.$watch("api",function(){scope.daiaRequest()}),scope.$watch("id",function(){scope.daiaRequest()})}}}]),ngDAIA.directive("daiaAvailability",function(){return{restrict:"A",scope:{item:"=daiaAvailability"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-availability.html"},link:function(scope){scope.item.available&&scope.item.available.length&&(scope.available=scope.item.available),scope.item.unavailable&&scope.item.unavailable.length&&(scope.unavailable=scope.item.unavailable)}}}),ngDAIA.directive("daiaItem",function(){return{restrict:"A",scope:{item:"=daiaItem"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-item.html"}}}),ngDAIA.directive("daiaSimple",["$filter",function($filter){return{restrict:"A",scope:{daia:"=daiaSimple"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-simple.html"},link:function(scope){scope.$watch("daia",function(){var simple=$filter("daiaSimple")(scope.daia);angular.forEach(["service","available","expected","delay","href","limitation","queue"],function(key){scope[key]=simple[key]})})}}}]),ngDAIA.filter("daiaSimple",function(){return function(input){var services=["openaccess","loan","presentation"],items=[];angular.isObject(input)&&(angular.isArray(input.document)?angular.forEach(input.document,function(document){angular.forEach(document.item,function(item){items.push(item)})}):angular.isArray(input.item)?angular.forEach(input.item,function(item){items.push(item)}):items.push(input));var response={service:"none",available:!1};if(services.some(function(service){return items.some(function(item){var a=angular.isArray(item.available)?item.available:[];return a.some(function(available){return available.service==service?(response.available=!0,["service","href","limitation","delay"].forEach(function(key){var value=available[key];(value||0==value)&&(response[key]=value)}),response.limitation&&(response.limitation=response.limitation[0].content),!0):void 0})})}))return response;var expect;return items.forEach(function(item){var a=angular.isArray(item.unavailable)?item.unavailable:[];a.forEach(function(unavail){var uexp=unavail.expected;-1!=services.indexOf(unavail.service)&&uexp&&(!expect||"unknown"==expect||"unknown"!=uexp&&expect>uexp)&&(["service","href","limitation","expected","queue"].forEach(function(key){var value=unavail[key];(value||0==value)&&(response[key]=value)}),response.limitation&&(response.limitation=response.limitation[0].content))})}),expect?response:(services.some(function(){}),response)}}),angular.module("ngDAIA").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("template/daia-availability.html",'<ul class="availability" ng-if="available || unavailable"><li ng-if="available" ng-repeat="a in available"><span class="service-label" translate="{{a.service}}">{{a.service}}</span> <span class="availability availability-available" translate="available">available</span> <span class="availability availability-limitation" ng-if="a.limitation">({{a.limitation[0].content}})</span></li><li ng-if="unavailable" ng-repeat="u in unavailable"><span class="service-label" ng-if="u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="u.expected" class="availability availability-expected" translate="expected">expected</span> <span class="service-label" ng-if="!u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="!u.expected" class="availability availability-unavailable" translate="unavailable">unavailable</span></li><div class="returning"><li ng-if="unavailable[0].href && unavailable[0].expected"><div ng-if="unavailable[0].expected" class="returning returning-expected"><span translate="EXPECTED_BACK">expected back:</span> {{unavailable[0].expected}}</div><a href="{{unavailable[0].href}}" translate="RESERVATION">place reservation</a></li></div></ul><div class="access" ng-if="((available[1].service || available[0].service) == \'openaccess\' || unavailable[0].service == \'openaccess\')"><span translate="ACCESS">access via:</span> <a ng-if="available[1].service == \'openaccess\'" href="{{available[1].href}}">{{available[1].href}}</a> <a ng-if="unavailable[0].service == \'openaccess\'" href="{{unavailable[0].href}}">{{available[0].href}}</a></div>'),$templateCache.put("template/daia-item.html",'<div ng-if="item.department"><span class="daia-label" translate="DEPARTMENT">Department:</span> <a ng-if="item.department.href" href="{{item.department.href}}">{{item.department.content}}</a> <span ng-if="!item.department.href">{{item.department.content}}</span></div><div ng-if="item.label"><span class="daia-label" translate="SIGNATURE">Shelf mark:</span> {{item.label}}</div><span ng-if="!item.available && !item.unavailable" class="daia-label" translate="AVAILABILITY">Availability:</span> <span ng-if="!item.available && !item.unavailable" translate="unknown">unknown</span><div daia-availability="item"></div>'),$templateCache.put("template/daia-response.html",'<div class="daia-result"><div ng-if="daia.institution.content"><span class="daia-label" translate="INSTITUTION">institution:</span> <a ng-if="daia.institution.href" href="{{daia.institution.href}}">{{daia.institution.content}}</a></div><div ng-if="daia.document[0].href"><span class="daia-label" translate="DOCUMENT">document:</span> <a translate="CATALOG_ENTRY" href="{{daia.document[0].href}}">Catalog entry</a></div><div><span ng-if="!daia.document" translate="NO_RECORDS">no records found</span></div><div ng-if="daia.document" daia-documents="daia.document"><div class="daia-document" ng-repeat="i in daia.document[0].item"><div daia-item="i"></div></div></div></div>'),$templateCache.put("template/daia-simple.html",'<span ng-if="available"><span ng-switch="service"><span ng-switch-when="openaccess"><span class="availability-available">frei verfügbar</span> <a ng-if="href" href="{{href}}">aufrufen</a></span> <span ng-switch-when="loan"><span class="availability-available">ausleihbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-when="presentation"><span class="availability-available">vor Ort verfügbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-default=""><span class="availability-available">verfügbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span></span> <span ng-if="delay">(Wartezeit<span ng-if="delay != \'unknown\'">etwa {{delay}}</span>)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span> <span ng-if="!available"><span class="availability-unavailable"><span ng-if="expected">momentan</span> nicht verfügbar</span> <span ng-if="expected && expected != \'unknown\'">bis voraussichtlich {{expected}}</span> <span ng-if="href"><a href="{{href}}">vormerken</a></span> <span ng-if="queue">({{queue}} Vormerkungen)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span>')}]);
angular.module("ngDAIA",[]).value("ngDAIA.version","0.1.3"),angular.module("ngDAIA").directive("daiaApi",["$http","$filter",function($http,$filter){return{restrict:"A",scope:{api:"@daiaApi",id:"@daiaId",filter:"@daiaFilter"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"daiaSimple"==attrs.daiaFilter?"template/daia-simple.html":"template/daia-response.html"},link:function(scope){scope.daiaRequest=function(){$http.jsonp(scope.api,{params:{id:scope.id,format:"json",callback:"JSON_CALLBACK"}}).success(function(response){if(scope.filter){var filtered=$filter(scope.filter)(response);angular.forEach(filtered,function(value,key){scope[key]=value})}else scope.daia=response})},scope.$watch("api",function(){scope.daiaRequest()}),scope.$watch("id",function(){scope.daiaRequest()})}}}]),angular.module("ngDAIA").directive("daiaAvailability",function(){return{restrict:"A",scope:{item:"=daiaAvailability"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-availability.html"},link:function(scope){scope.item.available&&scope.item.available.length&&(scope.available=scope.item.available),scope.item.unavailable&&scope.item.unavailable.length&&(scope.unavailable=scope.item.unavailable)}}}),angular.module("ngDAIA").directive("daiaItem",function(){return{restrict:"A",scope:{item:"=daiaItem"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-item.html"}}}),angular.module("ngDAIA").directive("daiaSimple",["$filter",function($filter){return{restrict:"A",scope:{daia:"=daiaSimple"},templateUrl:function(elem,attrs){return attrs.templateUrl?attrs.templateUrl:"template/daia-simple.html"},link:function(scope){scope.$watch("daia",function(){var simple=$filter("daiaSimple")(scope.daia);angular.forEach(["service","available","expected","delay","href","limitation","queue"],function(key){scope[key]=simple[key]})})}}}]),angular.module("ngDAIA").filter("daiaSimple",function(){return function(input){var services=["openaccess","loan","presentation"],items=[];angular.isObject(input)&&(angular.isArray(input.document)?angular.forEach(input.document,function(document){angular.forEach(document.item,function(item){items.push(item)})}):angular.isArray(input.item)?angular.forEach(input.item,function(item){items.push(item)}):items.push(input));var response={service:"none",available:!1};if(services.some(function(service){return items.some(function(item){var a=angular.isArray(item.available)?item.available:[];return a.some(function(available){return available.service==service?(response.available=!0,["service","href","limitation","delay"].forEach(function(key){var value=available[key];(value||0==value)&&(response[key]=value)}),response.limitation&&(response.limitation=response.limitation[0].content),!0):void 0})})}))return response;var expect;return items.forEach(function(item){var a=angular.isArray(item.unavailable)?item.unavailable:[];a.forEach(function(unavail){var uexp=unavail.expected;-1!=services.indexOf(unavail.service)&&uexp&&(!expect||"unknown"==expect||"unknown"!=uexp&&expect>uexp)&&(["service","href","limitation","expected","queue"].forEach(function(key){var value=unavail[key];(value||0==value)&&(response[key]=value)}),response.limitation&&(response.limitation=response.limitation[0].content))})}),expect?response:(services.some(function(){}),response)}}),angular.module("ngDAIA").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("template/daia-availability.html",'<ul class="availability" ng-if="available || unavailable"><li ng-if="available" ng-repeat="a in available"><span class="service-label" translate="{{a.service}}">{{a.service}}</span> <span class="availability availability-available" translate="available">available</span> <span class="availability availability-limitation" ng-if="a.limitation">({{a.limitation[0].content}})</span></li><li ng-if="unavailable" ng-repeat="u in unavailable"><span class="service-label" ng-if="u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="u.expected" class="availability availability-expected" translate="expected">expected</span> <span class="service-label" ng-if="!u.expected" translate="{{u.service}}">{{u.service}}</span> <span ng-if="!u.expected" class="availability availability-unavailable" translate="unavailable">unavailable</span></li><div class="returning"><li ng-if="unavailable[0].href && unavailable[0].expected"><div ng-if="unavailable[0].expected" class="returning returning-expected"><span translate="EXPECTED_BACK">expected back:</span> {{unavailable[0].expected}}</div><a href="{{unavailable[0].href}}" translate="RESERVATION">place reservation</a></li></div></ul><div class="access" ng-if="((available[1].service || available[0].service) == \'openaccess\' || unavailable[0].service == \'openaccess\')"><span translate="ACCESS">access via:</span> <a ng-if="available[1].service == \'openaccess\'" href="{{available[1].href}}">{{available[1].href}}</a> <a ng-if="unavailable[0].service == \'openaccess\'" href="{{unavailable[0].href}}">{{available[0].href}}</a></div>'),$templateCache.put("template/daia-item.html",'<div ng-if="item.department"><span class="daia-label" translate="DEPARTMENT">Department:</span> <a ng-if="item.department.href" href="{{item.department.href}}">{{item.department.content}}</a> <span ng-if="!item.department.href">{{item.department.content}}</span></div><div ng-if="item.label"><span class="daia-label" translate="SIGNATURE">Shelf mark:</span> {{item.label}}</div><span ng-if="!item.available && !item.unavailable" class="daia-label" translate="AVAILABILITY">Availability:</span> <span ng-if="!item.available && !item.unavailable" translate="unknown">unknown</span><div daia-availability="item"></div>'),$templateCache.put("template/daia-response.html",'<div class="daia-result"><div ng-if="daia.institution.content"><span class="daia-label" translate="INSTITUTION">institution:</span> <a ng-if="daia.institution.href" href="{{daia.institution.href}}">{{daia.institution.content}}</a></div><div ng-if="daia.document[0].href"><span class="daia-label" translate="DOCUMENT">document:</span> <a translate="CATALOG_ENTRY" href="{{daia.document[0].href}}">Catalog entry</a></div><div><span ng-if="!daia.document" translate="NO_RECORDS">no records found</span></div><div ng-if="daia.document" daia-documents="daia.document"><div class="daia-document" ng-repeat="i in daia.document[0].item"><div daia-item="i"></div></div></div></div>'),$templateCache.put("template/daia-simple.html",'<span ng-if="available"><span ng-switch="service"><span ng-switch-when="openaccess"><span class="availability-available">frei verfügbar</span> <a ng-if="href" href="{{href}}">aufrufen</a></span> <span ng-switch-when="loan"><span class="availability-available">ausleihbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-when="presentation"><span class="availability-available">vor Ort verfügbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span> <span ng-switch-default><span class="availability-available">verfügbar</span> <a ng-if="href" href="{{href}}">bestellen</a></span></span> <span ng-if="delay">(Wartezeit<span ng-if="delay != \'unknown\'">etwa {{delay}}</span>)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span> <span ng-if="!available"><span class="availability-unavailable"><span ng-if="expected">momentan</span> nicht verfügbar</span> <span ng-if="expected && expected != \'unknown\'">bis voraussichtlich {{expected}}</span> <span ng-if="href"><a href="{{href}}">vormerken</a></span> <span ng-if="queue">({{queue}} Vormerkungen)</span> <span ng-if="limitation">| <span class="daia-limitation">{{limitation}}</span></span></span>')}]);
{
"name": "ng-daia",
"version": "0.1.2",
"version": "0.1.3",
"author": "Jakob Voß <voss@gbv.de>",
"contributor": ["Moritz Horn <moritz.horn@gmail.com>"],
"description": "AngularJS module to facilitate access to DAIA services",
"keywords": ["angular","angularjs","daia","availability"],
"contributor": [
"Moritz Horn <moritz.horn@gmail.com>"
],
"description": "AngularJS module to access DAIA services",
"keywords": [
"angular",
"angularjs",
"daia",
"availability",
"libraries",
"documents"
],
"license": "AGPL",
"homepage": "http://gbv.github.io/ng-daia/",
"homepage": "https://gbv.github.io/ng-daia/",
"repository": {

@@ -15,3 +24,8 @@ "type": "git",

"main": "ng-daia.min.js",
"dependencies": {
"angular": "~1.2.0"
},
"devDependencies": {
"angular-mocks": "~1.2.0",
"angular-translate": "^2.4.0",
"grunt": "~0.4.2",

@@ -22,7 +36,8 @@ "grunt-angular-templates": "~0.5.4",

"grunt-contrib-uglify": "~0.4.0",
"grunt-git-is-clean": "^0.1.2",
"grunt-karma": "~0.6.2",
"grunt-ng-annotate": "^0.9.2",
"grunt-ngdocs": "~0.2.1",
"grunt-ngmin": "~0.0.3",
"grunt-release": "^0.10.0",
"grunt-shell": "~0.6.0",
"grunt-template": "~0.2.3",
"grunt-version": "~0.3.0",

@@ -34,3 +49,6 @@ "karma": "~0.10.9",

"test": "grunt test"
},
"optionalDependencies": {
"angular-translate": "^2.4.0"
}
}

@@ -1,54 +0,169 @@

# ng-daia [![Build Status](https://travis-ci.org/gbv/ng-daia.png?branch=master)](https://travis-ci.org/gbv/ng-daia)
# ng-daia
> [AngularJS](http://angularjs.org/) module to facilitate access to DAIA services
> [AngularJS](http://angularjs.org/) module to access [DAIA](http://purl.org/NET/DAIA) services
See <http://gbv.github.io/ng-daia/> for documentation and usage examples.
[![npm version](https://img.shields.io/npm/v/ng-daia.svg?style=flat)](https://www.npmjs.com/package/ng-daia)
[![Build Status](https://travis-ci.org/gbv/ng-daia.svg)](https://travis-ci.org/gbv/ng-daia)
[![Test Coverage](https://coveralls.io/repos/gbv/ng-daia/badge.svg?branch=master)](https://coveralls.io/r/gbv/ng-daia?branch=master)
[![GitHub Issues](https://img.shields.io/github/issues-raw/gbv/ng-daia.svg?style=flat)](https://github.com/gbv/ng-daia/issues)
## Installation
**ng-daia** is an [AngularJS](http://angularjs.org/) module to facilitate
access [Document Availability Information API (DAIA)](http://purl.org/NET/DAIA)
display DAIA responses.
Install **ng-daia** as a dependency in your Node.js project:
## Install
npm install ng-daia --safe
### npm
Then *require* it in your client-side JavaScript files:
```bash
npm install ng-daia --safe
```
var ng_daia = require('ng-daia');
### bower
## Development
```bash
bower install ng-daia --safe
```
*Stop reading here unless you want to modify the source code of ng-daia!*
## Usage
Requires AngularJS >= 1.2.
See <https://gbv.github.io/ng-daia/> for documentation and usage examples!
Requires OS with POSIX symlinks
### Getting started
First, **clone** the repository from <https://github.com/gbv/ng-daia>.
The [demo](demo) illustrates display of availability information with
directives and filters provided by module ng-daia}. Please have a look at the
documentation of each directive/filter.
Second, install Node.js unless it is already installed. Node.js includes `npm`
to install additional packages. Locally **install all required packages**
listed in `package.json` (for global installation call `npm` via `sudo -H`):
The following minimal example might help to include ng-daia into your website:
npm install -g grunt-cli
npm install
```.html
<html ng-app="myApp">
<head>
<script src="angular.min.js"></script>
<script src="ng-daia.min.js"></script>
<script>angular.module('myApp', ['ngDAIA']);</script>
<link href="ng-daia.css" rel="stylesheet" />
</head>
<body>
<div daia-api="http://your-daia-base-url" daia-id="your-document-id">
</div>
</body>
</html>
```
Testing is configured in `karma.conf.js` and **unit tests** are located in
directory `test` written with [Jasmine](http://pivotal.github.io/jasmine/).
### Customization
To execute of all unit tests call:
The default templates, included in `ng-daia.js`, can be styled with CSS,
translated with angular-translate, and replaced with the `template-url`
parameter:
grunt test
* [template/daia-response.html](https://github.com/gbv/ng-daia/blob/master/src/templates/daia-response.html)
* [template/daia-availability.html](https://github.com/gbv/ng-daia/blob/master/src/templates/daia-availability.html)
* [template/daia-item.html](https://github.com/gbv/ng-daia/blob/master/src/templates/daia-item.html)
* [template/daia-simple.html](https://github.com/gbv/ng-daia/blob/master/src/templates/daia-simple.html)
The following CSS classes are used:
For contious testing (tests are re-run on changes), call:
* `daia-response`: the whole response
* `daia-result`: the whole result
* `daia-document`: each copy of the result
* `daia-label`: style of descriptions
* `availability`: overall style for display of availability
* `service-label`: style for availability labels
* `availability-available`: style for display of available services
* `availability-unavailable`: style for display of unavailable services
* `availability-expected`: style for display of unavailable services with expected availability
* `availability-limitation`: style for limitations (in brackets after the corresponding availability status)
* `returning`: overall style for message concerning 'expected' date and link for preordering
* `returning-expected`: style for message concerning 'expected' date
* `access`: style for display of possible access-link
* `simple-openaccess`: style for simple availability "openaccess"
* `simple-loan`: style for simple availability "loan"
* `simple-presentation`: style for simple availability "presentation"
grunt watch
The default templates are fully prepared for internationalization (i18n) with
[angular-translate](https://angular-translate.github.io/docs/#/guide/02_getting-started).
To use the translations module, first include the following in your html:
As configured in `.travis.yml` the tests are automatically
[executed at travis-ci](https://travis-ci.org/gbv/ng-daia)
when pushed to GitHub.
```.html
<script src="../lib/angular-translate.min.js"></script>
```
To build the **documentation**, written using
[ngdoc](https://github.com/angular/angular.js/wiki/Writing-AngularJS-Documentation),
call
There are several ways to manage translations with angular-translate. You might want to add them directly into your `myApp` module, or the translations can be put into their own json files and retrieved by your app, which will require an additional package:
grunt docs
```.html
<script src="../lib/angular-translate-loader-static-files.min.js"></script>
```
You then have to extend the app module to enable loading the translations (the filenames would in this case have the format "lang-en.json", etc.):
```.javascript
angular.module('myApp', ['ngDAIA', 'pascalprecht.translate']).config(['$translateProvider', function ($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: '../src/translations/lang-',
suffix: '.json'
});
$translateProvider.registerAvailableLanguageKeys(['en', 'de'], {
'en_US':'en','en_UK':'en','de_DE':'de','de_AT':'de','de_CH':'de',
})
$translateProvider.fallbackLanguage('en');
$translateProvider.determinePreferredLanguage();
}]);
```
As well as exporting the translation tables, this example shows the support for automatic language-detection. The default templates are using the following translation terms:
#### daia-response terms
* `unknown`
* `available`
* `unavailable`
* `presentation`
* `loan`
* `interloan`
* `none`
* `expected`
* `openaccess`
#### labels and other text
* `INSTITUTION` : reference label to holding institution
* `DOCUMENT` : reference label for searched document
* `CATALOG_ENTRY` : reference label for document link
* `DEPARTMENT` : label for specific part of the institution
* `SIGNATURE` : label for alternative id (like shelf mark for physical medium)
* `NO_RECORDS`: message shown when no items can be displayed
* `AVAILABILITY` : label used before `unknown` if no items can be displayed
* `EXPECTED_BACK` : message
* `RESERVATION` : displayed link text for reservation link
* `ACCESS` : label displayed if a direct document link exists
* `STATUS` : label text for `daia-simple` output
### Demo
The [demo](demo) (see [demo
directory](https://github.com/gbv/ng-daia/tree/master/demo) of source code
repository) contains a more detailed sample application that makes use of
`ng-daia` as well as angular-translate. The demo should be run from a server
(e.g. localhost).
## Contributing
See [`CONTRIBUTING.md`](#/api/contributing) for development documentation.
Contributions and [feedback](https://github.com/gbv/ng-daia/issues) is
appreciated!
## Contributors
* Jakob Voß <voss@gbv.de>
* Moritz Horn <moritz.horn@gmail.com>
## License
Code licensed under the [AGPL](http://www.gnu.org/licenses/agpl-3.0.html).
Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/).
DAIA icons (included in `daia.css`) are based on
[PICOL](http://picol.org/) icons, CC-BY Melih Bilgil.

@@ -38,3 +38,4 @@ 'use strict';

*/
ngDAIA.directive('daiaApi',function($http,$filter){
angular.module('ngDAIA')
.directive('daiaApi',function($http,$filter){
return {

@@ -41,0 +42,0 @@ restrict: 'A',

@@ -30,3 +30,4 @@ 'use strict';

*/
ngDAIA.directive('daiaAvailability',function(){
angular.module('ngDAIA')
.directive('daiaAvailability',function(){
return {

@@ -33,0 +34,0 @@ restrict: 'A',

@@ -28,3 +28,4 @@ 'use strict';

*/
ngDAIA.directive('daiaItem',function(){
angular.module('ngDAIA')
.directive('daiaItem',function(){
return {

@@ -31,0 +32,0 @@ restrict: 'A',

@@ -28,3 +28,4 @@ 'use strict';

*/
ngDAIA.directive('daiaSimple',function($filter){
angular.module('ngDAIA')
.directive('daiaSimple',function($filter){
return {

@@ -31,0 +32,0 @@ restrict: 'A',

@@ -34,3 +34,4 @@ 'use strict';

*/
ngDAIA.filter('daiaSimple', function() {
angular.module('ngDAIA')
.filter('daiaSimple', function() {
return function(input, option) {

@@ -37,0 +38,0 @@ var services = ['openaccess','loan','presentation'];

@@ -7,3 +7,3 @@ /**

*
* The <b>ngDAIA</b> module for AngularJS facilitates access to
* The **ngDAIA** module for AngularJS facilitates access to
* {@link http://purl.org/NET/DAIA Document Availability Information API}

@@ -27,5 +27,4 @@ * (DAIA) services and to display the responses given by a DAIA server.

* response, document, or item into simple availability status.
*
*/
var ngDAIA = angular.module('ngDAIA',[]);
ngDAIA.value('version', '0.1.2');
angular.module('ngDAIA',[])
.value('ngDAIA.version', '0.1.3');

@@ -1,12 +0,11 @@

describe('daiaSimple',function() {
'use strict';
describe('daiaSimple filter', function() {
var filter;
beforeEach(function(){
module('ngDAIA');
inject(function($injector) {
var $filter = $injector.get('$filter');
filter = $filter('daiaSimple');
});
});
beforeEach(module('ngDAIA'));
beforeEach(inject(function(daiaSimpleFilter){
filter = daiaSimpleFilter;
}));
it('Should return status none at undefined/null/number/string', function() {

@@ -23,3 +22,3 @@ var simple = { service: "none", available: false };

it('Should return status on item/document', function() {
it('Should return status on item/document', function() {
var loan = { available: [ { service: "loan" } ] };

@@ -26,0 +25,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc