engine/app/assets/javascripts/locomotive/views/sites/membership_entry_view.js.coffee

29 lines
664 B
CoffeeScript

Locomotive.Views.Site ||= {}
class Locomotive.Views.Site.MembershipEntryView extends Backbone.View
className: 'entry'
events:
'change select' : 'change'
'click a.remove': 'remove'
render: ->
data = @model.toJSON()
data.index = @options.index
$(@el).html(ich.membership_entry(data))
@$('select').val(@model.get('role'))
return @
change: (event) ->
value = $(event.target).val()
@options.parent_view.change_entry(@model, value)
remove: (event) ->
event.stopPropagation() & event.preventDefault()
@$('select').editableField('destroy')
@options.parent_view.remove_entry(@model)
super()