Skip to content

Commit

Permalink
Refactored other javascripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
leipert committed Apr 7, 2014
1 parent 3681581 commit 2fe4feb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 96 deletions.
101 changes: 7 additions & 94 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,101 +15,14 @@ angular.module('GSB', [

//Global functions

//Now you can check with str1.startWith(str2) whether a string str1 starts with another string str2
//Define "str1".startsWith("str2") if undefined.
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
/**
* Returns whether the String starts with the given str
* @param str
* @returns {boolean}
*/
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
}
//
//var AddSubjectDropDownCtrl = function($scope, $http) {
// // List of available subject classes that can be added to the workspace.
// $scope.availableSubjectClasses = [];
//
// // Subject selected to be added to the workspace.
// $scope.selectedSubjectClass = null;
//
// // Get Availabe Subject Classes from Server
// $http.get('/app/mockup/classes.json').success(function(data) {
// var availClasses = data.results.bindings;
// for (var key in availClasses) {
// if(availClasses.hasOwnProperty(key)){
// $scope.availableSubjectClasses.push(
// {
// alias: availClasses[key].alias.value,
// uri: availClasses[key].class.value
// }
// );
// }
// // console.log(availClasses[key].alias.value);
// }
// });
//
// $scope.dropDownAddSubject = function() {
// // console.log($scope.selectedSubjectClass);
// if($scope.selectedSubjectClass) { // If the selected option is undefined no subject will be added.
// $scope.$emit('newSubjectEvent', $scope.selectedSubjectClass);
// }
// };
//};

//var ModalCtrl = function($scope, $http, $modal, $log) {
//
// $scope.items = []; // Is this the right place?
//
// // Get Availabe Subject Classes from Server
// $http.get('/app/mockup/classes.json').success(function(data) {
// $scope.items = []; // This is a duplicate of the code 4 lines above. Any ideas which one is preferable?
// var availClasses = data.results.bindings;
// for (var key in availClasses) {
// $scope.items.push(
// {
// alias: availClasses[key].alias.value,
// uri: availClasses[key].class.value
// }
// );
// }
// });
//
// $scope.open = function() {
//
// // Create modalInstance
// var modalInstance = $modal.open({
// templateUrl: 'template/modal.html',
// controller: ModalInstanceCtrl,
// resolve: {
// items: function() {
// return $scope.items;
// }
// }
// });
//
// // User closed modal
// modalInstance.result.then(function(selectedItem) {
// $scope.selected = selectedItem;
// $scope.$emit('newSubjectEvent', selectedItem);
// }, function() {
// $log.info('Modal dismissed at: ' + new Date());
// });
// };
//};
//
//var ModalInstanceCtrl = function($scope, $modalInstance, items) {
//
// $scope.items = items;
// $scope.selected = {
// item: $scope.items[0]
// };
//
// // User clicked okay
// $scope.ok = function() {
// $modalInstance.close($scope.selected.item);
// };
//
// // USer clicked cancel
// $scope.cancel = function() {
// $modalInstance.dismiss('cancel');
// };
//};
//
}
2 changes: 2 additions & 0 deletions app/js/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

angular.module('GSB.config', [])
.constant('globalConfig', {
dataTypeURIs : [
Expand Down
8 changes: 7 additions & 1 deletion app/js/filters.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
'use strict';
angular.module('GSB.filters', [])
// custom filter which filters an array of objects based on a key and an array of allowed values for that key.
.filter('filterArrayOfObjectsByKeyWithArray', function() {
/**
* Filters an array of Objects based on a given Key and allowed values for that key
* @param arrayOfObjects
* @param filterKey
* @param allowedKeyValues
*/
return function(arrayOfObjects, filterKey, allowedKeyValues) {
return arrayOfObjects.filter(
function(currentObject){
Expand Down
7 changes: 6 additions & 1 deletion app/translator/translatorXchangeURIs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

/**
* Translator
* TODO: Make nicer
* TODO: Move to own service!
*
*/

/*
* test function, to run a translation (together with testHTML.html)
Expand Down

0 comments on commit 2fe4feb

Please sign in to comment.