Sha256: 8944fabb7bf5e169bbf3a6385cadebd7487f735567cfdc35c0eedc1a9eee820a

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

class Skr.Components.UserPreferences extends Lanes.React.Component
    dataObjects:
        user: -> Lanes.current_user
        projects: -> new Skr.Models.CustomerProject.Collection

    componentWillMount: -> @projects.ensureLoaded()

    setProject: (project) ->
        @user.options = _.extend({}, @user.options, {project_id: project.id})

    getProject: ->
        return unless @user.options?.project_id
        { id: @user.options.project_id, label: @projects.get(@user.options.project_id)?.code }

    render: ->
        <BS.Row className="skr-preferences">

            <LC.SelectField xs=4
                fetchWhenOpen={false}
                label='Default Customer Project'
                labelField='code'
                model={@user}
                name='options'
                choices={@projects.models}
                setSelection={@setProject}
                getSelection={@getProject}
                queryModel={Skr.Models.CustomerProject}
            />

        </BS.Row>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stockor-0.4.0 client/skr/components/UserPreferences.cjsx
stockor-0.3.0 client/skr/components/UserPreferences.cjsx
stockor-0.2 client/skr/components/UserPreferences.cjsx