This commit is contained in:
Matthew Ryan Dillon 2015-10-16 11:07:09 -07:00
parent bcd2bbb4c4
commit d3355370fd
6 changed files with 4 additions and 10 deletions

View file

@ -1,5 +1,3 @@
import Ember from 'ember';
export function initialize(container, application) { export function initialize(container, application) {
application.inject('session:custom', '_store', 'service:store'); application.inject('session:custom', '_store', 'service:store');
} }

View file

@ -3,7 +3,7 @@ import Ember from 'ember';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
actions: { actions: {
delete: function() { delete: function() {
this.get('model').destroyRecord() this.get('model').destroyRecord();
this.transitionToRoute('protected.characteristics.index'); this.transitionToRoute('protected.characteristics.index');
}, },
}, },

View file

@ -7,7 +7,7 @@ export default Ember.Route.extend({
let user_id = transition.params['protected.users.edit'].user_id; let user_id = transition.params['protected.users.edit'].user_id;
this.get('session.currentUser').then((user) => { this.get('session.currentUser').then((user) => {
if (user.get('id') !== user_id || user.get('isAdmin')) { if (user.get('id') !== user_id && !user.get('isAdmin')) {
this.transitionTo('protected.users.index'); this.transitionTo('protected.users.index');
} }
}); });

View file

@ -9,7 +9,7 @@ export default Ember.Route.extend({
if (!currentUser.get('isAdmin') && currentUser.get('id') !== user_id) { if (!currentUser.get('isAdmin') && currentUser.get('id') !== user_id) {
this.transitionTo('protected.users.index'); this.transitionTo('protected.users.index');
} }
}) });
}, },
model: function(params) { model: function(params) {

View file

@ -1,10 +1,6 @@
import Ember from 'ember'; import Ember from 'ember';
export default Ember.Component.extend({ export default Ember.Component.extend({
isAdmin: Ember.computed('currentUser', function() {
return this.get('currentUser.role') == 'A';
}),
roles: Ember.String.w('A R W'), roles: Ember.String.w('A R W'),
actions: { actions: {

View file

@ -16,7 +16,7 @@
<div data-row-span="1"> <div data-row-span="1">
<div data-field-span="1"> <div data-field-span="1">
<label>Role</label> <label>Role</label>
{{#if isAdmin}} {{#if session.currentUser.isAdmin}}
<select onchange={{action (mut user.role) value="target.value"}}> <select onchange={{action (mut user.role) value="target.value"}}>
{{#each roles as |roleChoice|}} {{#each roles as |roleChoice|}}
<option value={{roleChoice}} selected={{equal user.role roleChoice}}>{{roleChoice}}</option> <option value={{roleChoice}} selected={{equal user.role roleChoice}}>{{roleChoice}}</option>