83 lines
3.3 KiB
JavaScript
83 lines
3.3 KiB
JavaScript
var app = angular.module('isApp', ['ngRoute']);
|
|
|
|
app.config(['$routeProvider', function($routeProvider) {
|
|
$routeProvider
|
|
.when('/info', { templateUrl: './html/info.html', controller: 'infoController' })
|
|
.when('/wf_history/:total', { templateUrl: './html/wf_history.html', controller: 'wfHistoryController' })
|
|
.when('/protocols', { templateUrl: './html/protocols.html', controller: 'protocolsController' })
|
|
.when('/resources/:type', { templateUrl: './html/resources.html', controller: 'resourcesController' })
|
|
.when('/contexts', { templateUrl: './html/contexts.html', controller: 'ctxListController' })
|
|
.when('/context/:id', { templateUrl: './html/context_viewer.html', controller: 'ctxViewerController' })
|
|
.when('/vocs', { templateUrl: './html/vocs.html', controller: 'vocListController' })
|
|
.when('/vocabularyEditor', { templateUrl: './html/voc_editor.html', controller: 'vocEditorController' })
|
|
.when('/dsm/search', { templateUrl: './html/dsm_search.html', controller: 'dsmSearchController' })
|
|
.when('/dsm/results/:page/:size', { templateUrl: './html/dsm_results.html', controller: 'dsmResultsController' })
|
|
.when('/dsm/results/:field/:page/:size', { templateUrl: './html/dsm_results.html', controller: 'dsmResultsController' })
|
|
.when('/dsm/addApi', { templateUrl: './html/dsm_add_api.html', controller: 'dsmAddApiController' })
|
|
.when('/dsm/api', { templateUrl: './html/dsm_api.html', controller: 'dsmApiController' })
|
|
.otherwise({ redirectTo: '/info' });
|
|
}
|
|
]);
|
|
|
|
app.directive('formTextfield', function() {
|
|
return {
|
|
restrict: 'E',
|
|
scope: {
|
|
'label' : '@',
|
|
'regex' : '@',
|
|
'optional' : '@',
|
|
'type' : '@',
|
|
'value' : '=',
|
|
},
|
|
templateUrl: './html/parts/form_textfield.html',
|
|
link: function(scope, element, attrs) {
|
|
scope.required = (scope.optional != 'true');
|
|
if (scope.regex) { scope.mypattern = new RegExp(scope.regex); }
|
|
else if (scope.type == 'NUMBER') { scope.mypattern = new RegExp("^[-+]?[0-9]+(\.[0-9]+)?$"); }
|
|
else if (scope.type == 'BOOLEAN') { scope.mypattern = new RegExp("^(true|false)$"); }
|
|
else { scope.mypattern = new RegExp(".+"); }
|
|
}
|
|
};
|
|
});
|
|
|
|
app.directive('formTextfieldStatic', function() {
|
|
return {
|
|
restrict: 'E',
|
|
scope: {
|
|
'label' : '@',
|
|
'value' : '=',
|
|
},
|
|
templateUrl: './html/parts/form_textfield_static.html',
|
|
link: function(scope, element, attrs) {}
|
|
};
|
|
});
|
|
|
|
app.directive('formTextfieldWithPrefix', function() {
|
|
return {
|
|
restrict: 'E',
|
|
scope: {
|
|
'label' : '@',
|
|
'prefix' : '@',
|
|
'optional' : '@',
|
|
'value' : '='
|
|
},
|
|
templateUrl: './html/parts/form_textfield_with_prefix.html',
|
|
link: function(scope, element, attrs) {
|
|
scope.suffix = '';
|
|
scope.required = (scope.optional != 'true');
|
|
|
|
scope.$watch('suffix', function() {
|
|
var tmpId = scope.prefix + scope.suffix;
|
|
|
|
if (scope.suffix && scope.suffix.trim() != '') {
|
|
scope.value = tmpId;
|
|
} else {
|
|
scope.value = null;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
|