Skip to content

Commit

Permalink
Merge 30fd0ca into 1737e4e
Browse files Browse the repository at this point in the history
  • Loading branch information
EWhite613 committed Jul 18, 2016
2 parents 1737e4e + 30fd0ca commit a422efe
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions addon/pods/components/frost-list-item/component.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global $ */
import Ember from 'ember'
import _ from 'lodash/lodash'
import FrostList from '../frost-list/component'
Expand All @@ -9,8 +10,13 @@ export default Ember.Component.extend({
this.set('_frostList', this.nearestOfType(FrostList))
}),

isSelected: Ember.computed.reads('model.isSelected'),

isSelected: Ember.computed('model.isSelected', function () {
// TODO: Find a better solution for binding the className to the parent
let modelIsSelect = this.get('model.isSelected')
modelIsSelect ? $(this.get('element')).parent().addClass('is-selected')
: $(this.get('element')).parent().removeClass('is-selected')
return modelIsSelect
}),
onclick: Ember.on('click', function (event) {
if (!(Ember.ViewUtils.isSimpleClick(event) || event.shiftKey || event.metaKey || event.ctrlKey)) {
return true
Expand All @@ -37,11 +43,11 @@ export default Ember.Component.extend({
isSelected: !this.get('model.isSelected'),
isTargetSelectionIndicator: isTargetSelectionIndicator,
isShiftSelect: false,
isCtrlSelect: (event.metaKey || event.ctrlKey) && (!this.get('_frostList.persistedClickState.isSelected')) && !this.get('isSelected')
isCtrlSelect: (event.metaKey || event.ctrlKey) && (!this.get('_frostList.persistedClickState.isSelected')) &&
!this.get('isSelected')
})
}
this.set('_frostList.persistedClickState', {clickedRecord: this.get('model'), isSelected: this.get('isSelected')})
this.get('isSelected') ? this.$().parent().removeClass('is-selected') : this.$().parent().addClass('is-selected')
}
})
})

0 comments on commit a422efe

Please sign in to comment.