-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement donating, adding a new card, and selecting a card
- Loading branch information
Showing
55 changed files
with
1,390 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Ember from 'ember'; | ||
|
||
const { | ||
Component, | ||
computed | ||
} = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['card-item'], | ||
classNameBindings: ['isSelected:selected'], | ||
|
||
isSelected: computed('card', 'selectedCard', function() { | ||
return this.get('card.id') === this.get('selectedCard.id'); | ||
}), | ||
|
||
selectedCard: null, | ||
|
||
click() { | ||
this.get('select')(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Ember from 'ember'; | ||
|
||
const { | ||
Component, | ||
computed: { alias, empty } | ||
} = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['card-list'], | ||
|
||
cardNotSelected: empty('selectedCard'), | ||
donationDisabled: alias('cardNotSelected'), | ||
|
||
selectedCard: null, | ||
|
||
selectCard(card) { | ||
this.set('selectedCard', card); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import Ember from 'ember'; | ||
|
||
const { Component } = Ember; | ||
const { Component, computed, isEmpty } = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['create-donation'], | ||
presetAmounts: [10, 15, 25, 50], | ||
amount: 15 | ||
amount: 10, | ||
|
||
selectedAmount: computed('amount', 'customAmount', function() { | ||
let { amount, customAmount } = this.getProperties('amount', 'customAmount'); | ||
return isEmpty(customAmount) ? amount : customAmount; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import Ember from 'ember'; | ||
|
||
const { Component, computed } = Ember; | ||
const { Component, computed, isEmpty } = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['preset-amount'], | ||
classNameBindings: ['presetAmount', 'selected:default:clear'], | ||
tagName: 'button', | ||
|
||
selected: computed('presetAmount', 'selectedAmount', function() { | ||
let { presetAmount, selectedAmount } = this.getProperties('presetAmount', 'selectedAmount'); | ||
return parseInt(presetAmount) === parseInt(selectedAmount); | ||
selected: computed('customAmount', 'presetAmount', 'selectedAmount', function() { | ||
let { customAmount, presetAmount, selectedAmount } = this.getProperties('customAmount', 'presetAmount', 'selectedAmount'); | ||
let amountInPresets = parseInt(presetAmount) === parseInt(selectedAmount); | ||
return isEmpty(customAmount) ? amountInPresets : false; | ||
}), | ||
|
||
click() { | ||
this.sendAction('setCustomAmount', null); | ||
let presetAmount = this.get('presetAmount'); | ||
this.sendAction('action', presetAmount); | ||
this.sendAction('setAmount', presetAmount); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.