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

Commit

Permalink
sugar refactor based on stefan's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
turboMaCk committed Dec 6, 2015
1 parent 5da0115 commit e6384b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions app/components/inventory/rank-display.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';

const c = Ember.computed;
import computed from 'ember-computed';

export default Ember.Component.extend({
tagName: 'span',
Expand All @@ -9,7 +8,7 @@ export default Ember.Component.extend({
rank: null,
noValueProp: 'n/a',

classProperty: c('rank', function() {
classProperty: computed('rank', function() {
const rank = this.get('rank');

if (Ember.isEmpty(rank)) {
Expand All @@ -26,7 +25,7 @@ export default Ember.Component.extend({
}
}),

rankDisplay: c('rank', function() {
rankDisplay: computed('rank', function() {
const rank = this.get('rank');
return Ember.isEmpty(rank) ? this.get('noValueProp') : rank;
})
Expand Down
7 changes: 3 additions & 4 deletions app/components/inventory/rank-select.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import Ember from 'ember';
import SelectValues from 'hospitalrun/utils/select-values';

const c = Ember.computed;
import computed from 'ember-computed';

export default Ember.Component.extend({
label: 'Rank',
rankOptions: [],
prompt: ' ',
class: 'col-sm-2 test-inv-rank',

options: c('rankOptions', function() {
options: computed('rankOptions', function() {
return SelectValues.selectValues(this.get('rankOptions'));
}),

init() {
this._super();
this._super(...arguments);

// set available options
this.set('rankOptions', Ember.A(['A', 'B', 'C']));
Expand Down

0 comments on commit e6384b9

Please sign in to comment.