mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-28 10:01:58 +00:00
37 lines
976 B
Plaintext
37 lines
976 B
Plaintext
<script type='text/coffeescript'>
|
|
byond = require "../byond"
|
|
constants = require "../constants"
|
|
|
|
component.exports =
|
|
computed:
|
|
clickable: ->
|
|
if @get("enabled") && not @get "state" then true
|
|
else false
|
|
enabled: ->
|
|
if @get("config.status") is constants.UI_INTERACTIVE then true
|
|
else false
|
|
styles: ->
|
|
enabled = @get "enabled"
|
|
state = @get "state"
|
|
style = @get "style"
|
|
if enabled
|
|
if not state then "normal #{[style]}"
|
|
else "#{state}"
|
|
else "disabled"
|
|
oninit: ->
|
|
@on "act", (event) ->
|
|
event.node.blur()
|
|
{action, params} = @get()
|
|
byond.act @get("config.ref"), action, params if action?
|
|
</script>
|
|
|
|
<span class='button {{styles}} {{#grid}}gridable{{/}}'
|
|
unselectable='true'
|
|
{{#clickable}}tabindex='0'{{/}}
|
|
on-click-enter='{{#clickable}}act{{/}}'>
|
|
{{#if icon}}
|
|
<i class='fa fa-{{icon}}'></i>
|
|
{{/if}}
|
|
{{yield}}
|
|
</span>
|