forms
This commit is contained in:
parent
4a7085d7ec
commit
6ac09081b2
|
@ -47,8 +47,8 @@ public class DsmAjaxController extends AbstractDnetController {
|
|||
}
|
||||
|
||||
@GetMapping("/conf")
|
||||
public Map<String, Object> configuration() {
|
||||
final Map<String, Object> map = new LinkedHashMap<>();
|
||||
public Map<String, Iterable<?>> configuration() {
|
||||
final Map<String, Iterable<?>> map = new LinkedHashMap<>();
|
||||
map.put("protocols", protocolService.listProtocols());
|
||||
map.put("compatibilityLevels", vocabularyTermRepository.findTermsByVocabulary("dnet:compatibilityLevel"));
|
||||
map.put("contentDescTypes", vocabularyTermRepository.findTermsByVocabulary("dnet:content_description_typologies"));
|
||||
|
|
|
@ -53,16 +53,11 @@
|
|||
</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="tmpCtx.id" /> <input ng-show="mode == 'edit'" type="text" readonly class="form-control-plaintext"
|
||||
ng-model="tmpCtx.id" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Label</label> <input type="text" class="form-control" ng-model="tmpCtx.label" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type</label> <input type="text" class="form-control" ng-model="tmpCtx.type" />
|
||||
</div>
|
||||
|
||||
<form-textfield label="ID" value="tmpCtx.id" ng-show="mode == 'new'"></form-textfield>
|
||||
<form-textfield-static label="ID" value="tmpCtx.id" ng-show="mode == 'edit'"></form-textfield-static>
|
||||
<form-textfield label="Label" value="tmpCtx.label"></form-textfield>
|
||||
<form-textfield label="Type" value="tmpCtx.type"></form-textfield>
|
||||
<div class="form-group">
|
||||
<table class="table table-sm table-striped" style="table-layout: fixed;">
|
||||
<thead>
|
||||
|
|
|
@ -14,12 +14,7 @@
|
|||
<form-textfield label="BaseURL" value="api.baseUrl" regex="^(http|https|ftp|file|sftp|jar|mongodb):\/\/"></form-textfield>
|
||||
|
||||
<div ng-show="api.protocol" ng-repeat="p in selProtParams">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label col-form-label-sm">Parameter: {{p.label}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control form-control-sm" ng-model="api.apiParams[p.name]"/>
|
||||
</div>
|
||||
</div>
|
||||
<form-textfield label="Parameter: {{p.label}}" value="api.apiParams[p.name]" type="{{p.type}}" optional="{{p.optional}}"></form-textfield>
|
||||
</div>
|
||||
|
||||
{{api}}<br />
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
<select class="custom-select custom-select-sm is-valid"
|
||||
ng-model="value"
|
||||
ng-required="required"
|
||||
ng-class="{'is-invalid': !value || value.trim() == ''}">
|
||||
ng-class="{'is-invalid': required && (!value || value.trim() == '')}">
|
||||
<option ng-repeat="t in terms">{{t}}</option>
|
||||
</select>
|
||||
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label col-form-label-sm">{{label}}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control form-control-sm is-valid"
|
||||
ng-required="required"
|
||||
ng-class="{'is-invalid': required && (!value || value.trim() == '')}"
|
||||
ng-model="value"></textarea>
|
||||
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||
</div>
|
||||
</div>
|
|
@ -4,7 +4,8 @@
|
|||
<input type="text" class="form-control form-control-sm is-valid"
|
||||
ng-pattern="mypattern"
|
||||
ng-required="required"
|
||||
ng-class="{'is-invalid': !value || value.trim() == ''}"
|
||||
ng-class="{'is-invalid': required && (!value || value.trim() == '')}"
|
||||
ng-model="value" />
|
||||
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
</div>
|
||||
<input type="text" class="form-control form-control-sm is-valid"
|
||||
ng-required="required"
|
||||
ng-class="{'is-invalid': !suffix || suffix.trim() == ''}"
|
||||
ng-class="{'is-invalid': required && (!suffix || suffix.trim() == '')}"
|
||||
ng-model="suffix" />
|
||||
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -96,7 +96,20 @@ app.directive('formSelect', function() {
|
|||
};
|
||||
});
|
||||
|
||||
|
||||
app.directive('formTextarea', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'label' : '@',
|
||||
'optional' : '@',
|
||||
'value' : '=',
|
||||
},
|
||||
templateUrl: './html/parts/form_textarea.html',
|
||||
link: function(scope, element, attrs) {
|
||||
scope.required = (scope.optional != 'true');
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue