Sha256: 4a5f1a563588d1b65d58005d70bae6e9ea15b38e6cee9bdecbe0ef69fca19528

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

### = Description
 ## Simple HButton extension, operates on its value so it's useful
 ## for sending button clicks to the server and the like.
 ## For the value responder, reset the value to 0 when read to make
 ## the button clickable again.
 ##
 ## = Value states
 ## +0+::     Enabled, clickable
 ## +1+::     Disabled, clicked
 ## +Other+:: Disabled, not clickable, not clicked
 ###
HClickButton = HButton.extend

  defaultEvents:
    click: true

  controlDefaults: HButton.prototype.controlDefaults.extend
    clickOnValue: 1
    clickOffValue: 0

  ###
  # = Description
  # Sets the button enabled if this.value is 0.
  #
  ###
  refreshValue: ->
    if @options.inverseValue
      @setEnabled( @value == @options.clickOnValue )
    else
      @setEnabled( @value == @options.clickOffValue )

  ###
  # = Description
  # Click method, sets the value to disabled if the button is enabled.
  #
  ###
  click: ->
    if @enabled
      if @options.inverseValue
        @setValue( @options.clickOffValue )
      else
        @setValue( @options.clickOnValue )

HClickValueButton = HClickButton

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rsence-pre-3.0.0.16 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.15 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.14 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.12 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.11 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.10 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.9 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.8 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.7 client/js/controls/clickbutton/clickbutton.coffee
rsence-pre-3.0.0.6 client/js/controls/clickbutton/clickbutton.coffee