Skip to content

Commit

Permalink
Merge pull request #249 from AtlasOfLivingAustralia/1.1.12
Browse files Browse the repository at this point in the history
1.1.12
  • Loading branch information
chrisala committed Jun 19, 2015
2 parents c1a09e1 + 80ee555 commit d16a8e5
Show file tree
Hide file tree
Showing 19 changed files with 496 additions and 307 deletions.
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#Wed Aug 21 09:13:16 EST 2013
app.grails.version=2.4.4
app.name=fieldcapture
app.version=1.1.11-SNAPSHOT
app.version=1.1.12-SNAPSHOT
9 changes: 7 additions & 2 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ if (Environment.current == Environment.DEVELOPMENT) {
}
def pluginLocation = props.getProperty("fieldcapture-hubs-plugin.location") ?: '../fieldcapture-hubs/fieldcapture-hubs-plugin'
grails.plugin.location.'fieldcapture-plugin' = pluginLocation

def testPluginLocation = props.getProperty("fieldcapture-test-plugin.location") ?: '../fieldcapture-test-plugin'
grails.plugin.location.'fieldcapture-test-plugin' = testPluginLocation

}
grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
Expand All @@ -53,7 +57,7 @@ grails.project.dependency.resolution = {
}

dependencies {
// The dependencies from the fieldcapture-hubs-plugin are all we need.

}

