React = require 'react'
_ = require 'underscore'
PluginsActions = require './plugins-actions'
class Package extends React.Component
@displayName: 'Package'
@propTypes:
'package': React.PropTypes.object.isRequired
constructor: (@props) ->
render: =>
actions = []
extras = []
if @props.package.installed
if @props.package.category in ['user' ,'dev']
if @props.package.enabled
actions.push
Disable
else
actions.push Enable
if @props.package.category is 'user'
actions.push Uninstall
if @props.package.category is 'dev'
actions.push Show...
else if @props.package.installing
actions.push Installing...
else
actions.push Install
{name, description} = @props.package
if @props.package.newerVersionAvailable
extras.push(
A newer version is available: {@props.package.newerVersion}
Update
)
{actions}
{name}
{description}
{extras}
_onDisablePackage: =>
PluginsActions.disablePackage(@props.package)
_onEnablePackage: =>
PluginsActions.enablePackage(@props.package)
_onUninstallPackage: =>
PluginsActions.uninstallPackage(@props.package)
_onUpdatePackage: =>
PluginsActions.updatePackage(@props.package)
_onInstallPackage: =>
PluginsActions.installPackage(@props.package)
_onShowPackage: =>
PluginsActions.showPackage(@props.package)
module.exports = Package