Sha256: a0f566978af8db474336f4af9268dd84780fc661485602326c59958f45c1f90e
Contents?: true
Size: 1.27 KB
Versions: 8
Compression:
Stored size: 1.27 KB
Contents
class Lanes.Models.ChangeSet extends Lanes.Models.Base constructor: -> super this.created_at = new Date session: update: 'object' by: 'object' created_at: { type: 'date', setOnce: true } derived: record: { deps: ['collection'], fn: -> @collection.parent } record_name: { deps: ['record'], fn: -> _.field2title @record.modelTypeIdentifier() } fields: { deps: ['update'], fn: -> _.keys(@update) } displayed_fields: { deps:['fields'], fn: -> _.without(@fields, 'updated_by_id', 'updated_at') } displayed_changes: deps: ['displayed_fields'], fn: -> _.map @displayed_fields, (field) => c = @update[field] { name: field, from: c[0], to: c[1] } value: -> set = {} for field, change of @update set[field] = if _.isArray(change) then _.last(change) else change set class ChangeSetCollection extends Lanes.Models.BasicCollection model: Lanes.Models.ChangeSet constructor: (options) -> super([], options) comparator: (a, b) -> if b.created_at < a.created_at then -1 else if b.created_at > a.created_at then 1 else 0 Lanes.Models.ChangeSet.Collection = ChangeSetCollection
Version data entries
8 entries across 8 versions & 1 rubygems