diff --git a/application.properties b/application.properties index ad2bb6b4..28410b73 100644 --- a/application.properties +++ b/application.properties @@ -2,4 +2,4 @@ #Wed Dec 21 11:09:46 AEDT 2016 app.grails.version=2.5.6 app.name=profile-hub -app.version=2.3 +app.version=2.4 diff --git a/grails-app/assets/javascripts/profileEditor/controllers/CreateProfileController.js b/grails-app/assets/javascripts/profileEditor/controllers/CreateProfileController.js index 0b635b46..e5ef0868 100644 --- a/grails-app/assets/javascripts/profileEditor/controllers/CreateProfileController.js +++ b/grails-app/assets/javascripts/profileEditor/controllers/CreateProfileController.js @@ -1,7 +1,7 @@ /** * Controller for handling creating a new profile (via a modal popup) */ -profileEditor.controller('CreateProfileController', function (profileService, $modalInstance, opusId, duplicateExisting) { +profileEditor.controller('CreateProfileController', function (profileService, messageService, $modalInstance, opusId, duplicateExisting) { var self = this; self.opusId = opusId; @@ -44,14 +44,18 @@ profileEditor.controller('CreateProfileController', function (profileService, $m }; self.searchByScientificName = function () { - var searchResult = profileService.profileSearch(self.opusId, self.profileToCopy, true); - searchResult.then(function (data) { - self.profiles = data; - }, - function () { - messageService.alert("Failed to perform search for '" + self.searchTerm + "'."); - } - ); + if (!self.profileToCopy || self.profileToCopy === undefined || self.profileToCopy.length <= 0) { + self.profiles = []; + } else { + var searchResult = profileService.profileSearch(self.opusId, self.profileToCopy, true); + searchResult.then(function (data) { + self.profiles = data; + }, + function () { + messageService.alert("Failed to perform search for '" + self.searchTerm + "'."); + } + ); + } }; self.valid = function() { diff --git a/grails-app/assets/javascripts/profileEditor/controllers/MapController.js b/grails-app/assets/javascripts/profileEditor/controllers/MapController.js index a8e3a833..48721616 100644 --- a/grails-app/assets/javascripts/profileEditor/controllers/MapController.js +++ b/grails-app/assets/javascripts/profileEditor/controllers/MapController.js @@ -303,7 +303,8 @@ profileEditor.controller('MapController', function ($scope, profileService, util point: { colour: self.opus.mapConfig.mapPointColour, mapAttribution: self.opus.mapConfig.mapAttribution - } + }, + facetGroupUrl: config.facetGroupUrl } ); diff --git a/grails-app/assets/javascripts/profileEditor/controllers/PublicationController.js b/grails-app/assets/javascripts/profileEditor/controllers/PublicationController.js index b7b57517..c66afd73 100644 --- a/grails-app/assets/javascripts/profileEditor/controllers/PublicationController.js +++ b/grails-app/assets/javascripts/profileEditor/controllers/PublicationController.js @@ -25,7 +25,7 @@ profileEditor.controller('PublicationController', function (profileService, util promise.then(function () { loadPublications(); }, function () { - messageService.alert("An error occurred while creating the snapshot."); + messageService.alertStayOn("An error occurred while creating the snapshot. The error might be due to profile not having an author."); }); }); }; diff --git a/grails-app/assets/javascripts/profileEditor/directives/masterList.js b/grails-app/assets/javascripts/profileEditor/directives/masterList.js index 5e47274f..a22109dc 100644 --- a/grails-app/assets/javascripts/profileEditor/directives/masterList.js +++ b/grails-app/assets/javascripts/profileEditor/directives/masterList.js @@ -75,6 +75,7 @@ function checkMasterlistSyncStatus() { $log.debug("Chceking masterlist sync status"); + if (!self.opus.uuid) return; profileService.isMasterListSyncing(self.opus.uuid) .then(function(res) { self.isMasterListSyncing = res.response; diff --git a/grails-app/assets/javascripts/profileEditor/directives/vocabularyEditor.js b/grails-app/assets/javascripts/profileEditor/directives/vocabularyEditor.js index c8190eca..261ba708 100644 --- a/grails-app/assets/javascripts/profileEditor/directives/vocabularyEditor.js +++ b/grails-app/assets/javascripts/profileEditor/directives/vocabularyEditor.js @@ -49,7 +49,8 @@ profileEditor.directive('vocabularyEditor', function ($browser) { $scope.removeVocabTerm = function (index, form) { var promise = profileService.findUsagesOfVocabTerm($scope.opusId, $scope.vocabId, $scope.vocabulary.terms[index].termId); promise.then(function (data) { - if (data.usageCount == 0) { + if (data.usageCount == 0 && + $filter('filter')($scope.replacements, {'newTermName':$scope.vocabulary.terms[index].name}).length == 0) { var deletedItemOrder = $scope.vocabulary.terms[index].order; $scope.vocabulary.terms.splice(index, 1); @@ -85,9 +86,15 @@ profileEditor.directive('vocabularyEditor', function ($browser) { return $scope.vocabulary.terms[existingTermIndex]; }, terms: function() { - var terms = angular.copy($scope.vocabulary.terms); - var deletedItemOrder = terms[existingTermIndex].order; - terms.splice(existingTermIndex, 1); + var terms = []; + var itemToDel = $scope.vocabulary.terms[existingTermIndex]; + var deletedItemOrder = $scope.vocabulary.terms[existingTermIndex].order; + angular.forEach($scope.vocabulary.terms, function(term) { + if ($filter('filter')($scope.replacements, {'existingTermId':term.termId}).length == 0 && + term.termId != itemToDel.termId) { + terms.push(term); + } + }); angular.forEach(terms, function(term) { if (term.order > deletedItemOrder) { diff --git a/grails-app/assets/javascripts/profileEditor/templates/commentContent.tpl.htm b/grails-app/assets/javascripts/profileEditor/templates/commentContent.tpl.htm index b956c271..988ab90e 100644 --- a/grails-app/assets/javascripts/profileEditor/templates/commentContent.tpl.htm +++ b/grails-app/assets/javascripts/profileEditor/templates/commentContent.tpl.htm @@ -9,11 +9,12 @@ -
- -
diff --git a/grails-app/assets/javascripts/profileEditor/templates/nomenclature.tpl.htm b/grails-app/assets/javascripts/profileEditor/templates/nomenclature.tpl.htm index 14a65c01..46190f6f 100644 --- a/grails-app/assets/javascripts/profileEditor/templates/nomenclature.tpl.htm +++ b/grails-app/assets/javascripts/profileEditor/templates/nomenclature.tpl.htm @@ -28,8 +28,8 @@
-   -
+
  +
Remove vocabulary term