From 9fac2c25a1ae183658bc7e9ea2df346d23e4de66 Mon Sep 17 00:00:00 2001 From: sweco-semhul Date: Wed, 9 Apr 2014 17:05:49 +0200 Subject: [PATCH] Fixed bug in search result view, records show up empty. Changed some in the functionality to add non existing elements to record. Added identifiers and publication to addable records --- static/js/controllers/EditCtrl.js | 3 +- static/js/directives/directives.js | 5 +- static/js/services/services.js | 4 +- templates/_media.html | 8 +-- templates/partials/edit/bib/identifier.html | 64 ++++--------------- templates/partials/edit/bib/notes.html | 3 +- .../edit/bib/physical_description.html | 3 +- .../edit/bib/publication_and_production.html | 5 +- templates/partials/edit/bib/subject.html | 2 - .../edit/bib/title_and_main_entry.html | 2 - templates/partials/search.html | 3 +- 11 files changed, 29 insertions(+), 73 deletions(-) diff --git a/static/js/controllers/EditCtrl.js b/static/js/controllers/EditCtrl.js index 2054cf94..c10f0ea1 100644 --- a/static/js/controllers/EditCtrl.js +++ b/static/js/controllers/EditCtrl.js @@ -2,6 +2,7 @@ kitin.controller('EditCtrl', function($scope, $modal, $http, $routeParams, $time $anchorScroll(); + editUtil.addableElements = []; var modalRecord = $rootScope.modalRecord; var recType = modalRecord? modalRecord.recType : $routeParams.recType; var recId = modalRecord? modalRecord.recId : $routeParams.recId; @@ -267,7 +268,7 @@ kitin.controller('EditCtrl', function($scope, $modal, $http, $routeParams, $time collection = subj[rel] = subCollection ? {} : []; } //!TODO clean up, subCollections is needed when hasFormat and identifier is undefined - if(subCollection) { + if(typeof subCollection !== 'undefined' && subCollection !== 'undefined') { collection = subj[rel][subCollection]; if(typeof collection === 'undefined') { collection = subj[rel][subCollection] = []; diff --git a/static/js/directives/directives.js b/static/js/directives/directives.js index f4aadf1d..844810bf 100644 --- a/static/js/directives/directives.js +++ b/static/js/directives/directives.js @@ -210,12 +210,13 @@ kitin.directive('elementAdder', function(editUtil) { restrict: 'C', require: 'editCtrl', scope: true, - template: '', + template: '', controller: function($element, $scope, $attrs) { $scope.addableElements = editUtil.addableElements; $scope.change = function() { - $scope.$parent.addObject($scope.$parent.record.about, $scope.elementToAdd.linkMultiple, $scope.elementToAdd.ngSwitchWhen, $scope.elementToAdd.ngTarget, $scope.elementToAdd.ngSwitchWhen); + var type = ($scope.elementToAdd.defaultType ? $scope.elementToAdd.defaultType : $scope.elementToAdd.ngSwitchWhen); + $scope.$parent.addObject($scope.$parent.record.about, $scope.elementToAdd.linkMultiple, type, $scope.elementToAdd.ngTarget, type); $scope.elementToAdd = null; }; } diff --git a/static/js/services/services.js b/static/js/services/services.js index 40faac9d..83a485ba 100644 --- a/static/js/services/services.js +++ b/static/js/services/services.js @@ -242,12 +242,10 @@ kitin.service('editUtil', function(definitions) { // objectKeys: ['prefLabel', '@type', 'hiddenLabel', 'broader', 'narrower', '@id', 'scopeNote', 'historyNote' ] case 'ISBN': return {'@type': "Identifier", identifierScheme: { '@id': "/def/identifiers/isbn" }, identifierValue: ""}; - case 'ISSN': + case '/def/identifiers/issn': return {'@type': "Identifier", identifierScheme: { '@id': "/def/identifiers/issn" }, identifierValue: ""}; case 'Identifier': return {'@type': "Identifier", identifierValue: ""}; - case 'VideoRecording': - return {'@type': "VideoRecording"}; case 'ProviderEvent': return {'@type': "ProviderEvent", providerName: "", providerDate: "", place: {'@type': "Place", label: ""}}; diff --git a/templates/_media.html b/templates/_media.html index eb942c45..abfe8630 100644 --- a/templates/_media.html +++ b/templates/_media.html @@ -1,19 +1,19 @@ - + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/templates/partials/edit/bib/identifier.html b/templates/partials/edit/bib/identifier.html index 7aec0c87..095101f3 100644 --- a/templates/partials/edit/bib/identifier.html +++ b/templates/partials/edit/bib/identifier.html @@ -4,7 +4,9 @@
-
+
@@ -58,63 +60,23 @@
+ data-subject="record.about" data-link-multiple="identifierByIdentifierScheme" + addable>
-
-
- - - - - - - - - - - - - - - - - - - - - -
- {{ 'Identifierare' }} - - {{ "Notering" }} - - {{ "Scheme" }} -
- - - - - - - -
- -
+
diff --git a/templates/partials/edit/bib/notes.html b/templates/partials/edit/bib/notes.html index 7ac5b12a..82d57fd7 100644 --- a/templates/partials/edit/bib/notes.html +++ b/templates/partials/edit/bib/notes.html @@ -89,6 +89,5 @@

{{ "Anmärkningar" }}

- -
+ {% endraw %} \ No newline at end of file diff --git a/templates/partials/edit/bib/physical_description.html b/templates/partials/edit/bib/physical_description.html index 3724ac39..0e45912e 100644 --- a/templates/partials/edit/bib/physical_description.html +++ b/templates/partials/edit/bib/physical_description.html @@ -68,7 +68,6 @@

{{formatType}}

-
{{formatType}} table-model="subFormat" table-headers="carrierType,soundSpeed,soundDimensions,soundKindOfDisc,soundKindOfMaterial,soundPlaybackCharacter" table-columns="carrierType[0]['@id'],soundSpeed['@id'],soundDimensions['@id'],soundKindOfDisc['@id'],soundKindOfMaterial['@id'],soundPlaybackCharacter['@id']" - data-subject="record.about" data-link="hasFormatByType" + data-subject="record.about" data-link-multiple="hasFormatByType" addable>
diff --git a/templates/partials/edit/bib/publication_and_production.html b/templates/partials/edit/bib/publication_and_production.html index e3f54155..25ea44d5 100644 --- a/templates/partials/edit/bib/publication_and_production.html +++ b/templates/partials/edit/bib/publication_and_production.html @@ -1,6 +1,6 @@ {% raw %}

Utgivning och tillverkning

-
+
diff --git a/templates/partials/edit/bib/subject.html b/templates/partials/edit/bib/subject.html index 02f7a486..1c1954e2 100644 --- a/templates/partials/edit/bib/subject.html +++ b/templates/partials/edit/bib/subject.html @@ -107,8 +107,6 @@

Klassifikation

-
-