Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Fixed bug in search result view, records show up empty.
Browse files Browse the repository at this point in the history
Changed some in the functionality to add non existing elements to record.
Added identifiers and publication to addable records
  • Loading branch information
sweco-semhul committed Apr 9, 2014
1 parent b777f7d commit 9fac2c2
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 73 deletions.
3 changes: 2 additions & 1 deletion static/js/controllers/EditCtrl.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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] = [];
Expand Down
5 changes: 3 additions & 2 deletions static/js/directives/directives.js
Expand Up @@ -210,12 +210,13 @@ kitin.directive('elementAdder', function(editUtil) {
restrict: 'C',
require: 'editCtrl',
scope: true,
template: '<select ng-model="elementToAdd" ng-change="change()" ng-options="(element.linkMultiple+\',\'+element.ngSwitchWhen) for element in addableElements"></select>',
template: '<select ng-model="elementToAdd" ng-change="change()" ng-options="(element.linkMultiple+\',\'+(element.defaultType ? element.defaultType : element.ngSwitchWhen)) for element in addableElements"></select>',
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;
};
}
Expand Down
4 changes: 1 addition & 3 deletions static/js/services/services.js
Expand Up @@ -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: ""}};
Expand Down
8 changes: 4 additions & 4 deletions templates/_media.html
@@ -1,19 +1,19 @@
<!-- IMPORTANT: generated file; do not edit! -->
<link rel='stylesheet' href='/static/build/css/vendor.min.css?v=9b21f3a160df55019c914c05903e9f58' />
<link rel='stylesheet' href='/static/css/bootstrap.css?v=9af4feb3a510831d19134d6c9a289ba0' />
<link rel='stylesheet' href='/static/css/main.css?v=2efa37346293f2f1553cda8ebfdd68ae' />
<link rel='stylesheet' href='/static/css/main.css?v=6ea47ec3eae3cc48f0cae654baefad29' />
<script src='/static/build/js/vendor.min.js?v=8cb6378e292850e916f3374355db8de5'></script>
<script src='/static/js/controllers/AppCtrl.js?v=56693a90399295fab9fd5877d2e1d85c'></script>
<script src='/static/js/controllers/EditCtrl.js?v=88e8eee4ee5a74e9840a1805148e9c56'></script>
<script src='/static/js/controllers/EditCtrl.js?v=bd9e4d05e4f4caa9b65390dc5441614f'></script>
<script src='/static/js/controllers/IndexCtrl.js?v=7385d917b74f218afd5f0821c9b4e71d'></script>
<script src='/static/js/controllers/ModalAuthCtrl.js?v=2a38e468a83d14b51d2c23244002c8b7'></script>
<script src='/static/js/controllers/ModalCtrl.js?v=b835498f4a6a9bd591c66729e60451fd'></script>
<script src='/static/js/controllers/ModalRemoteCtrl.js?v=085fd6ea508cbd840ee7b0a4c94b47cc'></script>
<script src='/static/js/controllers/SearchFormCtrl.js?v=1a7b53345a7166dc81f5ad3685a8814b'></script>
<script src='/static/js/controllers/SearchResultCtrl.js?v=9ccff176f241fbd898a772a69db5ee72'></script>
<script src='/static/js/directives/directives.js?v=f50566e55baf4f474d62eb95cde3c8aa'></script>
<script src='/static/js/directives/directives.js?v=0928fe7efd94e26397b7ee9a0d87895b'></script>
<script src='/static/js/filters/filters.js?v=0d3b0ed36c284ef762b841b08eac2e2f'></script>
<script src='/static/js/main.js?v=6e784c2c88a95b306199f0c367a6f465'></script>
<script src='/static/js/marcedit.js?v=dbc11aba100b042bc90ea8d02a0cd391'></script>
<script src='/static/js/marcjson.js?v=3fea6bc9b29eca237c0af588524fb8f1'></script>
<script src='/static/js/services/services.js?v=e18b8bc834519ff45514a4c4ea2ec531'></script>
<script src='/static/js/services/services.js?v=0868b95db989620c25cf13cff8f226c4'></script>
64 changes: 13 additions & 51 deletions templates/partials/edit/bib/identifier.html
Expand Up @@ -4,7 +4,9 @@

<div data-ng-repeat="(identifierSchemeName, identifierScheme) in record.about.identifierByIdentifierScheme" ng-switch on="identifierSchemeName">
<!-- ISBN START -->
<div ng-switch-when="/def/identifiers/isbn" class="datatable" data-ng-target="isbnTable">
<div ng-switch-when="/def/identifiers/isbn" class="datatable" data-ng-target="isbnTable"
data-subject="record.about" data-link-multiple="identifierByIdentifierScheme"
addable>
<table>
<thead>
<tr>
Expand Down Expand Up @@ -58,63 +60,23 @@
<!-- ISSN START -->
<div ng-switch-when="/def/identifiers/issn" class="datatable" data-ng-target="issnTable"
kitin-data-table
table-model="subFormat"
table-model="identifierScheme"
table-headers="ISSN,Notering"
table-columns="identifierValue,identifierNote"
table-addable="addObject(record.about.identifierByIdentifierScheme, identifierSchemeName, 'ISSN', 'issnTable')">
data-subject="record.about" data-link-multiple="identifierByIdentifierScheme"
addable>
</div>
<!-- ISSN END -->


