Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default Component.extend(EmberKeyboardMixin, {
classNames: ['task-assignment'],
currentUser: service(),
store: service(),
taskAssignment: service(),
isAssigning: false,
canTriggerAssignment: null,
deferredRendering: null,
task: null,
taskUser: null,
users: null,
// auto-assigns 'task' property from component as ability 'model'
ability: EmberCan.computed.ability('task'),
canAssign: alias('ability.canAssign'),
currentUserId: alias('currentUser.user.id'),
taskUserId: alias('taskUser.id'),
assignedToSelf: computed('currentUserId', 'taskUser.id', function() {
return isEqual(get(this, 'taskUser.id'), get(this, 'currentUserId'));
}),
init() {
this._super(...arguments);
set(this, 'keyboardActivated', true);
},
// TODO: this updates selection when it changes. However, it updates while
// the change is still processing, and rolls back if it fails.
flashMessages: service(),
session: service(),
store: service(),
bound: false,
editingDetails: false,
hasHovered: false,
hovering: false,
shouldShowUsers: false,
task: null,
taskUser: null,
users: null,
// auto-assigns 'task' property from component as ability 'model'
ability: EmberCan.computed.ability('task'),
canArchive: alias('ability.canArchive'),
canReposition: alias('ability.canReposition'),
isLoading: alias('task.isLoading'),
taskSkills: mapBy('task.taskSkills', 'skill'),
init() {
this._super(...arguments);
},
/**
For usage with data attribute bindings. Needs to be a function because it
needs to send 'true' and 'false' strings.
*/
'data-can-reposition': computed('canReposition', function() {
let canReposition = get(this, 'canReposition');
return canReposition ? 'true' : 'false';
import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { get } from '@ember/object';
import EmberCan from 'ember-can';
export default Component.extend({
classNames: ['archive-task'],
// auto-assigns 'task' property from component as ability 'model'
ability: EmberCan.computed.ability('task'),
canArchive: alias('ability.canArchive'),
actions: {
archiveTask() {
if (window.confirm(`Are you sure you want to archive this task? Archiving this task will remove it from your ${get(this, 'task.taskList.title')} task list.`)) {
get(this, 'archiveTask')();
}
}
}
});
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import RSVP from 'rsvp';
import { set, get } from '@ember/object';
import EmberCan from 'ember-can';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Route.extend(AuthenticatedRouteMixin, {
currentUser: service(),
ability: EmberCan.computed.ability('organization', 'membership'),
/**
* model - Route lifecycle hook
*
* @return {RSVP.hash} promise hash containing the project,
* the task type for the new task and the current user
*/
model() {
let project = this.modelFor('project').reload();
let user = get(this, 'currentUser.user');
return RSVP.hash({ project, user });
},
/**
* setupController - Route lifecycle hook