Sha256: e5b63a326e9dede3519c17ce8115743073c53303f678162b5224397e9d622495

Contents?: true

Size: 715 Bytes

Versions: 8

Compression:

Stored size: 715 Bytes

Contents

Lanes.React.Mixins.Screen = {

    childContextTypes:
        screen: React.PropTypes.object

    listenNetworkEvents: true

    loadOrCreateModel: (options) ->
        if options.prop and @props[options.prop]
            if options.syncOptions?.include
                @props[options.prop].withAssociations(options.syncOptions.include, options.syncOptions)
            @props[options.prop]
        else
            model = new options.klass
            if options.attribute and @props.args?.length
                model.fetch(_.extend( {}, options.syncOptions, {
                    query: {"#{options.attribute}": @props.args[0]}
                })).then => @state?.commands?.setModel(model)
            model

}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/react/mixins/Screen.coffee
lanes-0.6.1 client/lanes/react/mixins/Screen.coffee
lanes-0.6.0 client/lanes/react/mixins/Screen.coffee
lanes-0.5.6 client/lanes/react/mixins/Screen.coffee
lanes-0.5.5 client/lanes/react/mixins/Screen.coffee
lanes-0.5.0 client/lanes/react/mixins/Screen.coffee
lanes-0.4.0 client/lanes/react/mixins/Screen.coffee
lanes-0.3.0 client/lanes/react/mixins/Screen.coffee