   'compiled/react/shared/utils/withReactDOM'
   'compiled/fn/preventDefault'
   '../modules/customPropTypes'
+  '../modules/filesEnv'
   'compiled/models/Folder'
   './RestrictedDialogForm'
   '../utils/openMoveDialog'

  '../utils/deleteStuff'
  'jquery'
  'jqueryui/dialog'
], (I18n, React, withReactDOM, preventDefault, customPropTypes, Folder, RestrictedDialogForm, openMoveDialog, downloadStuffAsAZip, deleteStuff, $) ->

  ItemCog = React.createClass
    displayName: 'ItemCog'

    propTypes:
      model: customPropTypes.filesystemObject

    render: withReactDOM ->
      wrap = (fn) =>
        preventDefault (event) =>
          singularContextType = @props.model.collection?.parentFolder?.get('context_type').toLowerCase()
          pluralContextType = singularContextType + 's' if singularContextType?
          contextType = pluralContextType || filesEnv.contextType
          contextId = @props.model.collection?.parentFolder?.get('context_id') || filesEnv.contextId
          fn([@props.model], {
            contextType: contextType
            contextId: contextId
            returnFocusTo: event.target
          })

