dnet-applications/apps/dnet-is-application/src/main/resources/templates/vocabularies.html

90 lines
3.3 KiB
HTML

<!DOCTYPE html>
<html>
<head th:replace="fragments/mainParts.html :: htmlHeader('Vocabularies')"></head>
<body ng-app="vocabulariesApp" ng-controller="vocabulariesController">
<nav th:replace="fragments/mainParts.html :: mainMenu('Vocabularies')"></nav>
<div class="container-fluid">
<div class="row">
<div class="col">
<p>
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editVocabularyModal" ng-click="prepareNewVoc()">create a new vocabulary</button>
</p>
<p ng-show="vocabularies.length > 0">
<input type="text" class="form-control form-control-sm" ng-model="vocFilter" placeholder="Filter..."/>
</p>
<p>
<span class="text-muted"><b>Number of vocabularies:</b> {{(vocabularies | filter:vocFilter).length}}</span>
</p>
<table class="table table-sm table-striped">
<thead>
<tr>
<th style="width: 25%">ID</th>
<th style="width: 25%">Name</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-show="(vocabularies|filter:vocFilter).length == 0">
<td colspan="4" class="text-muted">no vocabularies</td>
</tr>
<tr ng-repeat="v in vocabularies|filter:vocFilter">
<th><a href="vocabularyEditor?id={{v.id}}">{{v.id}}</a></th>
<td>{{v.name}}</td>
<td>{{v.description}}</td>
<td align="right">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editVocabularyModal" ng-click="prepareEditVoc(v)" >edit</button>
<button type="button" class="btn btn-sm btn-danger" ng-click="deleteVocabulary(v.id)">delete</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Modals -->
<div class="modal fade" tabindex="-1" id="editVocabularyModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" ng-if="mode == 'new'">New vocabulary</h4>
<h4 class="modal-title" ng-if="mode == 'edit'">Edit vocabulary</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label>ID</label>
<input ng-show="mode == 'new'" type="text" class="form-control" ng-model="tmpVoc.id" />
<input ng-show="mode == 'edit'" type="text" readonly class="form-control-plaintext" ng-model="tmpVoc.id" />
</div>
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" ng-model="tmpVoc.name" />
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" ng-model="tmpVoc.description"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-sm btn-primary" data-dismiss="modal" ng-click="saveVocabulary(tmpVoc)" ng-disabled="!tmpVoc.id || !tmpVoc.name">Submit</button>
</div>
</div>
</div>
</div>
</body>
<th:block th:replace="fragments/mainParts.html :: scripts"></th:block>
<script src="js/vocabularies.js"></script>
</html>