2011-12-02 14:59:41 +00:00
|
|
|
Locomotive.Views.Sites ||= {}
|
2011-11-29 13:58:19 +00:00
|
|
|
|
2011-12-02 14:59:41 +00:00
|
|
|
class Locomotive.Views.Sites.MembershipEntryView extends Backbone.View
|
2011-11-29 13:58:19 +00:00
|
|
|
|
|
|
|
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()
|