<!-- OTHER IDENTIFIER START -->
<div ng-switch-default class="datatable" data-ng-target="identifierTable">
<table>
<thead>
<tr>
<td>
<span class="lbl-inline lbl">{{ 'Identifierare' }}</span>
</td>
<td>
<span class="lbl">{{ "Notering" }}</span>
</td>
<td>
<span class="lbl">{{ "Scheme" }}</span>
</td>
<td></td>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="identifier in identifierScheme">
<td>
<label>
<input data-inplace type="text" data-ng-model="identifier.identifierValue" />
</label>
</td>
<td>
<label>
<input data-inplace class="ng-pristine ng-valid" type="text" data-ng-model="identifier.identifierNote" >
</label>
</td>
<td>
<label>
<input data-inplace class="ng-pristine ng-valid" type="text" data-ng-model="identifier.identifierScheme['@id']" >
</label>
</td>
<td class="controls">
<button ng-show="!$first" class="btn-link deleter" data-ng-click="removeObject(record.about.identifierByIdentifierScheme, identifierSchemeName, $index)">
<i class="fa fa-times"></i>
</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<button class="add-thing btn-link" data-ng-click="addObject(record.about.identifierByIdentifierScheme, (identifierSchemeName ? identifierSchemeName : 'identifier'), identifierSchemeName, 'identifierTable')">{{ 'Lägg till Identifierare' }}</button>
</td>
</tr>
</tfoot>
</table>
<div ng-switch-default class="datatable" data-ng-target="identifierTable"
kitin-data-table
table-model="identifierScheme"
table-headers="Identifierare,Notering,Scheme"
table-columns="identifierValue,identifierNote,identifierScheme['@id']"
data-subject="record.about" data-link-multiple="identifierByIdentifierScheme" data-default-type="identifier"
addable>
</div>
<!-- OTHER IDENTIFIER END -->

Expand Down
3 changes: 1 addition & 2 deletions templates/partials/edit/bib/notes.html
Expand Up @@ -89,6 +89,5 @@ <h2>{{ "Anmärkningar" }}<i></i></h2>
</div>
<div style="clear:both"></div>
</ng-form>

<div class="element-adder"></div>

{% endraw %}
3 changes: 1 addition & 2 deletions templates/partials/edit/bib/physical_description.html
Expand Up @@ -68,7 +68,6 @@ <h3 class="ng-binding">{{formatType}}</h3>
</div>
<!-- MovingImage END -->


<!-- Product START -->
<div ng-switch-when="Product" class="datatable" data-ng-target="productTable"
kitin-data-table
Expand All @@ -86,7 +85,7 @@ <h3 class="ng-binding">{{formatType}}</h3>
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>
</div>
<!-- SoundRecording END -->
Expand Down
5 changes: 3 additions & 2 deletions templates/partials/edit/bib/publication_and_production.html
@@ -1,6 +1,6 @@
{% raw %}
<h2>Utgivning och tillverkning<i></i></h2>
<div class="cols" data-ng-show="record.about['@type'] != 'Book'">
<div class="cols"> <!-- data-ng-show="record.about['@type'] != 'Book'">-->
<div class="col6">
<label>
<span class="lbl">{{ "Allmän medieterm" }}</span>
Expand Down Expand Up @@ -34,7 +34,8 @@ <h2>Utgivning och tillverkning<i></i></h2>
table-model="record.about.publication"
table-headers="Utgivningsplats,Utgivare/förlag,Utgivningsår"
table-columns="place.label,providerName,providerDate"
table-addable="addObject(record.about, 'publication', 'ProviderEvent', 'publisher')">
data-subject="record.about" data-link-multiple="publication"
addable>
</div>
</div>

Expand Down
2 changes: 0 additions & 2 deletions templates/partials/edit/bib/subject.html
Expand Up @@ -107,8 +107,6 @@ <h3>Klassifikation</h3>
</div>
</div>

<div class="element-adder"></div>

<script type="text/html" id="subject-completion-template">
<div class="auth">
<h4>
Expand Down
2 changes: 0 additions & 2 deletions templates/partials/edit/bib/title_and_main_entry.html
Expand Up @@ -94,8 +94,6 @@ <h4>
</div>
</div>

<div class="element-adder"></div>

<!-- TODO: dummy example; implement and remove
<hr>
<div class="cols">
Expand Down
3 changes: 1 addition & 2 deletions templates/partials/search.html
Expand Up @@ -46,8 +46,7 @@
</section>
</div>
<div class="col9" infinite-scroll="onScroll()" infinite-scroll-distance="0" infinite-scroll-immediate-check="true">
<section data-ng-repeat="record in state.search.result.list" data-ng-class="{'result-pre': record.data.encLevel == 8}" class="result record {{record.identifier}}">

<section data-ng-repeat="record in state.search.result.list" data-ng-class="{'result-pre': record.data.encLevel == 8}" class="result record">
<a class="bib-url" href="" ng-click="editPost(recType, record)" data-ng-switch="recType">
<span class="page-indicator" data-ng-if="($index > 0 && ($index + 1) % 10 == 0) || ($index+1) == hitCount">{{ $index + 1 }} / {{ state.search.hitCount }}</span>
<!--auth result list-->
Expand Down

0 comments on commit 9fac2c2

Please sign in to comment.