Sha256: 627c31ff04472b8cf494fc5dccb0e048069e55ad0e8f101a9e9f81296fd66e24

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

Lanes.Screens.ChangeListener = {

    modelEvents:
        'remote-update': 'onChange'

    domEvents:
        'show.bs.dropdown .changes-notification': 'onChangesShow'

    session:
        change_count: ['number', true, 0]

    derived:
        changes: deps:[], fn: ->
            new Lanes.Models.ChangeSetCollection([], { parent: this })
        changes_visible: { deps: ['change_count'], fn: -> @change_count > 0 }

    bindings:
        'changes_visible': { selector: '.changes-notification', type: 'toggle' }
        'change_count': [
            { selector: '.changes-notification .title span',             type: 'text' }
            { selector: '.changes-notification .dropdown-toggle .badge', type: 'text' }
        ]

    subviews:
        changesDropDown:
            hook: 'changes-display'
            view: 'Lanes.Views.ModelUpdate'
            collection: 'changes'

    onChange: (model, change) ->
        @changes.add(change)
        @change_count += 1

    bindModel: (model) ->
        Lanes.Views.Base.prototype.bindModel.call(this, model)
        @changes.reset([])
        @change_count = 0

    onChangesShow: (ev) ->
        this.changes.invoke('updateTimeAgo')
        this.$('.changes-notification .scroller').animate({ scrollTop: 0 })

}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lanes-0.7.0 client/lanes/screens/ChangeListener.coffee
lanes-0.6.1 client/lanes/screens/ChangeListener.coffee
lanes-0.6.0 client/lanes/screens/ChangeListener.coffee
lanes-0.5.6 client/lanes/screens/ChangeListener.coffee
lanes-0.5.5 client/lanes/screens/ChangeListener.coffee
lanes-0.5.0 client/lanes/screens/ChangeListener.coffee
lanes-0.4.0 client/lanes/screens/ChangeListener.coffee
lanes-0.3.0 client/lanes/screens/ChangeListener.coffee