plugins {
Expand All @@ -69,7 +73,8 @@ grails.project.dependency.resolution = {
build ":release:3.0.1"

if (Environment.current != Environment.DEVELOPMENT) {
compile ":fieldcapture-plugin:1.1.3.1-SNAPSHOT"
compile ":fieldcapture-plugin:1.1.4-SNAPSHOT"
test ":fieldcapture-test:0.1-SNAPSHOT"
}

}
Expand Down
19 changes: 19 additions & 0 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,27 @@ environments {
logging.dir = '.'
}
test {
server.port = "8087"
grails.host = "http://devt.ala.org.au"
serverName = "${grails.host}:${server.port}"
grails.serverURL = serverName + "/${appName}"
layout.skin = "nrm"
runWithNoExternalConfig = true
def casBaseUrl = "https://auth.ala.org.au"
security.cas.appServerName="${serverName}"
security.cas.contextPath="/${appName}"
security.cas.casServerName="${casBaseUrl}"
security.cas.uriFilterPattern=".*/user/.*,.*/site/(?!index).*,.*/project/(?!index).*,.*/activity/(?!index).*,.*/output/(?!index).*,.*/image/(?!index).*,.*/admin/.*,i.*/proxy/speciesListPost,.*/proxy/documentUpdate,.*/proxy/deleteDocument,.*/home/advanced,.*/organisation/(?!index).*,.*/organisation/(?!list).*"
security.cas.uriExclusionFilterPattern="/images.*,/css.*,/js.*,/less.*"
security.cas.authenticateOnlyIfLoggedInPattern="/,/;.*,/[A-Za-z0-9]+/?,.*/project/index.*,.*/site/index.*,.*/activity/index.*,.*/output/index.*,.*/ajax/keepSessionAlive,.*/search/.*,.*/home/.*,.*/organisation/index.*,.*/organisation/list.*"
gateway="true"
security.cas.casServerUrlPrefix="${casBaseUrl}/cas"
security.cas.loginUrl="${casServerUrlPrefix}/login"
logging.dir = '.'
test.user.admin.email = '[email protected]'
test.user.admin.password = 'testing!'
ecodata.baseUrl = 'http://devt.ala.org.au:8080/ecodata/ws/'

}
production {
grails.logging.jul.usebridge = false
Expand Down
13 changes: 13 additions & 0 deletions grails-app/controllers/au/org/ala/merit/ProjectController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ class ProjectController extends au.org.ala.fieldcapture.ProjectController {
static defaultAction = "index"
static ignore = ['action','controller','id']

/** Overrides the projectContent method in the fieldcapture controller to include the MERI plan and risks and threats content */
protected Map projectContent(project, user, programs) {
def program = programs.programs.find{it.name == project.associatedProgram}
[overview:[label:'Overview', visible: true, default:true, type:'tab'],
documents:[label:'Documents', visible: true, type:'tab'],
details:[label:'MERI Plan', disabled:!user?.hasViewAccess, disabled:!user?.hasViewAccess, visible:program?.optionalProjectContent?.contains('MERI Plan'), type:'tab'],
plan:[label:'Activities', visible:true, disabled:!user?.hasViewAccess, type:'tab'],
risksAndThreats:[label:'Risks and Threats', disabled:!user?.hasViewAccess, visible:user?.hasViewAccess && program?.optionalProjectContent?.contains('Risks and Threats')],
site:[label:'Sites', visible: true, disabled:!user?.hasViewAccess, type:'tab'],
dashboard:[label:'Dashboard', visible: true, disabled:!user?.hasViewAccess, type:'tab'],
admin:[label:'Admin', visible:(user?.isAdmin || user?.isCaseManager), type:'tab']]
}

@PreAuthorise(accessLevel = 'admin')
def ajaxSubmitReport(String id) {

Expand Down
3 changes: 2 additions & 1 deletion grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ label.otherFacet=<abbr title="Other areas">Other Regions</abbr>
label.status=<abbr title="Project status">Project Status</abbr>
label.electFacet = <abbr title="Project status">Federal Electorates</abbr>
label.cmzFacet = <abbr title="Conservation Management Zones">CMZ</abbr>

label.meriPlanAssetFacet=<abbr title="Assets addressed in the MERI plan">Assets Addressed</abbr>
label.partnerOrganisationTypeFacet=<abbr title="Organisation type of partner organisations">Partner Organisations</abbr>


label.T=<i class=\"icon-ok\"></i>
Expand Down
25 changes: 22 additions & 3 deletions grails-app/views/project/_editProjectDetails.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div data-bind="if: userIsCaseManager()">
<div data-bind="if: planStatus() == 'approved'">
<div class="form-actions">
<b>Case manager actions:</b>
<b>Grant manager actions:</b>
<button type="button" data-bind="click: modifyPlan" id="modify-plan" class="btn btn-info">Modify MERI Plan</button>
<br/><br/>
<ul>
Expand All @@ -26,6 +26,7 @@

</div>
</div>
<g:if test="${projectContent.details.visible}">
<div class="row-fluid">
<div class="control-group">
<div style="float: left;" class="controls">
Expand Down Expand Up @@ -382,6 +383,24 @@
</div>
</div>

</g:if>
<g:else>
<div>
<div data-bind="if: planStatus() == 'approved'">
<span class="badge badge-success" style="font-size: 13px;">This plan has been approved</span>
<span data-bind="if:detailsLastUpdated"> <br/>Last update date : <span data-bind="text:detailsLastUpdated.formattedDate"></span></span>
</div>
<div data-bind="if: planStatus() == '' || planStatus() == 'not approved' ">
<span class="badge badge-warning" style="font-size: 13px;">This plan is not yet approved</span>
<span data-bind="if:detailsLastUpdated"><br/>Last update date : <span data-bind="text:detailsLastUpdated.formattedDate"></span></span>
</div>
<div data-bind="if: planStatus() == 'submitted'">
<span class="badge badge-info" style="font-size: 13px;">This plan has been submitted for approval</span>
<span data-bind="if:detailsLastUpdated"><br/>Last update date : <span data-bind="text:detailsLastUpdated.formattedDate"></span></span>
</div>
</div>

</g:else>

<div id="save-details-result-placeholder"></div>

Expand All @@ -395,7 +414,7 @@
<br/>

<button type="button" data-bind="click: saveProjectDetails, disable: isProjectDetailsLocked()" id="project-details-save" class="btn btn-primary">Save changes</button>
<button type="button" id="details-cancel" class="btn">Cancel</button>
<button type="button" id="details-cancel" class="btn" data-bind="click: cancelProjectDetailsEdits">Cancel</button>

<!-- Admin - submit to approval. -->
<div data-bind="if: userIsAdmin()">
Expand All @@ -405,7 +424,7 @@
<ul>
<li>Build your project by adding MERI plan details, activities and project targets information.</li>
</ul>
<button type="button" data-bind="click: saveAndSubmitChanges" id="modify-plan" class="btn btn-info">Submit for approval</button>
<button type="button" data-bind="click: saveAndSubmitChanges" class="btn btn-info">Submit for approval</button>
</div>
<div data-bind="if: planStatus() == 'submitted' || planStatus() == 'approved'">
<hr/>
Expand Down
47 changes: 21 additions & 26 deletions grails-app/views/project/index.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,8 @@
</div>

<!-- content tabs -->
<g:set var="tabIsActive"><g:if test="${user?.hasViewAccess}">tab</g:if></g:set>
<ul id="projectTabs" class="nav nav-tabs big-tabs">
<li class="active"><a href="#overview" id="overview-tab" data-toggle="tab">Overview</a></li>
<li><a href="#documents" id="documents-tab" data-toggle="tab">Documents</a></li>
<li><a href="#details" id="details-tab" data-toggle="${tabIsActive}">MERI Plan</a></li>
<li><a href="#plan" id="plan-tab" data-toggle="${tabIsActive}">Activities</a></li>
<li><a href="#site" id="site-tab" data-toggle="${tabIsActive}">Sites</a></li>
<li><a href="#dashboard" id="dashboard-tab" data-toggle="${tabIsActive}">Dashboard</a></li>
<g:if test="${user?.isAdmin || user?.isCaseManager}"><li><a href="#admin" id="admin-tab" data-toggle="tab">Admin</a></li></g:if>
<fc:tabList tabs="${projectContent}"/>
</ul>


Expand All @@ -117,6 +110,7 @@
<g:render plugin="fieldcapture-plugin" template="docs"/>
</div>

<g:if test="${projectContent.details.visible}">
<div class="tab-pane" id="details">
<!-- Project Details -->
<g:render template="projectDetails" model="[project: project]"/>
Expand All @@ -131,28 +125,24 @@
</div>
</div>
</div>

</g:if>


<g:if test="${user?.hasViewAccess}">
<div class="tab-pane" id="plan">
<!-- PLANS -->
<g:if test="${useAltPlan}">
<g:render plugin="fieldcapture-plugin" template="/shared/plan"
model="[activities:activities ?: [], sites:project.sites ?: [], showSites:true]"/>
</g:if>
<g:else>
<g:render template="/shared/activitiesPlan"
model="[activities:activities ?: [], sites:project.sites ?: [], showSites:true]"/>
</g:else>
<g:render template="/shared/activitiesPlan"
model="[activities:activities ?: [], sites:project.sites ?: [], showSites:true]"/>
<g:if test="${user?.isCaseManager}">
<div class="validationEngineContainer" id="grantmanager-validation">
<g:render template="grantManagerSettings" model="[project:project]"/>
</div>
</g:if>
<g:if test="${projectContent.risksAndThreats.visible}">
<div class="validationEngineContainer" id="risk-validation">
<g:render template="riskTable" model="[project:project]"/>
</div>
</g:if>
</div>

<div class="tab-pane" id="site">
Expand All @@ -171,7 +161,7 @@

</g:if>

<g:if test="${user?.isAdmin || user?.isCaseManager}">
<g:if test="${projectContent.admin.visible}">
<g:set var="activeClass" value="class='active'"/>
<div class="tab-pane" id="admin">
<!-- ADMIN -->
Expand Down Expand Up @@ -213,7 +203,7 @@
<g:set var="activeClass" value=""/>
</g:if>

<!-- PROJECT DETAILS -->
<!-- PROJECT DETAILS -->
<div id="projectDetails" class="pill-pane">
<!-- Edit project details -->
<h3>MERI Plan</h3>
Expand All @@ -224,7 +214,6 @@
</div>
</div>
</div>

<div id="editNewsAndEvents" class="pill-pane">
<g:render plugin="fieldcapture-plugin" template="editProjectContent" model="${[attributeName:'newsAndEvents', header:'News and events']}"/>
<hr/>
Expand Down Expand Up @@ -333,10 +322,7 @@
$('#cancel').click(function () {
document.location.href = "${createLink(action: 'index', id: project.projectId)}";
});
$('#details-cancel').click(function () {
amplify.store(PROJECT_DETAILS_KEY, null);
document.location.href = "${createLink(action: 'index', id: project.projectId)}";
});

$('#risks-cancel').click(function () {
amplify.store(PROJECT_RISKS_KEY, null);
document.location.href = "${createLink(action: 'index', id: project.projectId)}";
Expand Down Expand Up @@ -377,6 +363,12 @@
self.saveProject(false);
};

self.cancelProjectDetailsEdits = function() {
self.details.cancelAutosave();

document.location.reload(true);
};

self.saveAnnouncements= function(){
var tmp = {};
self.details.status('active');
Expand Down Expand Up @@ -662,7 +654,9 @@
resultsMessageId:'save-details-result-placeholder',
timeoutMessageSelector:'#timeoutMessage',
errorMessage:"Failed to save MERI Plan: ",
successMessage: 'MERI Plan saved'
successMessage: 'MERI Plan saved',
preventNavigationIfDirty:true,
defaultDirtyFlag:ko.dirtyFlag
});
autoSaveModel(
viewModel.risks,
Expand All @@ -674,7 +668,8 @@
resultsMessageId:'summary-result-placeholder',
timeoutMessageSelector:'#timeoutMessage',
errorMessage:"Failed to save risks details: ",
successMessage: 'Successfully saved'
successMessage: 'Successfully saved',
defaultDirtyFlag:ko.dirtyFlag
});

var meriPlanVisible = false;
Expand Down
14 changes: 14 additions & 0 deletions scripts/exportFunctionalTestData.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "No data set name argument supplied"
exit 1
fi

export DATABASE_NAME=ecodata-test
export DATA_PATH=test/functional/resources/$1

# Configure the ecodata-test database to be how the functional tests expect it.
mongoexport --db $DATABASE_NAME --collection organisation --out $DATA_PATH/organisation.json
mongoexport --db $DATABASE_NAME --collection userPermission --out $DATA_PATH/userPermission.json
mongoexport --db $DATABASE_NAME --collection project --out $DATA_PATH/project.json
22 changes: 22 additions & 0 deletions scripts/loadFunctionalTestData.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
echo "This script should be run from the project root directory"
if [ -z "$1" ]
then
echo "No data set name argument supplied"
exit 1
fi

export DATABASE_NAME=ecodata-test
export DATA_PATH=$1

# Configure the ecodata-test database to be how the functional tests expect it.
mongo $DATABASE_NAME --eval "db.dropDatabase()"

# Configure the ecodata-test database to be how the functional tests expect it.
mongoimport --db $DATABASE_NAME --collection organisation --file $DATA_PATH/organisation.json
mongoimport --db $DATABASE_NAME --collection project --file $DATA_PATH/project.json
mongoimport --db $DATABASE_NAME --collection userPermission --file $DATA_PATH/userPermission.json
mongoimport --db $DATABASE_NAME --collection setting --file $DATA_PATH/setting.json



13 changes: 13 additions & 0 deletions scripts/startEcodataForFunctionalTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
export ECODATA_DIR=target/ecodata
export ECODATA_BRANCH=master

rm -rf $ECODATA_DIR
git clone https://github.com/AtlasOfLivingAustralia/ecodata.git $ECODATA_DIR
cd $ECODATA_DIR
git checkout $ECODATA_BRANCH


grails test run-app -Dgrails.server.port.http=8080&


2 changes: 1 addition & 1 deletion test/functional/GebConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.firefox.FirefoxDriver

baseUrl = 'https://fieldcapture-test.ala.org.au/'
baseUrl = 'http://devt.ala.org.au:8087/fieldcapture/'
reportsDir = 'target/geb-reports'

// Use htmlunit as the default
Expand Down
36 changes: 0 additions & 36 deletions test/functional/ProjectCRUDSpec.groovy

This file was deleted.

Loading

0 comments on commit d16a8e5

Please sign in to comment.