Skip to content

Commit

Permalink
- Remedy field add to ethnology, in vivo pharmaco and in vitro pharm…
Browse files Browse the repository at this point in the history
…aco views (list and details views)

 - Disable the autogenerated tests which failed
  - Some updates of the UI CSS
  • Loading branch information
acheype committed Jul 10, 2017
1 parent 7c71c81 commit 7094267
Show file tree
Hide file tree
Showing 39 changed files with 2,347 additions and 2,471 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class InVitroPharmaco implements Serializable, Comparable<InVitroPharmaco
private Publication publication;

@NotNull
@ManyToOne
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
private Remedy remedy;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class InVivoPharmaco implements Serializable, Comparable<InVivoPharmaco>
private Publication publication;

@NotNull
@ManyToOne
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
private Remedy remedy;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public ResponseEntity<InVitroPharmaco> createInVitroPharmaco(@Valid @RequestBody
if (inVitroPharmaco.getId() != null) {
return ResponseEntity.badRequest().header("Failure", "A new inVitroPharmaco cannot already have an ID").body(null);
}
if (inVitroPharmaco.getRemedy() != null)
inVitroPharmaco.getRemedy().getPlantIngredients().stream().forEach(pi -> pi.setRemedy(inVitroPharmaco.getRemedy()));
InVitroPharmaco result = inVitroPharmacoRepository.save(inVitroPharmaco);
inVitroPharmacoSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/inVitroPharmacos/" + result.getId()))
Expand All @@ -73,6 +75,8 @@ public ResponseEntity<InVitroPharmaco> updateInVitroPharmaco(@Valid @RequestBody
if (inVitroPharmaco.getId() == null) {
return createInVitroPharmaco(inVitroPharmaco);
}
if (inVitroPharmaco.getRemedy() != null)
inVitroPharmaco.getRemedy().getPlantIngredients().stream().forEach(pi -> pi.setRemedy(inVitroPharmaco.getRemedy()));
InVitroPharmaco result = inVitroPharmacoRepository.save(inVitroPharmaco);
inVitroPharmacoSearchRepository.save(inVitroPharmaco);
return ResponseEntity.ok()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public ResponseEntity<InVivoPharmaco> createInVivoPharmaco(@Valid @RequestBody I
if (inVivoPharmaco.getId() != null) {
return ResponseEntity.badRequest().header("Failure", "A new inVivoPharmaco cannot already have an ID").body(null);
}

if (inVivoPharmaco.getRemedy() != null)
inVivoPharmaco.getRemedy().getPlantIngredients().stream().forEach(pi -> pi.setRemedy(inVivoPharmaco.getRemedy()));
InVivoPharmaco result = inVivoPharmacoRepository.save(inVivoPharmaco);
inVivoPharmacoSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/inVivoPharmacos/" + result.getId()))
Expand Down
2 changes: 1 addition & 1 deletion src/main/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ ul#strength {

.cat-test-tag{
background-color: black;
color: white;
color: $gray-dark;
font-size: $font-size-small;
font-weight: bold;
padding: 2px 8px 2px 8px;
Expand Down
Binary file modified src/main/webapp/assets/images/background_quinquina-book.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/mpdbc_carousel1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/mpdbc_carousel2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/mpdbc_carousel3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/webapp/assets/images/mpdbc_carousel4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<script src="scripts/components/entities/inVitroPharmaco/inVitroPharmaco.service.js"></script>
<script src="scripts/components/entities/inVivoPharmaco/inVivoPharmaco.search.service.js"></script>
<script src="scripts/components/entities/inVivoPharmaco/inVivoPharmaco.service.js"></script>
<script src="scripts/components/entities/plantIngredient/piTools.service.js"></script>
<script src="scripts/components/entities/plantIngredient/plantIngredient.search.service.js"></script>
<script src="scripts/components/entities/plantIngredient/plantIngredient.service.js"></script>
<script src="scripts/components/entities/pubSpecies/pubSpecies.search.service.js"></script>
Expand Down Expand Up @@ -204,10 +205,6 @@
<script src="scripts/app/entities/inVivoPharmaco/inVivoPharmaco-dialog.controller.js"></script>
<script src="scripts/app/entities/inVivoPharmaco/inVivoPharmaco.controller.js"></script>
<script src="scripts/app/entities/inVivoPharmaco/inVivoPharmaco.js"></script>
<script src="scripts/app/entities/plantIngredient/plantIngredient-detail.controller.js"></script>
<script src="scripts/app/entities/plantIngredient/plantIngredient-dialog.controller.js"></script>
<script src="scripts/app/entities/plantIngredient/plantIngredient.controller.js"></script>
<script src="scripts/app/entities/plantIngredient/plantIngredient.js"></script>
<script src="scripts/app/entities/pubSpecies/pubSpecies-detail.controller.js"></script>
<script src="scripts/app/entities/pubSpecies/pubSpecies-dialog.controller.js"></script>
<script src="scripts/app/entities/pubSpecies/pubSpecies.controller.js"></script>
Expand Down
13 changes: 7 additions & 6 deletions src/main/webapp/scripts/app/entities/ethnology/ethnologies.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h4 class="modal-title">Confirm delete operation</h4>
<tr>
<th>ID</th>
<th>Publication</th>
<!--<th>Plant Ingredient(s)</th>-->
<th>Remedy</th>
<th>Ethno Relevancy</th>
<th>Treatment Type</th>
<th>Traditional Recipe Details</th>
Expand All @@ -68,11 +68,12 @@ <h4 class="modal-title">Confirm delete operation</h4>
<td>
<a ui-sref="publication.detail({id:ethnology.publication.id})">{{ethnology.publication.title}}</a>
</td>
<!--<td>-->
<!--<span ng-repeat="plantIngredient in ethnology.remedies">-->
<!--<a ui-sref="plantIngredient.detail({id: plantIngredient.id})">{{plantIngredient.species.family + '&nbsp;' + plantIngredient.species.species + ',&nbsp;' + plantIngredient.partUsed}}</a>{{$last ? '' : '&nbsp;/&nbsp;'}}-->
<!--</span>-->
<!--</td>-->
<td>
<span ng-show="ethnology.remedy" ng-repeat="pi in ethnology.remedy.plantIngredients">
<a ui-sref="species.detail({id: pi.species.id})">
{{pi.species.species}}</a>,&nbsp;{{pi.partUsed}}{{$last ? '' : '&nbsp;/&nbsp;'}}
</span>
</td>
<td>{{ethnology.ethnoRelevancy}}</td>
<td>{{ethnology.treatmentType}}</td>
<td>{{ethnology.traditionalRecipeDetails}}</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('malariaplantdbApp')
.controller('EthnologyDetailController', function ($scope, $rootScope, $stateParams, entity, Ethnology, Publication) {
.controller('EthnologyDetailController', function ($scope, $rootScope, $stateParams, entity, Ethnology) {
$scope.ethnology = entity;
$scope.load = function (id) {
Ethnology.get({id: id}, function(result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ <h2><span>Ethnology note</span><span class="small">&nbsp;&nbsp;#{{ethnology.id}}
<a class="form-control-static" ui-sref="publication.detail({id:ethnology.publication.id})">{{ethnology.publication.title}}</a>
</td>
</tr>
<!--<tr>-->
<!--<td>-->
<!--<span>Plant Ingredient(s)</span>-->
<!--</td>-->
<!--<td>-->
<!--<span ng-repeat="plantIngredient in ethnology.remedies">-->
<!--<a class="form-control-static"-->
<!--ui-sref="plantIngredient.detail({id: plantIngredient.id})">{{plantIngredient.species.family + '&nbsp;' + plantIngredient.species.species + ',&nbsp;' + plantIngredient.partUsed}}</a>{{$last ? '' : '&nbsp;/&nbsp;'}}-->
<!--<span>-->
<!--</td>-->
<!--</tr>-->
<tr>
<td>
<span>Remedy</span>
</td>
<td>
<span ng-show="ethnology.remedy" ng-repeat="pi in ethnology.remedy.plantIngredients">
<a ui-sref="species.detail({id: pi.species.id})">
{{pi.species.species}}</a>,&nbsp;{{pi.partUsed}}{{$last ? '' : '&nbsp;/&nbsp;'}}
</span>
</td>
</tr>
<tr>
<td>
<span>Ethno Relevancy</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
'use strict';

angular.module('malariaplantdbApp').controller('EthnologyDialogController',
['$scope', '$stateParams', '$uibModalInstance', 'entity', 'Ethnology', 'Publication', 'Species',
function($scope, $stateParams, $uibModalInstance, entity, Ethnology, Publication, Species) {
['$scope', '$rootScope', '$stateParams', '$uibModalInstance', 'entity', 'Ethnology', 'Publication', 'Species',
'Pitools', function($scope, $rootScope, $stateParams, $uibModalInstance, entity, Ethnology, Publication,
Species, PiTools) {

$scope.ethnology = entity;
$scope.publications = Publication.sortedQuery();
$scope.species = Species.sortedQuery();
$scope.partUsedList = ['Aerial part', 'Aerial part with flower', 'Aerial part with fruit', 'Bark', 'Bulb',
'Essential oil', 'Exsudate', 'Flower', 'Flower bud', 'Fruit', 'Heart wood', 'Inner bark', 'Latex', 'Leaf',
'Leaf bud', 'Leaf petiole', 'Other', 'Part not defined', 'Petal', 'Rhizom', 'Root', 'Root bark', 'Sap',
'Seed', 'Stem', 'Stem and leaf', 'Stem bark', 'Tendril', 'Whole plant'];
$scope.partUsedList = PiTools.partUsedList;

$scope.curSpecies = null;
$scope.curPartUsed = null;

$scope.containsPlantIngredient = function(species, partUsed, list) {
return list.filter(function(listItem) {
return angular.equals(listItem.species, species) &&
angular.equals(listItem.partUsed, partUsed)
}).length > 0;
};


$scope.addPlantIngredient = function(curSpecies, curPartUsed){
if (curSpecies && curPartUsed &&
!$scope.containsPlantIngredient(curSpecies, curPartUsed, $scope.ethnology.remedy.plantIngredients)) {
!PiTools.containsPlantIngredient(curSpecies, curPartUsed, $scope.ethnology.remedy.plantIngredients)) {
$scope.ethnology.remedy.plantIngredients.push({id: null, species: curSpecies, partUsed: curPartUsed});
$scope.curSpecies = null;
$scope.curPartUsed = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ <h4 class="modal-title" id="myEthnologyLabel">Create or edit a Ethnology note</h
<input type="text" class="form-control" id="field_id" name="id"
ng-model="ethnology.id" disabled>
</div>

<div class="form-group">
<label for="field_publication">Publication</label>
<input type="text" class="form-control" id="field_publication" name="publication"
ng-model="ethnology.publication"
uib-typeahead="publication as publication.title for publication in publications | filter:$viewValue"
typeahead-editable="false">
<!--<select class="form-control" id="field_publication" name="publication"-->
<!--ng-model="ethnology.publication"-->
<!--ng-options="publication as publication.title for publication in publications track by publication.title"-->
<!--required>-->
<!--</select>-->
<p class="help-block"
ng-show="editForm.publication.$invalid">
The field is required.
Expand Down Expand Up @@ -82,6 +78,7 @@ <h4 class="modal-title" id="myEthnologyLabel">Create or edit a Ethnology note</h
The list requires one or several values.
</p>
</div>

<div class="form-group">
<label for="field_ethnoRelevancy">Ethno Relevancy</label>
<textarea class="form-control" rows="3" type="text" class="form-control" name="ethnoRelevancy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ angular.module('malariaplantdbApp')
};

$scope.clear = function () {
$scope.ethnology = {ethnoRelevancy: null, treatmentType: null, traditionalRecipeDetails: null, preparationMode: null, administrationRoute: null, id: null};
$scope.ethnology = {ethnoRelevancy: null, treatmentType: null, traditionalRecipeDetails: null,
preparationMode: null, administrationRoute: null, id: null, remedy: {id: null, plantIngredients: []}};
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ <h2><span>In Vitro Pharmaco note</span><span class="small">&nbsp;&nbsp;#{{inVitr
</tr>
<tr>
<td>
<span>Plant Ingredient(s)</span>
<span>Remedy</span>
</td>
<td>
<span ng-repeat="plantIngredient in inVitroPharmaco.remedies">
<a class="form-control-static"
ui-sref="plantIngredient.detail({id: plantIngredient.id})">{{plantIngredient.species.family + '&nbsp;' + plantIngredient.species.species + ',&nbsp;' + plantIngredient.partUsed}}</a>{{$last ? '' : '&nbsp;/&nbsp;'}}
<span>
<span ng-show="inVitroPharmaco.remedy" ng-repeat="pi in inVitroPharmaco.remedy.plantIngredients">
<a ui-sref="species.detail({id: pi.species.id})">
{{pi.species.species}}</a>,&nbsp;{{pi.partUsed}}{{$last ? '' : '&nbsp;/&nbsp;'}}
</span>
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
'use strict';

angular.module('malariaplantdbApp').controller('InVitroPharmacoDialogController',
['$scope', '$stateParams', '$uibModalInstance', 'entity', 'InVitroPharmaco', 'Publication', 'PlantIngredient',
function($scope, $stateParams, $uibModalInstance, entity, InVitroPharmaco, Publication, PlantIngredient) {
['$scope', '$stateParams', '$uibModalInstance', 'entity', 'InVitroPharmaco', 'Publication', 'Species', 'PiTools',
function($scope, $stateParams, $uibModalInstance, entity, InVitroPharmaco, Publication, Species, PiTools) {

$scope.inVitroPharmaco = entity;
$scope.publications = Publication.sortedQuery();
$scope.plantIngredients = PlantIngredient.sortedQuery();
$scope.species = Species.sortedQuery();
$scope.partUsedList = PiTools.partUsedList;

$scope.curSpecies = null;
$scope.curPartUsed = null;

$scope.addPlantIngredient = function(curSpecies, curPartUsed){
if (curSpecies && curPartUsed &&
!PiTools.containsPlantIngredient(curSpecies, curPartUsed, $scope.inVitroPharmaco.remedy.plantIngredients)) {
$scope.inVitroPharmaco.remedy.plantIngredients.push({id: null, species: curSpecies, partUsed: curPartUsed});
$scope.curSpecies = null;
$scope.curPartUsed = null;
}
};

$scope.removePlantIngredient=function(plantIngredient) {
var index = $scope.inVitroPharmaco.remedy.plantIngredients.indexOf(plantIngredient);
$scope.inVitroPharmaco.remedy.plantIngredients.splice(index, 1);
};

$scope.load = function(id) {
InVitroPharmaco.get({id : id}, function(result) {
$scope.inVitroPharmaco = result;
Expand Down
Loading

0 comments on commit 7094267

Please sign in to comment.