Sha256: c9a29d0cf726649c6fcf02e993a5a0e00cc01ad8de6d1cdf45372b9bb1d7b07d

Contents?: true

Size: 586 Bytes

Versions: 10

Compression:

Stored size: 586 Bytes

Contents

Locomotive.Views.Inputs ||= {}

class Locomotive.Views.Inputs.DocumentPickerView extends Backbone.View

  initialize: ->
    super
    @$input   = @$('input[type=hidden]')
    @$link    = @$('a.edit')

  render: ->
    label = @$input.data('label')

    Select2.helpers.build @$input,
      allowClear:     true
      initSelection:  (element, callback) ->
        callback(text: label)

    # hide the edit button if the user changes the selected document
    @$input.on 'select2-selecting', (el) =>
      @$link.addClass('hide')

  remove: ->
    @$input.select2('destroy')
    super

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc6 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.rc5 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.rc4 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.rc3 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.rc2 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.rc1 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.pre.beta.1 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.pre.alpha.3 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.pre.alpha.2 app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee
locomotivecms-3.0.0.pre.alpha app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee