Skip to content

Instantly share code, notes, and snippets.

@Daniel1984
Created May 31, 2016 14:12
Show Gist options
  • Save Daniel1984/adf65e5481565ab7c4809fe873e05b20 to your computer and use it in GitHub Desktop.
Save Daniel1984/adf65e5481565ab7c4809fe873e05b20 to your computer and use it in GitHub Desktop.
module = require('refactor/module')
templateUrl = require('./cardDetailedItemTemplate.html')
class Controller
### @ngInject ###
constructor: ($element, @_$q, @_cardDetailsModal, @_fullScreenLoading) ->
@usedInWrapsPopupVisible = false
@cardUsedInWraps = @card.usedInWraps?.length
previewCard: ->
@_cardDetailsModal.open({ @card, @cards, cloneCard: @cloneCard.bind(@) })
toggleUsedInWrapsPopup: ->
@usedInWrapsPopupVisible = !@usedInWrapsPopupVisible
cloneCard: ->
@_fullScreenLoading.show()
return @_$q.all([
@card.clone()
@onPagerReset()
]).then(=> @_fullScreenLoading.hide())
module.component('wmCardDetailedItem', {
bindings: {
card: '<'
cards: '<'
highlight: '<'
onPagerReset: '&'
}
controller: Controller
templateUrl
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment