Closes #65: Type, coverage, rights metadata

This commit is contained in:
jendib 2016-02-14 23:08:27 +01:00
parent 359f5b5f49
commit f9c3715d8d
3 changed files with 44 additions and 0 deletions

View File

@ -7,6 +7,9 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
// Alerts // Alerts
$scope.alerts = []; $scope.alerts = [];
// Vocabularies
$scope.vocabularies = [];
// Orphan files to add // Orphan files to add
$scope.orphanFiles = $stateParams.files ? $stateParams.files.split(',') : []; $scope.orphanFiles = $stateParams.files ? $stateParams.files.split(',') : [];
@ -219,4 +222,14 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
} else { } else {
$scope.resetForm(); $scope.resetForm();
} }
// Load vocabularies
$scope.loadVocabulary = function(name) {
Restangular.one('vocabulary', name).get().then(function(result) {
$scope.vocabularies[name] = result.entries;
});
};
$scope.loadVocabulary('type');
$scope.loadVocabulary('coverage');
$scope.loadVocabulary('rights');
}); });

View File

@ -93,6 +93,31 @@
placeholder="A related resource from which the described resource is derived" name="source" ng-model="document.source" ng-disabled="fileIsUploading" /> placeholder="A related resource from which the described resource is derived" name="source" ng-model="document.source" ng-disabled="fileIsUploading" />
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label" for="inputType">Type</label>
<div class="col-sm-10">
<select class="form-control" id="inputType" name="type" ng-model="document.type" ng-disabled="fileIsUploading">
<option ng-repeat="vocabulary in vocabularies['type']">{{ vocabulary.value }}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="inputCoverage">Coverage</label>
<div class="col-sm-10">
<select class="form-control" id="inputCoverage" name="coverage" ng-model="document.coverage" ng-disabled="fileIsUploading">
<option ng-repeat="vocabulary in vocabularies['coverage']">{{ vocabulary.value }}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="inputRights">Rights</label>
<div class="col-sm-10">
<select class="form-control" id="inputRights" name="rights" ng-model="document.rights" ng-disabled="fileIsUploading">
<option ng-repeat="vocabulary in vocabularies['rights']">{{ vocabulary.value }}</option>
</select>
</div>
</div>
</fieldset> </fieldset>
<div class="form-group"> <div class="form-group">

View File

@ -10,6 +10,12 @@
<dd ng-if="document.format">{{ document.format }}</dd> <dd ng-if="document.format">{{ document.format }}</dd>
<dt ng-if="document.source">Source</dt> <dt ng-if="document.source">Source</dt>
<dd ng-if="document.source">{{ document.source }}</dd> <dd ng-if="document.source">{{ document.source }}</dd>
<dt ng-if="document.type">Type</dt>
<dd ng-if="document.type">{{ document.type }}</dd>
<dt ng-if="document.coverage">Coverage</dt>
<dd ng-if="document.coverage">{{ document.coverage }}</dd>
<dt ng-if="document.rights">rights</dt>
<dd ng-if="document.rights">{{ document.rights }}</dd>
</dl> </dl>
<div ng-file-drop drag-over-class="bg-success" ng-multiple="true" allow-dir="false" ng-model="dropFiles" <div ng-file-drop drag-over-class="bg-success" ng-multiple="true" allow-dir="false" ng-model="dropFiles"