Skip to content

Commit

Permalink
code cleanup, switch to feature-richer pdf viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r0x committed Sep 13, 2017
1 parent 0d29e9c commit 766dd3b
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 228 deletions.
23 changes: 1 addition & 22 deletions app.js
Expand Up @@ -464,29 +464,8 @@ spacialistApp.directive('fileList', function(fileService) {
availableTags: '=',
searchTerms: '='
},
controller: 'fileCtrl'
};
});

spacialistApp.directive('oldImageList', function(fileService) {
return {
restrict: 'E',
templateUrl: 'includes/image-list.html',
scope: {
onScrollLoad: '&',
scrollContainer: '=',
imageData: '=',
imageType: '=',
showTags: '=',
searchTerms: '='
},
controller: 'fileCtrl',
link: function(scope, elements, attrs) {
scope.availableTags = fileService.availableTags;
scope.$root.$on('image:delete:linked', function(event, args) {
scope.tmpData.linked = [];
});
}
controllerAs: '$ctrl'
};
});

Expand Down
76 changes: 38 additions & 38 deletions bibliography.html
Expand Up @@ -6,13 +6,13 @@
<div class="input-group-addon">
<i class="material-icons">search</i>
</div>
<input type="text" class="form-control" placeholder="{{'literature.search-placeholder'|translate}}" ng-model="searchTerm">
<input type="text" class="form-control" placeholder="{{'literature.search-placeholder'|translate}}" ng-model="$ctrl.searchTerm">
</div>
</div>
<button type="button" class="btn btn-success" id="literature-add-button" ng-click="openAddLiteratureDialog()" ng-if="$ctrl.user.permissions.add_remove_literature">
<button type="button" class="btn btn-success" id="literature-add-button" ng-click="$ctrl.openAddLiteratureDialog()" ng-if="$ctrl.user.permissions.add_remove_literature">
<i class="material-icons">add</i> {{'literature.add'|translate}}
</button>
<button type="file" id="literature-import-button" class="btn btn-primary" ngf-select="importBibTexFile($file, $invalidFiles)" accept="application/rdf+xml,text/plain,application/x-turtle" ngf-max-size="10MB" ng-if="$ctrl.user.permissions.add_remove_literature">
<button type="file" id="literature-import-button" class="btn btn-primary" ngf-select="$ctrl.importBibTexFile($file, $invalidFiles)" accept="application/rdf+xml,text/plain,application/x-turtle" ngf-max-size="10MB" ng-if="$ctrl.user.permissions.add_remove_literature">
Import BibTex File
</button>
</form>
Expand All @@ -21,45 +21,45 @@
<thead>
<tr>
<td>
<a href="" ng-click="sortType = 'type'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'type'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.type'|translate}}
<i ng-show="sortType == 'type' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'type' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'type' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'type' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'author'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'author'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.author'|translate}}
<i ng-show="sortType == 'author' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'author' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'author' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'author' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'editor'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'editor'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.editor'|translate}}
<i ng-show="sortType == 'editor' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'editor' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'editor' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'editor' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'title'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'title'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.title'|translate}}
<i ng-show="sortType == 'title' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'title' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'title' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'title' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'journal'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'journal'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.journal'|translate}}
<i ng-show="sortType == 'journal' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'journal' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'journal' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'journal' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'year'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'year'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.year'|translate}}
<i ng-show="sortType == 'year' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'year' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'year' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'year' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
Expand All @@ -84,24 +84,24 @@
{{'literature.bibtex.series'|translate}}
</td>
<td>
<a href="" ng-click="sortType = 'booktitle'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'booktitle'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.booktitle'|translate}}
<i ng-show="sortType == 'booktitle' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'booktitle' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'booktitle' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'booktitle' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'publisher'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'publisher'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.publisher'|translate}}
<i ng-show="sortType == 'publisher' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'publisher' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'publisher' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'publisher' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'address'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'address'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.address'|translate}}
<i ng-show="sortType == 'address' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'address' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'address' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'address' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
Expand All @@ -114,17 +114,17 @@
{{'literature.updated-at'|translate}}
</td>
<td>
<a href="" ng-click="sortType = 'misc'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'misc'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.misc'|translate}}
<i ng-show="sortType == 'misc' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'misc' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'misc' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'misc' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
<a href="" ng-click="sortType = 'howpublished'; sortReverse = !sortReverse">
<a href="" ng-click="$ctrl.sortType = 'howpublished'; $ctrl.sortReverse = !$ctrl.sortReverse">
{{'literature.bibtex.howpublished'|translate}}
<i ng-show="sortType == 'howpublished' && !sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="sortType == 'howpublished' && sortReverse" class="material-icons">arrow_drop_up</i>
<i ng-show="$ctrl.sortType == 'howpublished' && !$ctrl.sortReverse" class="material-icons">arrow_drop_down</i>
<i ng-show="$ctrl.sortType == 'howpublished' && $ctrl.sortReverse" class="material-icons">arrow_drop_up</i>
</a>
</td>
<td>
Expand All @@ -145,7 +145,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="entry in $ctrl.bibliography | orderBy:['!' + sortType, sortType]:sortReverse | filter:searchTerm">
<tr ng-repeat="entry in $ctrl.bibliography | orderBy:['!' + $ctrl.sortType, $ctrl.sortType]:$ctrl.sortReverse | filter:$ctrl.searchTerm">
<td>
{{ entry.type }}
</td>
Expand Down Expand Up @@ -219,7 +219,7 @@
{{ entry.school }}
</td>
<td ng-if="$ctrl.user.permissions.add_remove_literature">
<button type="button" class="btn btn-danger" ng-click="deleteLiteratureEntry(entry)">
<button type="button" class="btn btn-danger" ng-click="$ctrl.deleteLiteratureEntry(entry)">
<i class="material-icons">delete</i>
</button>
</td>
Expand Down
25 changes: 13 additions & 12 deletions controllers/bibliographyCtrl.js
@@ -1,18 +1,19 @@
spacialistApp.controller('bibliographyCtrl', function($scope, literatureService) {
$scope.sortType = 'author';
$scope.sortReverse = false;
$scope.searchTerm = '';
var localBibliography = this.bibliography;
spacialistApp.controller('bibliographyCtrl', function(literatureService) {
var vm = this;

$scope.openAddLiteratureDialog = function() {
literatureService.openAddLiteratureDialog(localBibliography);
vm.sortType = 'author';
vm.sortReverse = false;
vm.searchTerm = '';

vm.openAddLiteratureDialog = function() {
literatureService.openAddLiteratureDialog(vm.bibliography);
};

$scope.importBibTexFile = function(file, invalidFiles) {
literatureService.importBibTexFile(file, invalidFiles, localBibliography);
vm.importBibTexFile = function(file, invalidFiles) {
literatureService.importBibTexFile(file, invalidFiles, vm.bibliography);
};

$scope.deleteLiteratureEntry = function(entry) {
literatureService.deleteLiteratureEntry(entry, localBibliography);
}
vm.deleteLiteratureEntry = function(entry) {
literatureService.deleteLiteratureEntry(entry, vm.bibliography);
};
});
18 changes: 9 additions & 9 deletions controllers/dataEditorCtrl.js
@@ -1,31 +1,31 @@
spacialistApp.controller('dataEditorCtrl', ['$scope', 'dataEditorService', 'mainService', function($scope, dataEditorService, mainService) {
spacialistApp.controller('dataEditorCtrl', ['dataEditorService', 'mainService', function(dataEditorService, mainService) {
var vm = this;

$scope.addNewAttribute = function() {
vm.addNewAttribute = function() {
dataEditorService.addNewAttributeWindow(vm.attributetypes, vm.attributes);
};

$scope.onDeleteAttribute = function(attr) {
vm.onDeleteAttribute = function(attr) {
dataEditorService.deleteAttribute(attr, vm.attributes);
};

$scope.addNewContextType = function() {
vm.addNewContextType = function() {
dataEditorService.addNewContextTypeWindow(vm.geometryTypes, vm.contextTypes);
};

$scope.editContextType = function(e) {
vm.editContextType = function(e) {
dataEditorService.editContextType(e);
};

$scope.deleteContextType = function(e) {
vm.deleteContextType = function(e) {
dataEditorService.deleteContextType(e, vm.contextTypes, vm.concepts[e.thesaurus_url].label);
};

$scope.onRemoveAttrFromCt = function(attr) {
vm.onRemoveAttrFromCt = function(attr) {
dataEditorService.removeAttributeFromContextType(vm.contextType, attr, vm.fields);
};

$scope.onOrderAttrOfCt = {
vm.onOrderAttrOfCt = {
up: function(attr) {
dataEditorService.moveAttributeOfContextTypeUp(attr, vm.fields);
},
Expand All @@ -34,7 +34,7 @@ spacialistApp.controller('dataEditorCtrl', ['$scope', 'dataEditorService', 'main
}
};

$scope.addAttributeToContextType = function() {
vm.addAttributeToContextType = function() {
dataEditorService.addAttributeToContextTypeWindow(vm.contextType, vm.fields, vm.attributes, vm.concepts);
};
}]);
12 changes: 7 additions & 5 deletions controllers/fileCtrl.js
@@ -1,17 +1,19 @@
spacialistApp.controller('fileCtrl', ['$scope', 'fileService', 'mainService', 'snackbarService', '$translate', function($scope, fileService, mainService, snackbarService, $translate) {
$scope.getMimeType = fileService.getMimeType;
spacialistApp.controller('fileCtrl', ['fileService', 'mainService', 'snackbarService', '$translate', function(fileService, mainService, snackbarService, $translate) {
var vm = this;

$scope.search = {
vm.getMimeType = fileService.getMimeType;

vm.search = {
terms: {
tags: []
}
};

$scope.addTag = function(file, item) {
vm.addTag = function(file, item) {
fileService.addTag(file, item);
};

$scope.removeTag = function(file, item) {
vm.removeTag = function(file, item) {
fileService.removeTag(file, item);
};
}]);
16 changes: 8 additions & 8 deletions controllers/layerEditorCtrl.js
@@ -1,15 +1,15 @@
spacialistApp.controller('layerEditorCtrl', ['$scope', 'layerEditorService', function($scope, layerEditorService) {
var localLayers = this.avLayers;
spacialistApp.controller('layerEditorCtrl', ['layerEditorService', function(layerEditorService) {
var vm = this;

$scope.addNewBaselayer = function() {
layerEditorService.addNewBaselayer(localLayers);
vm.addNewBaselayer = function() {
layerEditorService.addNewBaselayer(vm.avLayers);
};

$scope.addNewOverlay = function() {
layerEditorService.addNewOverlay(localLayers);
vm.addNewOverlay = function() {
layerEditorService.addNewOverlay(vm.avLayers);
};

$scope.onDelete = function(l) {
layerEditorService.onDelete(l, localLayers);
vm.onDelete = function(l) {
layerEditorService.onDelete(l, vm.avLayers);
};
}]);
6 changes: 1 addition & 5 deletions controllers/mainCtrl.js
Expand Up @@ -18,10 +18,6 @@ spacialistApp.controller('mainCtrl', ['$scope', 'mainService', 'mapService', 'fi
vm.currentElement.form.$setPristine();
};

vm.onSourceAdd = function(entry) {
console.log(entry);
};

if(vm.tab == 'map') {
mapService.setupLayers(vm.layer, vm.map, vm.contexts, vm.concepts);
mapService.initMapObject().then(function(obj) {
Expand Down Expand Up @@ -144,7 +140,7 @@ spacialistApp.controller('mainCtrl', ['$scope', 'mainService', 'mapService', 'fi
]
];

$scope.hasSources = function(element) {
vm.hasSources = function(element) {
return Object.keys(element.sources).length > 0;
};

Expand Down

0 comments on commit 766dd3b

Please sign in to comment.