Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Refactored imaging lists into components
Browse files Browse the repository at this point in the history
  • Loading branch information
clettenberg committed Apr 29, 2016
1 parent d204ac5 commit ee2a636
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 27 deletions.
5 changes: 5 additions & 0 deletions app/imaging/completed/completed-list-item/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: 'tr'
});
7 changes: 7 additions & 0 deletions app/imaging/completed/completed-list-item/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<td>{{date-format imaging.requestedDate}}</td>
<td>{{date-format imaging.imagingDate}}</td>
<td>{{imaging.requestedBy}}</td>
<td>{{imaging.patient.displayName}}</td>
<td>{{imaging.imagingType.name}}</td>
<td>{{imaging.results}}</td>
<td>{{imaging.notes}}</td>
18 changes: 5 additions & 13 deletions app/imaging/completed/template.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#item-listing paginationProps=paginationProps }}
{{#item-listing paginationProps=paginationProps}}
{{#if model}}
<table class="table">
<tr class="table-header">
Expand All @@ -11,20 +11,12 @@
<th>{{t 'labels.notes'}}</th>
</tr>
{{#each model as |imaging|}}
<tr>
<td>{{date-format imaging.requestedDate}}</td>
<td>{{date-format imaging.imagingDate}}</td>
<td>{{imaging.requestedBy}}</td>
<td>{{imaging.patient.displayName}}</td>
<td>{{imaging.imagingType.name}}</td>
<td>{{imaging.result}}</td>
<td>{{imaging.notes}}</td>
</tr>
{{imaging/completed/completed-list-item imaging=imaging}}
{{/each}}
</table>
{{else}}
<div class="alert alert-info">
<p>{{t 'imaging.messages.no_completed'}}</p>
</div>
<div class="alert alert-info">
<p>{{t 'imaging.messages.no_completed'}}</p>
</div>
{{/if}}
{{/item-listing}}
6 changes: 6 additions & 0 deletions app/imaging/index/imaging-edit-button/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: 'button',
classNames: ['btn', 'btn-default', 'neutral']
});
1 change: 1 addition & 0 deletions app/imaging/index/imaging-edit-button/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{#link-to 'imaging.edit' imaging}}{{t 'labels.edit'}}{{/link-to}}
10 changes: 10 additions & 0 deletions app/imaging/index/requested-list-item/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: 'tr',
classNames: ['clickable'],

click() {
this.sendAction('action', this.imaging);
}
});
13 changes: 13 additions & 0 deletions app/imaging/index/requested-list-item/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<td>{{date-format imaging.requestedDate}}</td>
<td>{{imaging.requestedBy}}</td>
<td>{{imaging.patient.displayName}}</td>
<td>{{imaging.imagingType.name}}</td>
<td>{{imaging.notes}}</td>

{{#if showActions}}
<td>
{{#if canEdit}}
{{imaging/index/imaging-edit-button imaging=imaging}}
{{/if}}
</td>
{{/if}}
19 changes: 5 additions & 14 deletions app/imaging/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,11 @@
{{/if}}
</tr>
{{#each model as |imaging|}}
<tr {{action 'editItem' imaging }} class="clickable">
<td>{{date-format imaging.requestedDate}}</td>
<td>{{imaging.requestedBy}}</td>
<td>{{imaging.patient.displayName}}</td>
<td>{{imaging.imagingType.name}}</td>
<td>{{imaging.notes}}</td>
{{#if showActions}}
<td>
{{#if canEdit}}
<button class="btn btn-default neutral" {{action 'editItem' imaging bubbles=false }}>{{t 'labels.edit'}}</button>
{{/if}}
</td>
{{/if}}
</tr>
{{imaging/index/requested-list-item
imaging=imaging
action="editItem"
showActions=showActions
canEdit=canEdit}}
{{/each}}
</table>
{{else}}
Expand Down
4 changes: 4 additions & 0 deletions app/styles/_temp_misc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
background-color: $white;
}

.light-text {
color: $gray_light;
}

//Loading icon from http://www.bootply.com/128062
.glyphicon-refresh-animate {
-animation: spin .7s infinite linear;
Expand Down

0 comments on commit ee2a636

Please sign in to comment.