Sha256: e4561ee7caaa1b3b8751260b01cb8c99ab769392444b830a20ffdcf6746a62c5

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

class Lanes.Components.Grid.Toolbar extends Lanes.React.BaseComponent

    propTypes:
        onAddRecord: React.PropTypes.func
        startEdit: React.PropTypes.func
        toolbarChildren: React.PropTypes.oneOfType([
            React.PropTypes.element,
            React.PropTypes.arrayOf(React.PropTypes.element)
        ])

    onAddRecord: ->
        @props.query.results.addBlankRow(0)
        @props.startEdit(0)

    AddButton: ->
        return null unless @props.allowCreate
        <BS.Button className="navbar-btn add-row pull-right"
            onClick={@onAddRecord} bsSize='small'
        >
            <LC.Icon type="plus" />Add Row
        </BS.Button>


    shouldDisplay: ->
        not ( ( false == @props.commands?.isEditing() or not @props.allowCreate ) and not @props.toolbarChildren )

    render: ->
        return null unless @shouldDisplay()

        props = _.extend {}, @props,
        <Lanes.Components.Grid.Toolbar key="toolbar" {...props} />

        <BS.Navbar className="toolbar">
            {@props.toolbarChildren}
            <@AddButton />
        </BS.Navbar>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/components/grid/Toolbar.cjsx
lanes-0.6.1 client/lanes/components/grid/Toolbar.cjsx
lanes-0.6.0 client/lanes/components/grid/Toolbar.cjsx