Sha256: e9fbf7914fd0678c6c11af3262a7adf0352efd7efffffe7158a1b91d7bfea6cb

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 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.onAddRecord and @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

2 entries across 2 versions & 1 rubygems

Version Path
lanes-0.5.6 client/lanes/components/grid/Toolbar.cjsx
lanes-0.5.5 client/lanes/components/grid/Toolbar.cjsx