Skip to content

Commit 3275f77

Browse files
author
sat01a
committed
Exclude "Project Site" from survey site list #1198
1 parent 191068d commit 3275f77

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

Diff for: grails-app/assets/javascripts/projectActivities.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ var ProjectActivitiesSettingsViewModel = function (pActivitiesVM, placeHolder) {
345345
self.create = function (pActivity, caller){
346346
var pActivity = self.current();
347347
var url = fcConfig.projectActivityCreateUrl;
348+
blockUIWithMessage("Saving...");
348349
$.ajax({
349350
url: url,
350351
type: 'POST',
@@ -359,19 +360,25 @@ var ProjectActivitiesSettingsViewModel = function (pActivitiesVM, placeHolder) {
359360
}
360361
});
361362
self.updateLogo(data);
362-
showAlert("Successfully created", "alert-success", self.placeHolder);
363+
blockUIWithMessage("Successfully created");
363364
} else {
364-
showAlert(errorMsgSurveyInfo, "alert-error", self.placeHolder);
365+
blockUIWithMessage(errorMsgSurveyInfo);
365366
}
366367
},
367368
error: function (data) {
368-
showAlert("Error creating the survey -" + data.status, "alert-error", self.placeHolder);
369+
blockUIWithMessage("Error creating the survey -" + data.status);
370+
},
371+
complete: function() {
372+
setTimeout(function () {
373+
$.unblockUI();
374+
}, 2500);
369375
}
370376
});
371377
};
372378

373379
self.update = function(pActivity, caller){
374380
var url = fcConfig.projectActivityUpdateUrl + "/" + pActivity.projectActivityId();
381+
blockUIWithMessage("Saving...");
375382
$.ajax({
376383
url: url,
377384
type: 'POST',
@@ -382,13 +389,18 @@ var ProjectActivitiesSettingsViewModel = function (pActivitiesVM, placeHolder) {
382389
if (result && result.message == 'updated') {
383390
self.updateLogo(data);
384391
self.updateProjectResources(data);
385-
showAlert("Successfully updated ", "alert-success", self.placeHolder);
392+
blockUIWithMessage("Successfully updated...");
386393
} else {
387-
showAlert(errorMsgSurveyInfo, "alert-error", self.placeHolder);
394+
blockUIWithMessage(errorMsgSurveyInfo);
388395
}
389396
},
390397
error: function (data) {
391-
showAlert("Error updating the survey -" + data.status, "alert-error", self.placeHolder);
398+
blockUIWithMessage("Error updating the survey -" + data.status);
399+
},
400+
complete: function() {
401+
setTimeout(function () {
402+
$.unblockUI();
403+
}, 2500);
392404
}
393405
});
394406
};

Diff for: grails-app/assets/javascripts/projectActivity.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var ProjectActivity = function (params) {
1919
self.selectFromSitesOnly = ko.observable(pActivity.selectFromSitesOnly);
2020
self.legalCustodianOrganisation = ko.utils.unwrapObservable(pActivity.legalCustodianOrganisation || organisationName);
2121
self.sites = ko.observableArray();
22+
self.excludeProjectSite = ko.observable(pActivity.excludeProjectSite ? pActivity.excludeProjectSite : false);
2223
self.allowPolygons = ko.observable(('allowPolygons' in pActivity)? pActivity.allowPolygons : false);
2324
self.allowPoints = ko.observable(('allowPoints' in pActivity)? pActivity.allowPoints : true);
2425
self.defaultZoomArea = ko.observable(('defaultZoomArea' in pActivity)? pActivity.defaultZoomArea : project?project.projectSiteId:'');
@@ -630,6 +631,7 @@ var ProjectActivity = function (params) {
630631
jsData.selectFromSitesOnly = self.selectFromSitesOnly();
631632
jsData.baseLayersName = self.baseLayersName();
632633
jsData.allowPolygons = self.allowPolygons();
634+
jsData.excludeProjectSite = self.excludeProjectSite();
633635
jsData.allowPoints = self.allowPoints();
634636
jsData.defaultZoomArea = self.defaultZoomArea();
635637
}

Diff for: grails-app/controllers/au/org/ala/biocollect/BioActivityController.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ class BioActivityController {
246246
model.autocompleteUrl = "${request.contextPath}/search/searchSpecies/${pActivity.projectActivityId}?limit=10"
247247
addOutputModel(model)
248248
addDefaultSpecies(activity)
249+
// Remove projectSite from the survey site list
250+
model?.projectSite && model.pActivity?.excludeProjectSite ? model.pActivity.sites?.remove(model.projectSite) : null
249251
}
250252

251253
if (mobile && flash.message) {
@@ -275,6 +277,9 @@ class BioActivityController {
275277
model.id = id
276278
model.speciesConfig = [surveyConfig: [speciesFields: pActivity?.speciesFields]]
277279
model.returnTo = params.returnTo ? params.returnTo : g.createLink(controller: 'bioActivity', action: 'index') + "/" + id
280+
// Remove projectSite from the survey site list
281+
model?.projectSite && model.pActivity?.excludeProjectSite ? model.pActivity.sites?.remove(model.projectSite) : null
282+
278283
} else {
279284
flash.message = "Access denied: User is not an owner of this activity ${activity?.activityId}"
280285
if(!mobile) redirect(controller: 'project', action: 'index', id: projectId)

Diff for: grails-app/i18n/messages.properties

+2
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ project.survey.info.submitter=Submitter
341341
project.survey.info.submitter.content=The name of the person submitting the dataset to AEKOS
342342
project.survey.info.submissionPublicationDate=Submission Date
343343
project.survey.info.submissionPublicationDate.content=Date of dataset submission to AEKOS
344+
project.survey.site.config=Survey page, site dropdown config:
345+
project.survey.site.config.content=Remove project site from survey site dropdown list
344346

345347
project.survey.alert.species=Species name
346348
project.survey.alert.species.content=Enter species name

Diff for: grails-app/views/projectActivity/_sites.gsp

+11
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@
159159
</div>
160160

161161

162+
<div class="row-fluid">
163+
164+
<div class="span12">
165+
<p>
166+
<h3><g:message code="project.survey.site.config"/></h3>
167+
<input type="checkbox" data-bind="checked: excludeProjectSite"/> <g:message code="project.survey.site.config.content"/>
168+
</p>
169+
</div>
170+
171+
</div>
172+
162173
<!--
163174
Not supported.
164175
<div class="row-fluid">

0 commit comments

Comments
 (0)