Skip to content

Commit

Permalink
Adding angularjs interactions - RA-344
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Sep 2, 2014
1 parent 7df7506 commit 08daaf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
25 changes: 20 additions & 5 deletions omod/src/main/webapp/pages/allergy.gsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<%
ui.decorateWith("appui", "standardEmrPage")
ui.includeJavascript("uicommons", "angular.js")
ui.includeJavascript("allergyui", "allergy.js")
%>
<script type="text/javascript">
var breadcrumbs = [
Expand Down Expand Up @@ -29,8 +32,8 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) }
}
</style>

<div ng-app="allergyApp">
<form method="POST">
<div ng-app="allergyApp" ng-controller="allergyController">
<form method="post" action="${ ui.pageLink("allergyui", "allergy", [patientId: patient.id]) }">
<table id="allergy">
<tr>
<td>
Expand All @@ -50,9 +53,21 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) }
<td colspan="2">
<fieldset>
<legend>${ui.message("allergyui.allergen")}:</legend>
<% drugAllergens.each { allergen -> %>
<input type="radio" name="allergen" value="${allergen.id}">${allergen.name}<br/>
<% } %>
<p ng-show="allergyType == 'DRUG'">
<% drugAllergens.each { allergen -> %>
<input type="radio" name="allergen" value="${allergen.id}">${allergen.name}<br/>
<% } %>
</p>
<p ng-show="allergyType == 'FOOD'">
<% foodAllergens.each { allergen -> %>
<input type="radio" name="allergen" value="${allergen.id}">${allergen.name}<br/>
<% } %>
</p>
<p ng-show="allergyType == 'ENVIRONMENT'">
<% environmentalAllergens.each { allergen -> %>
<input type="radio" name="allergen" value="${allergen.id}">${allergen.name}<br/>
<% } %>
</p>
</fieldset>
</td>
<td colspan="2">
Expand Down
5 changes: 5 additions & 0 deletions omod/src/main/webapp/resources/scripts/allergy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var app = angular.module("allergyApp", []);

app.controller("allergyController", [ '$scope', function($scope) {
$scope.allergyType = 'DRUG';
}]);

0 comments on commit 08daaf0

Please sign in to comment.