Skip to content

Commit

Permalink
Merge pull request #1327 from code-corps/update-ember-cli-and-babel
Browse files Browse the repository at this point in the history
Update ember-cli, babel and related dependencies. Fix issues.
  • Loading branch information
joshsmith committed Jun 26, 2017
2 parents e69a2b0 + 622994c commit d440c94
Show file tree
Hide file tree
Showing 55 changed files with 1,638 additions and 1,439 deletions.
4 changes: 2 additions & 2 deletions app/components/category-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default Component.extend({
let userCategories = get(this, 'userCategories');

return userCategories.addCategory(category).catch(() => {
let message = `An error occurred trying to add ${category.get('name')}.`;
let message = `An error occurred trying to add ${get(category, 'name')}.`;
this._flashError(message);
}).finally(() => {
set(this, 'isLoading', false);
Expand All @@ -111,7 +111,7 @@ export default Component.extend({
let userCategories = get(this, 'userCategories');

return userCategories.removeCategory(category).catch(() => {
let message = `An error occurred trying to remove ${category.get('name')}.`;
let message = `An error occurred trying to remove ${get(category, 'name')}.`;
this._flashError(message);
}).finally(() => {
set(this, 'isLoading', false);
Expand Down
26 changes: 13 additions & 13 deletions app/components/demo-categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { task, timeout } from 'ember-concurrency';

const {
Component,
Object,
observer,
run: { later },
get, set,
testing
} = Ember;

Expand All @@ -15,49 +15,49 @@ const CONCURRENCY_TIMEOUT = testing ? 0 : 1500;

export default Component.extend({
categories: [
Object.create({
{
description: 'You want to improve government responsiveness.',
isLoading: false,
name: 'Government',
selected: false,
slug: 'government'
}),
Object.create({
},
{
description: 'You want to improve tools for advancing science.',
isLoading: false,
name: 'Science',
selected: false,
slug: 'science'
}),
Object.create({
},
{
description: 'You want to improve software tools and infrastructure.',
isLoading: false,
name: 'Technology',
selected: false,
slug: 'technology'
})
}
],
classNames: ['demo-categories'],

_animateItems: observer('animated', function() {
if (this.get('animated')) {
let categories = this.get('categories');
if (get(this, 'animated')) {
let categories = get(this, 'categories');
let indexesToAnimate = [0, 2];

later(() => {
indexesToAnimate.forEach((index) => {
let category = categories[index];
this.get('_animateItem').perform(category);
get(this, '_animateItem').perform(category);
});
}, INIT_DELAY);
}
}),

_animateItem: task(function* (category) {
category.set('selected', true);
category.set('isLoading', true);
set(category, 'selected', true);
set(category, 'isLoading', true);
later(() => {
category.set('isLoading', false);
set(category, 'isLoading', false);
}, LOADING_TOGGLE);
yield timeout(CONCURRENCY_TIMEOUT);
}).enqueue()
Expand Down
11 changes: 5 additions & 6 deletions app/components/demo-projects.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import Ember from 'ember';

const {
Component,
Object
Component
} = Ember;

export default Component.extend({
classNames: ['demo-projects'],
projects: [
Object.create({
{
title: 'Code Corps',
description: 'Building a better future together. Contribute to public software for social good.',
iconLargeUrl: 'https://d3pgew4wbk2vb1.cloudfront.net/images/cc-demo.png',
Expand Down Expand Up @@ -55,8 +54,8 @@ export default Component.extend({
matched: false
}
]
}),
Object.create({
},
{
title: 'Movement',
description: 'We help people elect their representatives and then hold them accountable.',
iconLargeUrl: 'https://d3pgew4wbk2vb1.cloudfront.net/images/movement-demo.png',
Expand Down Expand Up @@ -110,6 +109,6 @@ export default Component.extend({
matched: false
}
]
})
}
]
});
64 changes: 17 additions & 47 deletions app/components/demo-skills.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { task, timeout } from 'ember-concurrency';

const {
Component,
Object,
observer,
run: { later },
get, set,
testing
} = Ember;

Expand All @@ -15,68 +15,38 @@ const CONCURRENCY_TIMEOUT = testing ? 0 : 1000;

export default Component.extend({
skills: [
Object.create({
isLoading: false,
title: 'BASIC'
}),
Object.create({
isLoading: false,
title: 'Copywriting'
}),
Object.create({
isLoading: false,
title: 'Ember.js'
}),
Object.create({
isLoading: false,
title: 'HTML'
}),
Object.create({
isLoading: false,
title: 'Python'
}),
Object.create({
isLoading: false,
title: 'Rails'
}),
Object.create({
isLoading: false,
title: 'Ruby'
}),
Object.create({
isLoading: false,
title: 'SEO'
}),
Object.create({
isLoading: false,
title: 'Sketch'
}),
Object.create({
isLoading: false,
title: 'UX Design'
})
{ isLoading: false, title: 'BASIC' },
{ isLoading: false, title: 'Copywriting' },
{ isLoading: false, title: 'Ember.js' },
{ isLoading: false, title: 'HTML' },
{ isLoading: false, title: 'Python' },
{ isLoading: false, title: 'Rails' },
{ isLoading: false, title: 'Ruby' },
{ isLoading: false, title: 'SEO' },
{ isLoading: false, title: 'Sketch' },
{ isLoading: false, title: 'UX Design' }
],
classNames: ['demo-skills'],

_animateItems: observer('animated', function() {
if (this.get('animated')) {
let skills = this.get('skills');
if (get(this, 'animated')) {
let skills = get(this, 'skills');
let indexesToAnimate = [2, 3, 5, 6, 8, 9];

later(() => {
indexesToAnimate.forEach((index) => {
let skill = skills[index];
this.get('_animateItem').perform(skill);
get(this, '_animateItem').perform(skill);
});
}, INIT_DELAY);
}
}),

_animateItem: task(function* (skill) {
skill.set('selected', true);
skill.set('isLoading', true);
set(skill, 'selected', true);
set(skill, 'isLoading', true);
later(() => {
skill.set('isLoading', false);
set(skill, 'isLoading', false);
}, LOADING_TOGGLE);
yield timeout(CONCURRENCY_TIMEOUT);
}).enqueue()
Expand Down
11 changes: 7 additions & 4 deletions app/components/donation-goal-edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import Ember from 'ember';

const {
Component
Component,
get,
getProperties,
setProperties
} = Ember;

/**
Expand Down Expand Up @@ -45,8 +48,8 @@ export default Component.extend({

init() {
this._super(...arguments);
let donationGoal = this.get('donationGoal');
let { amount, description } = donationGoal.getProperties('amount', 'description');
this.setProperties({ amount, description });
let donationGoal = get(this, 'donationGoal');
let { amount, description } = getProperties(donationGoal, 'amount', 'description');
setProperties(this, { amount, description });
}
});
2 changes: 1 addition & 1 deletion app/components/member-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default Component.extend({

actions: {
approve(membership) {
membership.set('role', 'contributor');
set(membership, 'role', 'contributor');
return membership.save().then(() => {
this._flashSuccess('Membership approved');
});
Expand Down
16 changes: 9 additions & 7 deletions app/components/project-long-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import Ember from 'ember';
const {
Component,
computed: { or },
isPresent
get,
isPresent,
set
} = Ember;

/**
Expand Down Expand Up @@ -79,26 +81,26 @@ export default Component.extend({
@method save
*/
save() {
this.get('project').save().then(() => {
get(this, 'project').save().then(() => {
this._enterReadMode();
this._inferIfNeedsDescription();
});
}
},

_enterEditMode() {
this.set('isEditing', true);
set(this, 'isEditing', true);
},

_enterReadMode() {
this.set('isEditing', false);
set(this, 'isEditing', false);
},

_inferIfNeedsDescription() {
if (isPresent(this.get('project.longDescriptionBody'))) {
this.set('descriptionIsBlank', false);
if (isPresent(get(this, 'project.longDescriptionBody'))) {
set(this, 'descriptionIsBlank', false);
} else {
this.set('descriptionIsBlank', true);
set(this, 'descriptionIsBlank', true);
}
}
});
8 changes: 4 additions & 4 deletions app/components/role-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export default Component.extend({
actions: {
addRole(role) {
set(this, 'isLoading', true);
let userRoles = this.get('userRoles');
let userRoles = get(this, 'userRoles');
return userRoles.addRole(role).catch(() => {
let message = `An error occurred trying to add ${role.get('name')}.`;
let message = `An error occurred trying to add ${get(role, 'name')}.`;
this._flashError(message);
}).finally(() => {
set(this, 'isLoading', false);
Expand All @@ -39,9 +39,9 @@ export default Component.extend({

removeRole(role) {
set(this, 'isLoading', true);
let userRoles = this.get('userRoles');
let userRoles = get(this, 'userRoles');
return userRoles.removeRole(role).catch(() => {
let message = `An error occurred trying to remove ${role.get('name')}.`;
let message = `An error occurred trying to remove ${get(role, 'name')}.`;
this._flashError(message);
}).finally(() => {
set(this, 'isLoading', false);
Expand Down
Loading

0 comments on commit d440c94

Please sign in to comment.