diff --git a/app/helpers/equal.js b/app/helpers/equal.js new file mode 100644 index 0000000..db3e867 --- /dev/null +++ b/app/helpers/equal.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export function equalHelper(params) { + return params[0] === params[1]; +} + +export default Ember.HTMLBars.makeBoundHelper(equalHelper); diff --git a/app/pods/protected/users/edit/template.hbs b/app/pods/protected/users/edit/template.hbs index 68d66b4..2f2f678 100644 --- a/app/pods/protected/users/edit/template.hbs +++ b/app/pods/protected/users/edit/template.hbs @@ -1,6 +1,7 @@ {{ protected/users/user-form user=model + currentUser=session.currentUser save="save" cancel="cancel" }} diff --git a/app/pods/protected/users/user-form/component.js b/app/pods/protected/users/user-form/component.js index a53a469..d5ce463 100644 --- a/app/pods/protected/users/user-form/component.js +++ b/app/pods/protected/users/user-form/component.js @@ -1,6 +1,12 @@ import Ember from 'ember'; export default Ember.Component.extend({ + isAdmin: Ember.computed('currentUser', function() { + return this.get('currentUser.role') == 'A'; + }), + + roles: Ember.String.w('A R W'), + actions: { save: function() { this.sendAction('save'); diff --git a/app/pods/protected/users/user-form/template.hbs b/app/pods/protected/users/user-form/template.hbs index 60c2d77..a872aae 100644 --- a/app/pods/protected/users/user-form/template.hbs +++ b/app/pods/protected/users/user-form/template.hbs @@ -16,7 +16,15 @@
- {{user.role}} + {{#if isAdmin}} + + {{else}} + {{user.role}} + {{/if}}