 
 ShareButton = rclass
     propTypes:
-        id     : rtypes.string
-        type   : rtypes.string # directory or file
-        on_click : rtypes.func
-
-    share_item: (e) ->
-        e.preventDefault()
-        e.stopPropagation()
-        @props.on_click()
+        id       : rtypes.string
+        on_click : rtypes.func.isRequired
 
     render: ->
         <span><Space/>
             <Button
                 bsStyle = 'default'
                 bsSize  = 'xsmall'
-                onClick = {@share_item}
+                onClick = {@props.on_click}
             >
                 <Icon name='share-square-o' /> <span className='hidden-xs'>Share...</span>
             </Button>

    render_public_directory_info: ->
        if @props.public_data? and @props.is_public
            <PublicButton
                id     = {@props.name}
                data   = {@props.public_data}
                type   = 'folder'
            />
        else
            <ShareButton
                id       = {@props.name}
                on_click = {=> @props.actions.set_all_files_unchecked();@props.actions.set_file_checked(@props.name, true);@props.actions.set_file_action('share')}
                type     = 'folder'/>

    render_time: ->
        if @props.time?


PublicButton = rclass
    propTypes:
        id       : rtypes.string
        on_click : rtypes.func.isRequired

    render: ->
        <span><Space/>
            <Button
                bsStyle = 'info'
                bsSize  = 'xsmall'
                onClick = {@props.on_click}
            >
                <Icon name='bullhorn' /> <span className='hidden-xs'>Public...</span>
            </Button>
        </span>

generate_on_share_click = (name, actions) =>
    (e) =>
        e.preventDefault()
        e.stopPropagation()
        actions.set_all_files_unchecked()
        actions.set_file_checked(name, true)
        actions.set_file_action('share')

FileRow = rclass
    displayName : 'ProjectFiles-FileRow'
