-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rupert Bedford
committed
Oct 12, 2016
1 parent
7084353
commit de79050
Showing
8 changed files
with
103 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import _ from 'lodash'; | ||
|
||
import getPage from './get-page'; | ||
import getForm from './get-form'; | ||
|
||
/** Combine the page and form links for this group. */ | ||
function getLinks(group, patient) { | ||
var links = []; | ||
|
||
_.forEach(group.pages, function(x) { | ||
// Get this link for this page (returns null if not found) | ||
var link = getPage(x.page, patient, group); | ||
|
||
if (!link) { | ||
return; | ||
} | ||
|
||
// Add the page to the list of links | ||
links.push({ | ||
link: link, | ||
weight: x.weight | ||
}); | ||
}); | ||
|
||
// Create a link for each form | ||
_.forEach(group.forms, function(x) { | ||
// Get the link for this form | ||
var link = getForm(x.form, patient); | ||
|
||
links.push({ | ||
link: link, | ||
weight: x.weight | ||
}); | ||
}); | ||
|
||
// Sort pages/forms by weight (lower numbers first) | ||
links = _.sortBy(links, 'weight'); | ||
links = _.map(links, 'link'); | ||
|
||
return links; | ||
} | ||
|
||
export default getLinks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/app/patients/navigation/system-navigation.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import getLinks from '../get-links'; | ||
|
||
import templateUrl from './system-navigation.html'; | ||
|
||
function systemNavigation() { | ||
return { | ||
scope: { | ||
system: '=', | ||
patient: '=' | ||
}, | ||
templateUrl: templateUrl, | ||
link: function(scope) { | ||
scope.items = getLinks(scope.system, scope.patient); | ||
} | ||
}; | ||
} | ||
|
||
export default systemNavigation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="patient-nav"> | ||
<ul> | ||
<li class="radar"> | ||
{{system.shortName}} | ||
</li> | ||
|
||
<li ui-sref-active="active" ng-repeat="item in items"> | ||
<a ui-sref="{{item.state}}">{{item.name}}</a> | ||
</li> | ||
|
||
<li ui-sref-active="active"> | ||
<a ui-sref="patient.all({patientId: patient.id})">More…</a> | ||
</li> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters