Sha256: 6b1d895a0a384872b3a1cbf65b3f9668330910c394ee38e14b0092fa74354ad0

Contents?: true

Size: 987 Bytes

Versions: 3

Compression:

Stored size: 987 Bytes

Contents

Luca.fields.ButtonField = Luca.core.Field.extend
  form_field: true

  readOnly: true

  events:
    "click input" : "click_handler"

  hooks:[
    "button:click"
  ]

  className: 'luca-ui-field luca-ui-button-field'

  template: 'fields/button_field'

  click_handler: (e)->
    me = my = $( e.currentTarget )
    @trigger "button:click"

  initialize: (@options={})->
    _.extend @options
    _.bindAll @, "click_handler"

    Luca.core.Field::initialize.apply @, arguments

    @template = "fields/button_field_link" if @icon_class?.length

  afterInitialize: ()->
    @input_id ||= _.uniqueId('button')
    @input_name ||= @name ||= @input_id
    @input_value ||= @label ||= @text
    @input_type ||= "button"
    @input_class ||= @class
    @icon_class ||= ""
    @icon_class = "icon-#{ @icon_class }" if @icon_class.length and !@icon_class.match(/^icon-/)
    @icon_class += " icon-white" if @white

  setValue: ()-> true

Luca.register "button_field", "Luca.fields.ButtonField"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
luca-0.8.3 src/components/fields/button_field.coffee
luca-0.8.2 src/components/fields/button_field.coffee
luca-0.8.06 src/components/fields/button_field.coffee