Files
2017-12-21 11:42:41 +01:00

40 lines
1.2 KiB
CoffeeScript

import Ember from 'ember'
import layout from '../templates/components/push-action'
export default Ember.Component.extend
layout: layout
tagName: 'button'
type: ''
size: ''
model: null
classNames: ['push-action', 'ui', 'icon', 'button']
classNameBindings: ['type', 'size', 'colorClass']
click: ->
@sendAction 'action', @get('model')
colorClass: Ember.computed 'type', ->
return unless type = @get('type')
switch type
when 'save' then 'primary'
when 'destroy' then 'negative'
when 'new' then 'grey'
else ''
iconClass: Ember.computed 'type', ->
return unless type = @get('type')
switch type
when 'edit' then 'pencil'
when 'new' then 'plus'
when 'show' then 'eye'
when 'sort' then 'sort'
when 'rollback' then 'undo'
when 'save' then 'save'
when 'destroy' then 'trash'
when 'authorization' then 'users' # 'unlock alternate'
when 'constraints' then 'connectdevelop'
when 'position' then 'random'
when 'contract' then 'file text'
when 'raster' then 'grid layout'
else type